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
2db20ef1
Commit
2db20ef1
authored
Feb 23, 2005
by
Jeremy White
Committed by
Alexandre Julliard
Feb 23, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More correct fix for dsp empty case.
parent
bea24fea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
12 deletions
+39
-12
audio.c
dlls/winmm/wineoss/audio.c
+35
-12
audio.h
dlls/winmm/wineoss/audio.h
+4
-0
No files found.
dlls/winmm/wineoss/audio.c
View file @
2db20ef1
...
...
@@ -1297,13 +1297,32 @@ static DWORD wodNotifyClient(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dwParam1, DWORD
static
BOOL
wodUpdatePlayedTotal
(
WINE_WAVEOUT
*
wwo
,
audio_buf_info
*
info
)
{
audio_buf_info
dspspace
;
DWORD
notplayed
;
if
(
!
info
)
info
=
&
dspspace
;
if
(
ioctl
(
wwo
->
ossdev
->
fd
,
SNDCTL_DSP_GETOSPACE
,
info
)
<
0
)
{
ERR
(
"ioctl(%s, SNDCTL_DSP_GETOSPACE) failed (%s)
\n
"
,
wwo
->
ossdev
->
dev_name
,
strerror
(
errno
));
return
FALSE
;
}
wwo
->
dwPlayedTotal
=
wwo
->
dwWrittenTotal
-
(
wwo
->
dwBufferSize
-
info
->
bytes
);
/* GETOSPACE is not always accurate when we're down to the last fragment or two;
** we try to accomodate that here by assuming that the dsp is empty by looking
** at the clock rather than the result of GETOSPACE */
notplayed
=
wwo
->
dwBufferSize
-
info
->
bytes
;
if
(
notplayed
>
0
&&
notplayed
<
(
info
->
fragsize
*
2
))
{
if
(
wwo
->
dwProjectedFinishTime
&&
GetTickCount
()
>=
wwo
->
dwProjectedFinishTime
)
{
TRACE
(
"Adjusting for a presumed OSS bug and assuming all data has been played.
\n
"
);
wwo
->
dwPlayedTotal
=
wwo
->
dwWrittenTotal
;
return
TRUE
;
}
else
/* Some OSS drivers will clean up nicely if given a POST, so give 'em the chance... */
ioctl
(
wwo
->
ossdev
->
fd
,
SNDCTL_DSP_POST
,
0
);
}
wwo
->
dwPlayedTotal
=
wwo
->
dwWrittenTotal
-
notplayed
;
return
TRUE
;
}
...
...
@@ -1371,6 +1390,16 @@ static LPWAVEHDR wodPlayer_PlayPtrNext(WINE_WAVEOUT* wwo)
}
/**************************************************************************
* wodPlayer_TicksTillEmpty [internal]
* Returns the number of ticks until we think the DSP should be empty
*/
static
DWORD
wodPlayer_TicksTillEmpty
(
const
WINE_WAVEOUT
*
wwo
)
{
return
((
wwo
->
dwWrittenTotal
-
wwo
->
dwPlayedTotal
)
*
1000
)
/
wwo
->
waveFormat
.
Format
.
nAvgBytesPerSec
;
}
/**************************************************************************
* wodPlayer_DSPWait [internal]
* Returns the number of milliseconds to wait for the DSP buffer to write
* one fragment.
...
...
@@ -1659,17 +1688,6 @@ static DWORD wodPlayer_FeedDSP(WINE_WAVEOUT* wwo)
TRACE
(
"fragments=%d/%d, fragsize=%d, bytes=%d
\n
"
,
dspspace
.
fragments
,
dspspace
.
fragstotal
,
dspspace
.
fragsize
,
dspspace
.
bytes
);
/* input queue empty and output buffer with less than one fragment to play
* actually some cards do not play the fragment before the last if this one is partially feed
* so we need to test for full the availability of 2 fragments ; the DSP_POST ioctl
* will let the card know to play out the rest of the fragments
*/
if
(
!
wwo
->
lpPlayPtr
&&
wwo
->
dwBufferSize
<
availInQ
+
2
*
wwo
->
dwFragmentSize
&&
!
wwo
->
bNeedPost
)
{
TRACE
(
"Run out of wavehdr's, requesting a POST...
\n
"
);
wwo
->
bNeedPost
=
TRUE
;
}
/* no more room... no need to try to feed */
if
(
dspspace
.
fragments
!=
0
)
{
/* Feed from partial wavehdr */
...
...
@@ -1724,6 +1742,11 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
wodPlayer_ProcessMessages
(
wwo
);
if
(
wwo
->
state
==
WINE_WS_PLAYING
)
{
dwNextFeedTime
=
wodPlayer_FeedDSP
(
wwo
);
if
(
dwNextFeedTime
!=
INFINITE
)
wwo
->
dwProjectedFinishTime
=
GetTickCount
()
+
wodPlayer_TicksTillEmpty
(
wwo
);
else
wwo
->
dwProjectedFinishTime
=
0
;
dwNextNotifyTime
=
wodPlayer_NotifyCompletions
(
wwo
,
FALSE
);
if
(
dwNextFeedTime
==
INFINITE
)
{
/* FeedDSP ran out of data, but before flushing, */
...
...
dlls/winmm/wineoss/audio.h
View file @
2db20ef1
...
...
@@ -131,6 +131,10 @@ typedef struct {
HANDLE
hThread
;
DWORD
dwThreadID
;
OSS_MSG_RING
msgRing
;
/* make accomodation for the inacuraccy of OSS when reporting buffer size remaining by using the clock instead of GETOSPACE */
DWORD
dwProjectedFinishTime
;
}
WINE_WAVEOUT
;
typedef
struct
{
...
...
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