Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
9fde8228
Commit
9fde8228
authored
Feb 06, 2004
by
Robert Reif
Committed by
Alexandre Julliard
Feb 06, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fallback to software buffer if failed to create hardware buffer.
Minor code cleanups.
parent
afd3c257
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
18 deletions
+46
-18
buffer.c
dlls/dsound/buffer.c
+46
-18
No files found.
dlls/dsound/buffer.c
View file @
9fde8228
...
@@ -386,7 +386,7 @@ static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) {
...
@@ -386,7 +386,7 @@ static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) {
This
->
dsound
->
buffers
[
i
]
=
This
->
dsound
->
buffers
[
This
->
dsound
->
nrofbuffers
-
1
];
This
->
dsound
->
buffers
[
i
]
=
This
->
dsound
->
buffers
[
This
->
dsound
->
nrofbuffers
-
1
];
This
->
dsound
->
nrofbuffers
--
;
This
->
dsound
->
nrofbuffers
--
;
This
->
dsound
->
buffers
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
dsound
->
buffers
,
sizeof
(
LPDIRECTSOUNDBUFFER8
)
*
This
->
dsound
->
nrofbuffers
);
This
->
dsound
->
buffers
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
dsound
->
buffers
,
sizeof
(
LPDIRECTSOUNDBUFFER8
)
*
This
->
dsound
->
nrofbuffers
);
TRACE
(
"
buffer count is now %d
\n
"
,
This
->
dsound
->
nrofbuffers
);
TRACE
(
"
(%p) buffer count is now %d
\n
"
,
This
,
This
->
dsound
->
nrofbuffers
);
IDirectSound_Release
((
LPDIRECTSOUND
)
This
->
dsound
);
IDirectSound_Release
((
LPDIRECTSOUND
)
This
->
dsound
);
}
}
RtlReleaseResource
(
&
(
This
->
dsound
->
lock
));
RtlReleaseResource
(
&
(
This
->
dsound
->
lock
));
...
@@ -1115,15 +1115,29 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
...
@@ -1115,15 +1115,29 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
err
=
IDsDriver_CreateSoundBuffer
(
ds
->
driver
,
wfex
,
dsbd
->
dwFlags
,
0
,
err
=
IDsDriver_CreateSoundBuffer
(
ds
->
driver
,
wfex
,
dsbd
->
dwFlags
,
0
,
&
(
dsb
->
buflen
),
&
(
dsb
->
buffer
->
memory
),
&
(
dsb
->
buflen
),
&
(
dsb
->
buffer
->
memory
),
(
LPVOID
*
)
&
(
dsb
->
hwbuf
));
(
LPVOID
*
)
&
(
dsb
->
hwbuf
));
/* fall back to software buffer on failure */
if
(
err
!=
DS_OK
)
{
if
(
err
!=
DS_OK
)
{
WARN
(
"IDsDriver_CreateSoundBuffer failed
\n
"
);
TRACE
(
"IDsDriver_CreateSoundBuffer failed, falling back to software buffer
\n
"
);
if
(
dsb
->
buffer
->
memory
)
use_hw
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
->
memory
);
if
(
ds
->
drvdesc
.
dwFlags
&
DSDDESC_USESYSTEMMEMORY
)
{
if
(
dsb
->
buffer
)
dsb
->
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
(
dsb
->
buffer
)));
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
);
if
(
dsb
->
buffer
==
NULL
)
{
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
WARN
(
"out of memory
\n
"
);
*
pdsb
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
return
err
;
*
pdsb
=
NULL
;
return
DSERR_OUTOFMEMORY
;
}
dsb
->
buffer
->
memory
=
(
LPBYTE
)
HeapAlloc
(
GetProcessHeap
(),
0
,
dsb
->
buflen
);
if
(
dsb
->
buffer
->
memory
==
NULL
)
{
WARN
(
"out of memory
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
*
pdsb
=
NULL
;
return
DSERR_OUTOFMEMORY
;
}
dsb
->
buffer
->
ref
=
1
;
}
}
}
}
}
...
@@ -1314,13 +1328,21 @@ static HRESULT WINAPI SecondaryBufferImpl_Initialize(
...
@@ -1314,13 +1328,21 @@ static HRESULT WINAPI SecondaryBufferImpl_Initialize(
}
}
static
HRESULT
WINAPI
SecondaryBufferImpl_Lock
(
static
HRESULT
WINAPI
SecondaryBufferImpl_Lock
(
LPDIRECTSOUNDBUFFER8
iface
,
DWORD
writecursor
,
DWORD
writebytes
,
LPVOID
lplpaudioptr1
,
LPDWORD
audiobytes1
,
LPVOID
lplpaudioptr2
,
LPDWORD
audiobytes2
,
DWORD
flags
)
LPDIRECTSOUNDBUFFER8
iface
,
DWORD
writecursor
,
DWORD
writebytes
,
LPVOID
lplpaudioptr1
,
LPDWORD
audiobytes1
,
LPVOID
lplpaudioptr2
,
LPDWORD
audiobytes2
,
DWORD
dwFlags
)
{
{
ICOM_THIS
(
SecondaryBufferImpl
,
iface
);
ICOM_THIS
(
SecondaryBufferImpl
,
iface
);
TRACE
(
"(%p,%ld,%ld,%p,%p,%p,%p,0x%08lx)
\n
"
,
TRACE
(
"(%p,%ld,%ld,%p,%p,%p,%p,0x%08lx)
\n
"
,
This
,
writecursor
,
writebytes
,
lplpaudioptr1
,
audiobytes1
,
lplpaudioptr2
,
audiobytes2
,
f
lags
);
This
,
writecursor
,
writebytes
,
lplpaudioptr1
,
audiobytes1
,
lplpaudioptr2
,
audiobytes2
,
dwF
lags
);
return
IDirectSoundBufferImpl_Lock
((
LPDIRECTSOUNDBUFFER8
)
This
->
dsb
,
writecursor
,
writebytes
,
lplpaudioptr1
,
audiobytes1
,
lplpaudioptr2
,
audiobytes2
,
flags
);
return
IDirectSoundBufferImpl_Lock
((
LPDIRECTSOUNDBUFFER8
)
This
->
dsb
,
writecursor
,
writebytes
,
lplpaudioptr1
,
audiobytes1
,
lplpaudioptr2
,
audiobytes2
,
dwFlags
);
}
}
static
HRESULT
WINAPI
SecondaryBufferImpl_Play
(
static
HRESULT
WINAPI
SecondaryBufferImpl_Play
(
...
@@ -1386,12 +1408,18 @@ static HRESULT WINAPI SecondaryBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface)
...
@@ -1386,12 +1408,18 @@ static HRESULT WINAPI SecondaryBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface)
}
}
static
HRESULT
WINAPI
SecondaryBufferImpl_Unlock
(
static
HRESULT
WINAPI
SecondaryBufferImpl_Unlock
(
LPDIRECTSOUNDBUFFER8
iface
,
LPVOID
p1
,
DWORD
x1
,
LPVOID
p2
,
DWORD
x2
)
LPDIRECTSOUNDBUFFER8
iface
,
LPVOID
lpvAudioPtr1
,
DWORD
dwAudioBytes1
,
LPVOID
lpvAudioPtr2
,
DWORD
dwAudioBytes2
)
{
{
ICOM_THIS
(
SecondaryBufferImpl
,
iface
);
ICOM_THIS
(
SecondaryBufferImpl
,
iface
);
TRACE
(
"(%p,%p,%ld,%p,%ld)
\n
"
,
This
,
p1
,
x1
,
p2
,
x2
);
TRACE
(
"(%p,%p,%ld,%p,%ld)
\n
"
,
This
,
lpvAudioPtr1
,
dwAudioBytes1
,
lpvAudioPtr2
,
dwAudioBytes2
);
return
IDirectSoundBufferImpl_Unlock
((
LPDIRECTSOUNDBUFFER8
)
This
->
dsb
,
p1
,
x1
,
p2
,
x2
);
return
IDirectSoundBufferImpl_Unlock
((
LPDIRECTSOUNDBUFFER8
)
This
->
dsb
,
lpvAudioPtr1
,
dwAudioBytes1
,
lpvAudioPtr2
,
dwAudioBytes2
);
}
}
static
HRESULT
WINAPI
SecondaryBufferImpl_Restore
(
static
HRESULT
WINAPI
SecondaryBufferImpl_Restore
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment