http://bugs.winehq.org/show_bug.cgi?id=19523
Summary: winmm: Multiple waveOutOpen calls on single device supported by Windows, not Wine Product: Wine Version: unspecified Platform: All OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: winmm&mci AssignedTo: wine-bugs@winehq.org ReportedBy: ken@codeweavers.com
The design of winmm and its interface to its low-level drivers doesn't support opening an audio device multiple times with waveOutOpen. Windows does support this, using the device's hardware mixing support if present, or a software mixer if not.
This limitation also affects DirectSound if the low-level driver does not have native support for DirectSound. In that case, DirectSound uses emulation through the wave-out interface.
http://bugs.winehq.org/show_bug.cgi?id=19523
Ken Thomases ken@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |5924
http://bugs.winehq.org/show_bug.cgi?id=19523
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Platform|All |Other OS/Version|All |other Severity|normal |enhancement
http://bugs.winehq.org/show_bug.cgi?id=19523
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.1.26
http://bugs.winehq.org/show_bug.cgi?id=19523
Eric Pouech eric.pouech@orange.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@orange.fr
--- Comment #1 from Eric Pouech eric.pouech@orange.fr 2009-08-20 14:43:15 --- actually, you should be able to open several instance of the same driver if it supports it I'd argue that winmm shouldn't support software mixing, but defer that task to the Unix kernel it would be very surprising for a user that two unix apps could not use the wave output at the same time, while two Windows app under Wine would OSS nor ALSA drivers don't allow multiple outputs
http://bugs.winehq.org/show_bug.cgi?id=19523
--- Comment #2 from Ken Thomases ken@codeweavers.com 2009-09-17 23:56:17 --- (In reply to comment #1)
actually, you should be able to open several instance of the same driver if it supports it
The problem is the interface with the low-level driver. There is no handle or "stream" identifier passed around (i.e. returned for WODM_OPEN, passed in with the other wave-out messages). So, if a device is opened multiple times and then wave headers are prepared and written, how can the low-level driver know which headers go with which stream?
Separate streams should play simultaneously/mixed, rather than having their wave headers alternated. They should be paused and restarted independently. Etc.
By those messages only have a device ID passed in, no stream identifier.
http://bugs.winehq.org/show_bug.cgi?id=19523
--- Comment #3 from Eric Pouech eric.pouech@orange.fr 2009-09-19 02:28:51 --- of course, there is...
let's take the wave out driver interface as example:
DWORD WINAPI wodMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
in case wMsg in WODM_OPEN, dwUser is expected to be a pointer to a DWORD, that the driver is supposed to filled with a unique instance ID (to identify the stream)
in other (subsequent) messages, winmm passes in dwUser the unique ID defined by the driver at WODM_OPEN time
winmm correctly supports this scheme (see MMDRV_Open in dlls/winmm/lolvldrv.c)
but, none of the wine drivers correctly initialize the dwUser while processing the various XXXX_OPEN messages
it works as it is because most of the drivers only support a single instance, hence any value for the unique ID will do
HTH
http://bugs.winehq.org/show_bug.cgi?id=19523
Ken Thomases ken@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID
--- Comment #4 from Ken Thomases ken@codeweavers.com 2009-09-19 03:13:39 --- Since there's no bug, marking invalid. Conversation taken to wine-devel.
http://bugs.winehq.org/show_bug.cgi?id=19523
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Vitaliy Margolen vitaliy@kievinfo.com 2009-09-19 12:32:03 --- Closing.
http://bugs.winehq.org/show_bug.cgi?id=19523
Raymond superquad.vortex2@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |superquad.vortex2@gmail.com
--- Comment #6 from Raymond superquad.vortex2@gmail.com 2010-11-07 21:06:44 CST --- (In reply to comment #3)
of course, there is...
let's take the wave out driver interface as example:
DWORD WINAPI wodMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
in case wMsg in WODM_OPEN, dwUser is expected to be a pointer to a DWORD, that the driver is supposed to filled with a unique instance ID (to identify the stream)
in other (subsequent) messages, winmm passes in dwUser the unique ID defined by the driver at WODM_OPEN time
winmm correctly supports this scheme (see MMDRV_Open in dlls/winmm/lolvldrv.c)
but, none of the wine drivers correctly initialize the dwUser while processing the various XXXX_OPEN messages
it works as it is because most of the drivers only support a single instance, hence any value for the unique ID will do
HTH
it is possible to modify winealsa.drv to support multiple waveoutopen but the wavemapper masacm32.drv/wavemap.c seem use dwInstance for
WAVEMAPDATA* wom = (WAVEMAPDATA*)dwInstance;
Especially when the "Test Audio" button in winecfg use idw_testsound.wav which is "IMA ADPCM" format
Although wineesd.drv support multiple waveoutopen , but the implemenation seem wrong since it appear as 10 Esound Waveout and Wavein audio drivers in winecfg and 10 sound cards rightmark3dsound
When try to implement multiple voices in winealsa by declaring 16 voices in WINE_WAVEDEV and try to use dwUser to represent the index of voice ,
How can I return the index of voice to wine in wodOpen() and wodPlayer() of winealsa.drv/waveout.c so that wine can pass the index of voice back to subsequent wod* functions ?
BOOL WINAPI DriverCallback(DWORD_PTR dwCallBack, DWORD uFlags, HDRVR hDev, DWORD wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
#define MAX_ALSA_VOICE 16
typedef struct {
char* pcmname; /* string name of alsa PCM device */ char* ctlname; /* string name of alsa control device */ char interface_name[MAXPNAMELEN * 2];
/* DirectSound stuff */ DSDRIVERDESC ds_desc; DSDRIVERCAPS ds_caps;
/* Waveout only fields */ WAVEOUTCAPSW outcaps;
/* Wavein only fields */
WAVEINCAPSW incaps; DWORD dwSupport;
struct { volatile int state; /* one of the WINE_WS_ manifest constants */ WAVEFORMATPCMEX format; WORD wFlags; WAVEOPENDESC waveDesc;
snd_pcm_t* pcm; /* handle to ALSA playback device */
snd_pcm_hw_params_t * hw_params;
DWORD dwBufferSize; /* size of whole ALSA buffer in bytes */ LPWAVEHDR lpQueuePtr; /* start of queued WAVEHDRs (waiting to be notified) */ LPWAVEHDR lpPlayPtr; /* start of not yet fully played buffers */
LPWAVEHDR lpLoopPtr; /* pointer of first buffer in loop, if any */ DWORD dwLoops; /* private copy of loop counter */
DWORD dwPlayedTotal; /* number of bytes actually played since opening */ DWORD dwWrittenTotal; /* number of bytes written to ALSA buffer since opening */
/* synchronization stuff */ HANDLE hStartUpEvent; HANDLE hThread; DWORD dwThreadID; ALSA_MSG_RING msgRing; snd_pcm_sframes_t (*read)(snd_pcm_t *, void *, snd_pcm_uframes_t );
snd_pcm_sframes_t (*write)(snd_pcm_t *, const void *, snd_pcm_uframes_t );
DWORD dwPartialOffset; /* Offset of not yet written bytes in lpPlayPtr */
DWORD dwPeriodSize; /* size of OSS buffer period */ DWORD dwTotalRecorded; snd_hctl_t * hctl; /* control handle for the playback volume */ } voice[MAX_ALSA_VOICE];
} WINE_WAVEDEV;
http://bugs.winehq.org/show_bug.cgi?id=19523
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dank@kegel.com
--- Comment #7 from Dan Kegel dank@kegel.com 2010-11-08 04:07:33 CST --- Are y'all sure this is invalid? I bet there are games that have bad sound on Wine but not Windows because of this.
http://bugs.winehq.org/show_bug.cgi?id=19523
--- Comment #8 from Raymond superquad.vortex2@gmail.com 2010-11-08 05:31:38 CST --- (In reply to comment #7)
Are y'all sure this is invalid? I bet there are games that have bad sound on Wine but not Windows because of this.
I still not able to implement multi waveoutopen because the index of voice cannot passed back to subsequent WOM_* function
http://bugs.winehq.org/show_bug.cgi?id=22143
Lemmix need multi waveoutopen since only wineesd.drv allow both music and effect to be played concurrently
There is also a bug in waveoutopen in wine too since it actually open the the device when flag is specifed WAVE_FORMAT_QUERY
If this flag is specified, waveOutOpen queries the device to determine if it supports the specified format, but the device is not actually opened
http://bugs.winehq.org/show_bug.cgi?id=19523
--- Comment #9 from Raymond superquad.vortex2@gmail.com 2010-11-08 08:46:23 CST --- it should be bug#22880
Lemmix sound effects are missing
You can hear the sound effect and music only when using wineesd.drv which allow multiple waveoutopen
only music when using winealsa.drv which does not allow multiple waveoutopen
http://bugs.winehq.org/show_bug.cgi?id=19523
--- Comment #10 from Raymond superquad.vortex2@gmail.com 2010-12-07 07:05:14 CST --- (In reply to comment #7)
Are y'all sure this is invalid? I bet there are games that have bad sound on Wine but not Windows because of this.
bug#22880
Lemmix can get both sound effect and music with winepulse or wineesd , but only music when using winealsa.drv
so this is definitely bug in winealsa.drv
http://bugs.winehq.org/show_bug.cgi?id=19523
--- Comment #11 from Ken Thomases ken@codeweavers.com 2010-12-08 08:30:30 CST --- This bug was originally opened against the internal design of Wine's audio subsystem. I was mistaken about it. I had believed it was not capable of supporting audio drivers which allow opening a single device multiple times simultaneously. However, Wine's internals do support that.
I have since taken advantage of Wine's support for that to enable multiple opens in the Core Audio driver.
If there are problems on platforms other than Mac OS X, it's not with Wine's audio subsystem design, it is with individual audio drivers, such as winealsa.drv. Therefore, it would be the subject of a different bug.
http://bugs.winehq.org/show_bug.cgi?id=19523
--- Comment #12 from Raymond superquad.vortex2@gmail.com 2010-12-09 20:27:11 CST --- (In reply to comment #11)
I have since taken advantage of Wine's support for that to enable multiple opens in the Core Audio driver.
comparing wodOpen() in winealsa.drv and winecoreaudio.drv
winecoreaudio
DWORD wodOpen(WORD wDevID, WINE_WAVEOUT_INSTANCE** pInstance, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
winealsa
DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
To support multiple waveoutopen, winealsa need to pass additional parameter (i.e. pointer to the voice ) similar to WINE_WAVEOUT_INSTANCE in winecoreaudio.drv