Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f8e4fb08
Commit
f8e4fb08
authored
Feb 20, 2000
by
Marcus Meissner
Committed by
Alexandre Julliard
Feb 20, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the buffer list in the directsound object thread-safe.
parent
4654c321
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
dsound_main.c
dlls/dsound/dsound_main.c
+16
-9
No files found.
dlls/dsound/dsound_main.c
View file @
f8e4fb08
...
...
@@ -98,6 +98,7 @@ struct IDirectSoundImpl
IDirectSoundBufferImpl
*
primary
;
IDirectSound3DListenerImpl
*
listener
;
WAVEFORMATEX
wfx
;
/* current main waveformat */
CRITICAL_SECTION
lock
;
};
/*****************************************************************************
...
...
@@ -803,7 +804,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat(
}
/* **** */
EnterCriticalSection
(
&
(
primarybuf
->
lock
));
EnterCriticalSection
(
&
(
This
->
dsound
->
lock
));
if
(
primarybuf
->
wfx
.
nSamplesPerSec
!=
wfex
->
nSamplesPerSec
)
{
dsb
=
dsound
->
buffers
;
...
...
@@ -829,10 +830,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat(
primarybuf
->
wfx
.
nAvgBytesPerSec
=
This
->
wfx
.
nSamplesPerSec
*
This
->
wfx
.
nBlockAlign
;
DSOUND_CloseAudio
();
LeaveCriticalSection
(
&
(
primarybuf
->
lock
));
LeaveCriticalSection
(
&
(
This
->
dsound
->
lock
));
/* **** */
return
DS_OK
;
...
...
@@ -963,6 +963,7 @@ static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER iface) {
if
(
--
This
->
ref
)
return
This
->
ref
;
EnterCriticalSection
(
&
(
This
->
dsound
->
lock
));
for
(
i
=
0
;
i
<
This
->
dsound
->
nrofbuffers
;
i
++
)
if
(
This
->
dsound
->
buffers
[
i
]
==
This
)
break
;
...
...
@@ -973,12 +974,11 @@ static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER iface) {
This
->
dsound
->
nrofbuffers
--
;
IDirectSound_Release
((
LPDIRECTSOUND
)
This
->
dsound
);
}
LeaveCriticalSection
(
&
(
This
->
dsound
->
lock
));
DeleteCriticalSection
(
&
(
This
->
lock
));
if
(
This
->
ds3db
&&
ICOM_VTBL
(
This
->
ds3db
))
IDirectSound3DBuffer_Release
((
LPDIRECTSOUND3DBUFFER
)
This
->
ds3db
);
if
(
This
->
parent
)
/* this is a duplicate buffer */
IDirectSoundBuffer_Release
((
LPDIRECTSOUNDBUFFER
)
This
->
parent
);
...
...
@@ -1369,12 +1369,15 @@ static HRESULT WINAPI IDirectSoundImpl_CreateSoundBuffer(
memcpy
(
&
((
*
ippdsb
)
->
dsbd
),
dsbd
,
sizeof
(
*
dsbd
));
EnterCriticalSection
(
&
(
This
->
lock
));
/* register buffer */
if
(
!
(
dsbd
->
dwFlags
&
DSBCAPS_PRIMARYBUFFER
))
{
This
->
buffers
=
(
IDirectSoundBufferImpl
**
)
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
buffers
,
sizeof
(
IDirectSoundBufferImpl
*
)
*
(
This
->
nrofbuffers
+
1
));
This
->
buffers
[
This
->
nrofbuffers
]
=
*
ippdsb
;
This
->
nrofbuffers
++
;
}
LeaveCriticalSection
(
&
(
This
->
lock
));
IDirectSound_AddRef
(
iface
);
if
(
dsbd
->
lpwfxFormat
)
...
...
@@ -1439,10 +1442,12 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer(
(
*
ippdsb
)
->
parent
=
ipdsb
;
memcpy
(
&
((
*
ippdsb
)
->
wfx
),
&
(
ipdsb
->
wfx
),
sizeof
((
*
ippdsb
)
->
wfx
));
/* register buffer */
EnterCriticalSection
(
&
(
This
->
lock
));
This
->
buffers
=
(
IDirectSoundBufferImpl
**
)
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
buffers
,
sizeof
(
IDirectSoundBufferImpl
**
)
*
(
This
->
nrofbuffers
+
1
));
This
->
buffers
[
This
->
nrofbuffers
]
=
*
ippdsb
;
This
->
nrofbuffers
++
;
IDirectSound_AddRef
(
iface
);
LeaveCriticalSection
(
&
(
This
->
lock
));
return
DS_OK
;
}
...
...
@@ -2222,7 +2227,7 @@ static DWORD WINAPI DSOUND_thread(LPVOID arg)
}
#endif
/* RACE: dsound could be deleted */
IDirectSound_AddRef
((
LPDIRECTSOUND
)
dsound
);
EnterCriticalSection
(
&
(
dsound
->
lock
)
);
if
(
primarybuf
==
NULL
)
{
/* Should never happen */
WARN
(
"Lost the primary buffer!
\n
"
);
...
...
@@ -2230,11 +2235,12 @@ static DWORD WINAPI DSOUND_thread(LPVOID arg)
ExitThread
(
0
);
}
/* **** */
EnterCriticalSection
(
&
(
primarybuf
->
lock
));
len
=
DSOUND_MixPrimary
();
LeaveCriticalSection
(
&
(
primarybuf
->
lock
));
/* **** */
LeaveCriticalSection
(
&
(
dsound
->
lock
));
if
(
primarybuf
->
playing
)
len
=
DSOUND_FRAGLEN
>
len
?
DSOUND_FRAGLEN
:
len
;
...
...
@@ -2247,7 +2253,6 @@ static DWORD WINAPI DSOUND_thread(LPVOID arg)
DSOUND_CloseAudio
();
Sleep
(
100
);
}
IDirectSound_Release
((
LPDIRECTSOUND
)
dsound
);
}
ExitThread
(
0
);
}
...
...
@@ -2309,6 +2314,8 @@ HRESULT WINAPI DirectSoundCreate(REFGUID lpGUID,LPDIRECTSOUND *ppDS,IUnknown *pU
(
*
ippDS
)
->
wfx
.
nBlockAlign
=
2
;
(
*
ippDS
)
->
wfx
.
wBitsPerSample
=
8
;
InitializeCriticalSection
(
&
((
*
ippDS
)
->
lock
));
if
(
!
dsound
)
{
HANDLE
hnd
;
DWORD
xid
;
...
...
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