Fixed multi-thread access to local variables (mainly fd for
/dev/dsp). God rid of obsolete macro. Fixed some slight init issues.
This commit is contained in:
parent
ef1f015652
commit
90b71b5191
@ -199,8 +199,9 @@ static BOOL OSS_FullDuplex; /* set to non-zero if the device suppo
|
|||||||
* open the device for both waveout and wavein streams...
|
* open the device for both waveout and wavein streams...
|
||||||
* this is hackish, but it's the way OSS interface is done...
|
* this is hackish, but it's the way OSS interface is done...
|
||||||
*/
|
*/
|
||||||
static int OSS_OpenDevice(unsigned req_access)
|
static int OSS_OpenDevice(unsigned wDevID, unsigned req_access)
|
||||||
{
|
{
|
||||||
|
/* wDevID: is not used yet, we handle only one global device /dev/dsp */
|
||||||
#ifdef USE_FULLDUPLEX
|
#ifdef USE_FULLDUPLEX
|
||||||
/* FIXME: race */
|
/* FIXME: race */
|
||||||
if (OSS_OpenCount == 0)
|
if (OSS_OpenCount == 0)
|
||||||
@ -249,8 +250,9 @@ static int OSS_OpenDevice(unsigned req_access)
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void OSS_CloseDevice(int fd)
|
static void OSS_CloseDevice(unsigned wDevID, int fd)
|
||||||
{
|
{
|
||||||
|
/* wDevID: is not used yet, we handle only one global device /dev/dsp */
|
||||||
#ifdef USE_FULLDUPLEX
|
#ifdef USE_FULLDUPLEX
|
||||||
if (fd != OSS_OpenFD) FIXME("What the heck????\n");
|
if (fd != OSS_OpenFD) FIXME("What the heck????\n");
|
||||||
if (--OSS_OpenCount == 0)
|
if (--OSS_OpenCount == 0)
|
||||||
@ -290,7 +292,7 @@ LONG OSS_WaveInit(void)
|
|||||||
/* FIXME: only one device is supported */
|
/* FIXME: only one device is supported */
|
||||||
memset(&WOutDev[0].caps, 0, sizeof(WOutDev[0].caps));
|
memset(&WOutDev[0].caps, 0, sizeof(WOutDev[0].caps));
|
||||||
|
|
||||||
if ((audio = OSS_OpenDevice(O_WRONLY)) == -1) return -1;
|
if ((audio = OSS_OpenDevice(0, O_WRONLY)) == -1) return -1;
|
||||||
|
|
||||||
ioctl(audio, SNDCTL_DSP_RESET, 0);
|
ioctl(audio, SNDCTL_DSP_RESET, 0);
|
||||||
|
|
||||||
@ -312,17 +314,17 @@ LONG OSS_WaveInit(void)
|
|||||||
WOutDev[0].caps.dwFormats = 0x00000000;
|
WOutDev[0].caps.dwFormats = 0x00000000;
|
||||||
WOutDev[0].caps.dwSupport = WAVECAPS_VOLUME;
|
WOutDev[0].caps.dwSupport = WAVECAPS_VOLUME;
|
||||||
|
|
||||||
IOCTL(audio, SNDCTL_DSP_GETFMTS, mask);
|
ioctl(audio, SNDCTL_DSP_GETFMTS, &mask);
|
||||||
TRACE("OSS dsp out mask=%08x\n", mask);
|
TRACE("OSS dsp out mask=%08x\n", mask);
|
||||||
|
|
||||||
/* First bytespersampl, then stereo */
|
/* First bytespersampl, then stereo */
|
||||||
bytespersmpl = (IOCTL(audio, SNDCTL_DSP_SAMPLESIZE, samplesize) != 0) ? 1 : 2;
|
bytespersmpl = (ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &samplesize) != 0) ? 1 : 2;
|
||||||
|
|
||||||
WOutDev[0].caps.wChannels = (IOCTL(audio, SNDCTL_DSP_STEREO, dsp_stereo) != 0) ? 1 : 2;
|
WOutDev[0].caps.wChannels = (ioctl(audio, SNDCTL_DSP_STEREO, &dsp_stereo) != 0) ? 1 : 2;
|
||||||
if (WOutDev[0].caps.wChannels > 1) WOutDev[0].caps.dwSupport |= WAVECAPS_LRVOLUME;
|
if (WOutDev[0].caps.wChannels > 1) WOutDev[0].caps.dwSupport |= WAVECAPS_LRVOLUME;
|
||||||
|
|
||||||
smplrate = 44100;
|
smplrate = 44100;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_SPEED, smplrate) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_SPEED, &smplrate) == 0) {
|
||||||
if (mask & AFMT_U8) {
|
if (mask & AFMT_U8) {
|
||||||
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4M08;
|
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4M08;
|
||||||
if (WOutDev[0].caps.wChannels > 1)
|
if (WOutDev[0].caps.wChannels > 1)
|
||||||
@ -335,7 +337,7 @@ LONG OSS_WaveInit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
smplrate = 22050;
|
smplrate = 22050;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_SPEED, smplrate) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_SPEED, &smplrate) == 0) {
|
||||||
if (mask & AFMT_U8) {
|
if (mask & AFMT_U8) {
|
||||||
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_2M08;
|
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_2M08;
|
||||||
if (WOutDev[0].caps.wChannels > 1)
|
if (WOutDev[0].caps.wChannels > 1)
|
||||||
@ -348,7 +350,7 @@ LONG OSS_WaveInit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
smplrate = 11025;
|
smplrate = 11025;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_SPEED, smplrate) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_SPEED, &smplrate) == 0) {
|
||||||
if (mask & AFMT_U8) {
|
if (mask & AFMT_U8) {
|
||||||
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1M08;
|
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1M08;
|
||||||
if (WOutDev[0].caps.wChannels > 1)
|
if (WOutDev[0].caps.wChannels > 1)
|
||||||
@ -360,7 +362,7 @@ LONG OSS_WaveInit(void)
|
|||||||
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1S16;
|
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1S16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IOCTL(audio, SNDCTL_DSP_GETCAPS, caps) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_GETCAPS, &caps) == 0) {
|
||||||
TRACE("OSS dsp out caps=%08X\n", caps);
|
TRACE("OSS dsp out caps=%08X\n", caps);
|
||||||
if ((caps & DSP_CAP_REALTIME) && !(caps & DSP_CAP_BATCH)) {
|
if ((caps & DSP_CAP_REALTIME) && !(caps & DSP_CAP_BATCH)) {
|
||||||
WOutDev[0].caps.dwSupport |= WAVECAPS_SAMPLEACCURATE;
|
WOutDev[0].caps.dwSupport |= WAVECAPS_SAMPLEACCURATE;
|
||||||
@ -370,7 +372,7 @@ LONG OSS_WaveInit(void)
|
|||||||
!(caps & DSP_CAP_BATCH))
|
!(caps & DSP_CAP_BATCH))
|
||||||
WOutDev[0].caps.dwSupport |= WAVECAPS_DIRECTSOUND;
|
WOutDev[0].caps.dwSupport |= WAVECAPS_DIRECTSOUND;
|
||||||
}
|
}
|
||||||
OSS_CloseDevice(audio);
|
OSS_CloseDevice(0, audio);
|
||||||
TRACE("out dwFormats = %08lX, dwSupport = %08lX\n",
|
TRACE("out dwFormats = %08lX, dwSupport = %08lX\n",
|
||||||
WOutDev[0].caps.dwFormats, WOutDev[0].caps.dwSupport);
|
WOutDev[0].caps.dwFormats, WOutDev[0].caps.dwSupport);
|
||||||
|
|
||||||
@ -385,7 +387,7 @@ LONG OSS_WaveInit(void)
|
|||||||
|
|
||||||
memset(&WInDev[0].caps, 0, sizeof(WInDev[0].caps));
|
memset(&WInDev[0].caps, 0, sizeof(WInDev[0].caps));
|
||||||
|
|
||||||
if ((audio = OSS_OpenDevice(O_RDONLY)) == -1) return -1;
|
if ((audio = OSS_OpenDevice(0, O_RDONLY)) == -1) return -1;
|
||||||
|
|
||||||
ioctl(audio, SNDCTL_DSP_RESET, 0);
|
ioctl(audio, SNDCTL_DSP_RESET, 0);
|
||||||
|
|
||||||
@ -399,21 +401,21 @@ LONG OSS_WaveInit(void)
|
|||||||
strcpy(WInDev[0].caps.szPname, "OpenSoundSystem WAVIN Driver");
|
strcpy(WInDev[0].caps.szPname, "OpenSoundSystem WAVIN Driver");
|
||||||
#endif
|
#endif
|
||||||
WInDev[0].caps.dwFormats = 0x00000000;
|
WInDev[0].caps.dwFormats = 0x00000000;
|
||||||
WInDev[0].caps.wChannels = (IOCTL(audio, SNDCTL_DSP_STEREO, dsp_stereo) != 0) ? 1 : 2;
|
WInDev[0].caps.wChannels = (ioctl(audio, SNDCTL_DSP_STEREO, &dsp_stereo) != 0) ? 1 : 2;
|
||||||
|
|
||||||
WInDev[0].bTriggerSupport = FALSE;
|
WInDev[0].bTriggerSupport = FALSE;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_GETCAPS, caps) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_GETCAPS, &caps) == 0) {
|
||||||
TRACE("OSS dsp in caps=%08X\n", caps);
|
TRACE("OSS dsp in caps=%08X\n", caps);
|
||||||
if (caps & DSP_CAP_TRIGGER)
|
if (caps & DSP_CAP_TRIGGER)
|
||||||
WInDev[0].bTriggerSupport = TRUE;
|
WInDev[0].bTriggerSupport = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOCTL(audio, SNDCTL_DSP_GETFMTS, mask);
|
ioctl(audio, SNDCTL_DSP_GETFMTS, &mask);
|
||||||
TRACE("OSS in dsp mask=%08x\n", mask);
|
TRACE("OSS in dsp mask=%08x\n", mask);
|
||||||
|
|
||||||
bytespersmpl = (IOCTL(audio, SNDCTL_DSP_SAMPLESIZE, samplesize) != 0) ? 1 : 2;
|
bytespersmpl = (ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &samplesize) != 0) ? 1 : 2;
|
||||||
smplrate = 44100;
|
smplrate = 44100;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_SPEED, smplrate) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_SPEED, &smplrate) == 0) {
|
||||||
if (mask & AFMT_U8) {
|
if (mask & AFMT_U8) {
|
||||||
WInDev[0].caps.dwFormats |= WAVE_FORMAT_4M08;
|
WInDev[0].caps.dwFormats |= WAVE_FORMAT_4M08;
|
||||||
if (WInDev[0].caps.wChannels > 1)
|
if (WInDev[0].caps.wChannels > 1)
|
||||||
@ -426,7 +428,7 @@ LONG OSS_WaveInit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
smplrate = 22050;
|
smplrate = 22050;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_SPEED, smplrate) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_SPEED, &smplrate) == 0) {
|
||||||
if (mask & AFMT_U8) {
|
if (mask & AFMT_U8) {
|
||||||
WInDev[0].caps.dwFormats |= WAVE_FORMAT_2M08;
|
WInDev[0].caps.dwFormats |= WAVE_FORMAT_2M08;
|
||||||
if (WInDev[0].caps.wChannels > 1)
|
if (WInDev[0].caps.wChannels > 1)
|
||||||
@ -439,7 +441,7 @@ LONG OSS_WaveInit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
smplrate = 11025;
|
smplrate = 11025;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_SPEED, smplrate) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_SPEED, &smplrate) == 0) {
|
||||||
if (mask & AFMT_U8) {
|
if (mask & AFMT_U8) {
|
||||||
WInDev[0].caps.dwFormats |= WAVE_FORMAT_1M08;
|
WInDev[0].caps.dwFormats |= WAVE_FORMAT_1M08;
|
||||||
if (WInDev[0].caps.wChannels > 1)
|
if (WInDev[0].caps.wChannels > 1)
|
||||||
@ -451,15 +453,15 @@ LONG OSS_WaveInit(void)
|
|||||||
WInDev[0].caps.dwFormats |= WAVE_FORMAT_1S16;
|
WInDev[0].caps.dwFormats |= WAVE_FORMAT_1S16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OSS_CloseDevice(audio);
|
OSS_CloseDevice(0, audio);
|
||||||
TRACE("in dwFormats = %08lX\n", WInDev[0].caps.dwFormats);
|
TRACE("in dwFormats = %08lX\n", WInDev[0].caps.dwFormats);
|
||||||
|
|
||||||
#ifdef USE_FULLDUPLEX
|
#ifdef USE_FULLDUPLEX
|
||||||
if ((audio = OSS_OpenDevice(O_RDWR)) == -1) return -1;
|
if ((audio = OSS_OpenDevice(0, O_RDWR)) == -1) return -1;
|
||||||
if (IOCTL(audio, SNDCTL_DSP_GETCAPS, caps) == 0) {
|
if (ioctl(audio, SNDCTL_DSP_GETCAPS, &caps) == 0) {
|
||||||
OSS_FullDuplex = (caps & DSP_CAP_DUPLEX);
|
OSS_FullDuplex = (caps & DSP_CAP_DUPLEX);
|
||||||
}
|
}
|
||||||
OSS_CloseDevice(audio);
|
OSS_CloseDevice(0, audio);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -610,7 +612,7 @@ static BOOL wodUpdatePlayedTotal(WINE_WAVEOUT* wwo, audio_buf_info* info)
|
|||||||
if (!info) info = &dspspace;
|
if (!info) info = &dspspace;
|
||||||
|
|
||||||
if (ioctl(wwo->unixdev, SNDCTL_DSP_GETOSPACE, info) < 0) {
|
if (ioctl(wwo->unixdev, SNDCTL_DSP_GETOSPACE, info) < 0) {
|
||||||
ERR("IOCTL can't 'SNDCTL_DSP_GETOSPACE' !\n");
|
ERR("ioctl can't 'SNDCTL_DSP_GETOSPACE' !\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
wwo->dwPlayedTotal = wwo->dwWrittenTotal - (wwo->dwBufferSize - info->bytes);
|
wwo->dwPlayedTotal = wwo->dwWrittenTotal - (wwo->dwBufferSize - info->bytes);
|
||||||
@ -880,7 +882,10 @@ static void wodPlayer_ProcessMessages(WINE_WAVEOUT* wwo)
|
|||||||
SetEvent(ev);
|
SetEvent(ev);
|
||||||
break;
|
break;
|
||||||
case WINE_WM_RESTARTING:
|
case WINE_WM_RESTARTING:
|
||||||
|
if (wwo->state == WINE_WS_PAUSED)
|
||||||
|
{
|
||||||
wwo->state = WINE_WS_PLAYING;
|
wwo->state = WINE_WS_PLAYING;
|
||||||
|
}
|
||||||
SetEvent(ev);
|
SetEvent(ev);
|
||||||
break;
|
break;
|
||||||
case WINE_WM_HEADER:
|
case WINE_WM_HEADER:
|
||||||
@ -1069,9 +1074,11 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||||||
|
|
||||||
if (access(SOUND_DEV, 0) != 0)
|
if (access(SOUND_DEV, 0) != 0)
|
||||||
return MMSYSERR_NOTENABLED;
|
return MMSYSERR_NOTENABLED;
|
||||||
|
if (wwo->unixdev != -1) return MMSYSERR_ALLOCATED;
|
||||||
/* we want to be able to mmap() the device, which means it must be opened readable,
|
/* we want to be able to mmap() the device, which means it must be opened readable,
|
||||||
* otherwise mmap() will fail (at least under Linux) */
|
* otherwise mmap() will fail (at least under Linux) */
|
||||||
wwo->unixdev = OSS_OpenDevice(((dwFlags & WAVE_DIRECTSOUND) || OSS_FullDuplex) ?
|
wwo->unixdev = OSS_OpenDevice(wDevID,
|
||||||
|
((dwFlags & WAVE_DIRECTSOUND) || OSS_FullDuplex) ?
|
||||||
O_RDWR : O_WRONLY);
|
O_RDWR : O_WRONLY);
|
||||||
if (wwo->unixdev == -1) return MMSYSERR_ALLOCATED;
|
if (wwo->unixdev == -1) return MMSYSERR_ALLOCATED;
|
||||||
|
|
||||||
@ -1109,11 +1116,11 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||||||
dsp_stereo = (wwo->format.wf.nChannels > 1) ? 1 : 0;
|
dsp_stereo = (wwo->format.wf.nChannels > 1) ? 1 : 0;
|
||||||
format = (wwo->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8;
|
format = (wwo->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8;
|
||||||
|
|
||||||
IOCTL(wwo->unixdev, SNDCTL_DSP_SETFRAGMENT, audio_fragment);
|
ioctl(wwo->unixdev, SNDCTL_DSP_SETFRAGMENT, &audio_fragment);
|
||||||
/* First size and stereo then samplerate */
|
/* First size and stereo then samplerate */
|
||||||
IOCTL(wwo->unixdev, SNDCTL_DSP_SETFMT, format);
|
ioctl(wwo->unixdev, SNDCTL_DSP_SETFMT, &format);
|
||||||
IOCTL(wwo->unixdev, SNDCTL_DSP_STEREO, dsp_stereo);
|
ioctl(wwo->unixdev, SNDCTL_DSP_STEREO, &dsp_stereo);
|
||||||
IOCTL(wwo->unixdev, SNDCTL_DSP_SPEED, sample_rate);
|
ioctl(wwo->unixdev, SNDCTL_DSP_SPEED, &sample_rate);
|
||||||
|
|
||||||
/* paranoid checks */
|
/* paranoid checks */
|
||||||
if (format != ((wwo->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8))
|
if (format != ((wwo->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8))
|
||||||
@ -1128,8 +1135,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||||||
|
|
||||||
/* Read output space info for future reference */
|
/* Read output space info for future reference */
|
||||||
if (ioctl(wwo->unixdev, SNDCTL_DSP_GETOSPACE, &info) < 0) {
|
if (ioctl(wwo->unixdev, SNDCTL_DSP_GETOSPACE, &info) < 0) {
|
||||||
ERR("IOCTL can't 'SNDCTL_DSP_GETOSPACE' !\n");
|
ERR("ioctl can't 'SNDCTL_DSP_GETOSPACE' !\n");
|
||||||
OSS_CloseDevice(wwo->unixdev);
|
OSS_CloseDevice(wDevID, wwo->unixdev);
|
||||||
wwo->unixdev = -1;
|
wwo->unixdev = -1;
|
||||||
return MMSYSERR_NOTENABLED;
|
return MMSYSERR_NOTENABLED;
|
||||||
}
|
}
|
||||||
@ -1204,7 +1211,7 @@ static DWORD wodClose(WORD wDevID)
|
|||||||
|
|
||||||
OSS_DestroyRingMessage(&wwo->msgRing);
|
OSS_DestroyRingMessage(&wwo->msgRing);
|
||||||
|
|
||||||
OSS_CloseDevice(wwo->unixdev);
|
OSS_CloseDevice(wDevID, wwo->unixdev);
|
||||||
wwo->unixdev = -1;
|
wwo->unixdev = -1;
|
||||||
wwo->dwFragmentSize = 0;
|
wwo->dwFragmentSize = 0;
|
||||||
ret = wodNotifyClient(wwo, WOM_CLOSE, 0L, 0L);
|
ret = wodNotifyClient(wwo, WOM_CLOSE, 0L, 0L);
|
||||||
@ -1311,9 +1318,7 @@ static DWORD wodRestart(WORD wDevID)
|
|||||||
return MMSYSERR_BADDEVICEID;
|
return MMSYSERR_BADDEVICEID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WOutDev[wDevID].state == WINE_WS_PAUSED) {
|
|
||||||
OSS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_RESTARTING, 0, TRUE);
|
OSS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_RESTARTING, 0, TRUE);
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: is NotifyClient with WOM_DONE right ? (Comet Busters 1.3.3 needs this notification) */
|
/* FIXME: is NotifyClient with WOM_DONE right ? (Comet Busters 1.3.3 needs this notification) */
|
||||||
/* FIXME: Myst crashes with this ... hmm -MM
|
/* FIXME: Myst crashes with this ... hmm -MM
|
||||||
@ -1482,13 +1487,13 @@ static DWORD wodGetNumDevs(void)
|
|||||||
{
|
{
|
||||||
DWORD ret = 1;
|
DWORD ret = 1;
|
||||||
/* FIXME: For now, only one sound device (SOUND_DEV) is allowed */
|
/* FIXME: For now, only one sound device (SOUND_DEV) is allowed */
|
||||||
int audio = OSS_OpenDevice(OSS_FullDuplex ? O_RDWR : O_WRONLY);
|
int audio = OSS_OpenDevice(0, OSS_FullDuplex ? O_RDWR : O_WRONLY);
|
||||||
|
|
||||||
if (audio == -1) {
|
if (audio == -1) {
|
||||||
if (errno != EBUSY)
|
if (errno != EBUSY)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
OSS_CloseDevice(audio);
|
OSS_CloseDevice(0, audio);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -2271,7 +2276,8 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wwi = &WInDev[wDevID];
|
wwi = &WInDev[wDevID];
|
||||||
if ((wwi->unixdev = OSS_OpenDevice(OSS_FullDuplex ? O_RDWR : O_RDONLY)) == -1)
|
if (wwi->unixdev != -1) return MMSYSERR_ALLOCATED;
|
||||||
|
if ((wwi->unixdev = OSS_OpenDevice(wDevID, OSS_FullDuplex ? O_RDWR : O_RDONLY)) == -1)
|
||||||
return MMSYSERR_ALLOCATED;
|
return MMSYSERR_ALLOCATED;
|
||||||
fcntl(wwi->unixdev, F_SETFD, 1); /* set close on exec flag */
|
fcntl(wwi->unixdev, F_SETFD, 1); /* set close on exec flag */
|
||||||
if (wwi->lpQueuePtr) {
|
if (wwi->lpQueuePtr) {
|
||||||
@ -2296,9 +2302,9 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||||||
dsp_stereo = (wwi->format.wf.nChannels > 1) ? TRUE : FALSE;
|
dsp_stereo = (wwi->format.wf.nChannels > 1) ? TRUE : FALSE;
|
||||||
format = (wwi->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8;
|
format = (wwi->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8;
|
||||||
|
|
||||||
IOCTL(wwi->unixdev, SNDCTL_DSP_SETFMT, format);
|
ioctl(wwi->unixdev, SNDCTL_DSP_SETFMT, &format);
|
||||||
IOCTL(wwi->unixdev, SNDCTL_DSP_STEREO, dsp_stereo);
|
ioctl(wwi->unixdev, SNDCTL_DSP_STEREO, &dsp_stereo);
|
||||||
IOCTL(wwi->unixdev, SNDCTL_DSP_SPEED, sample_rate);
|
ioctl(wwi->unixdev, SNDCTL_DSP_SPEED, &sample_rate);
|
||||||
|
|
||||||
/* This is actually hand tuned to work so that my SB Live:
|
/* This is actually hand tuned to work so that my SB Live:
|
||||||
* - does not skip
|
* - does not skip
|
||||||
@ -2307,7 +2313,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||||||
*/
|
*/
|
||||||
/* 7 fragments max, 2^10 = 1024 bytes per fragment */
|
/* 7 fragments max, 2^10 = 1024 bytes per fragment */
|
||||||
audio_fragment = 0x0007000A;
|
audio_fragment = 0x0007000A;
|
||||||
IOCTL(wwi->unixdev, SNDCTL_DSP_SETFRAGMENT, audio_fragment);
|
ioctl(wwi->unixdev, SNDCTL_DSP_SETFRAGMENT, &audio_fragment);
|
||||||
|
|
||||||
/* paranoid checks */
|
/* paranoid checks */
|
||||||
if (format != ((wwi->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8))
|
if (format != ((wwi->format.wBitsPerSample == 16) ? AFMT_S16_LE : AFMT_U8))
|
||||||
@ -2320,10 +2326,10 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||||||
ERR("Can't set sample_rate to %lu (%d)\n",
|
ERR("Can't set sample_rate to %lu (%d)\n",
|
||||||
wwi->format.wf.nSamplesPerSec, sample_rate);
|
wwi->format.wf.nSamplesPerSec, sample_rate);
|
||||||
|
|
||||||
IOCTL(wwi->unixdev, SNDCTL_DSP_GETBLKSIZE, fragment_size);
|
ioctl(wwi->unixdev, SNDCTL_DSP_GETBLKSIZE, &fragment_size);
|
||||||
if (fragment_size == -1) {
|
if (fragment_size == -1) {
|
||||||
WARN("IOCTL can't 'SNDCTL_DSP_GETBLKSIZE' !\n");
|
WARN("IOCTL can't 'SNDCTL_DSP_GETBLKSIZE' !\n");
|
||||||
OSS_CloseDevice(wwi->unixdev);
|
OSS_CloseDevice(wDevID, wwi->unixdev);
|
||||||
wwi->unixdev = -1;
|
wwi->unixdev = -1;
|
||||||
return MMSYSERR_NOTENABLED;
|
return MMSYSERR_NOTENABLED;
|
||||||
}
|
}
|
||||||
@ -2366,7 +2372,7 @@ static DWORD widClose(WORD wDevID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
OSS_AddRingMessage(&wwi->msgRing, WINE_WM_CLOSING, 0, TRUE);
|
OSS_AddRingMessage(&wwi->msgRing, WINE_WM_CLOSING, 0, TRUE);
|
||||||
OSS_CloseDevice(wwi->unixdev);
|
OSS_CloseDevice(wDevID, wwi->unixdev);
|
||||||
wwi->unixdev = -1;
|
wwi->unixdev = -1;
|
||||||
wwi->dwFragmentSize = 0;
|
wwi->dwFragmentSize = 0;
|
||||||
OSS_DestroyRingMessage(&wwi->msgRing);
|
OSS_DestroyRingMessage(&wwi->msgRing);
|
||||||
|
@ -217,6 +217,7 @@ BOOL OSS_MidiInit(void)
|
|||||||
* it's probably equal or more than wVoices
|
* it's probably equal or more than wVoices
|
||||||
*/
|
*/
|
||||||
tmplpCaps->wNotes = sinfo.nr_voices;
|
tmplpCaps->wNotes = sinfo.nr_voices;
|
||||||
|
tmplpCaps->wChannelMask= 0xFFFF;
|
||||||
|
|
||||||
/* FIXME Do we have this information?
|
/* FIXME Do we have this information?
|
||||||
* Assuming the soundcards can handle
|
* Assuming the soundcards can handle
|
||||||
@ -231,10 +232,10 @@ BOOL OSS_MidiInit(void)
|
|||||||
FIXME("Synthesizer support MIDI in. Not supported yet (please report)\n");
|
FIXME("Synthesizer support MIDI in. Not supported yet (please report)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("name='%s', techn=%d voices=%d notes=%d support=%ld\n",
|
TRACE("SynthOut[%d]\tname='%s' techn=%d voices=%d notes=%d chnMsk=%04x support=%ld\n"
|
||||||
tmplpCaps->szPname, tmplpCaps->wTechnology,
|
"\tOSS info: synth subtype=%d capa=%lx\n",
|
||||||
tmplpCaps->wVoices, tmplpCaps->wNotes, tmplpCaps->dwSupport);
|
i, tmplpCaps->szPname, tmplpCaps->wTechnology, tmplpCaps->wVoices,
|
||||||
TRACE("OSS info: synth subtype=%d capa=%lx\n",
|
tmplpCaps->wNotes, tmplpCaps->wChannelMask, tmplpCaps->dwSupport,
|
||||||
sinfo.synth_subtype, (long)sinfo.capabilities);
|
sinfo.synth_subtype, (long)sinfo.capabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,12 +293,14 @@ BOOL OSS_MidiInit(void)
|
|||||||
tmplpOutCaps->wVoices = 16;
|
tmplpOutCaps->wVoices = 16;
|
||||||
/* Does it make any difference? */
|
/* Does it make any difference? */
|
||||||
tmplpOutCaps->wNotes = 16;
|
tmplpOutCaps->wNotes = 16;
|
||||||
|
tmplpOutCaps->wChannelMask= 0xFFFF;
|
||||||
|
|
||||||
/* FIXME Does it make any difference? */
|
/* FIXME Does it make any difference? */
|
||||||
tmplpOutCaps->dwSupport = MIDICAPS_VOLUME|MIDICAPS_LRVOLUME;
|
tmplpOutCaps->dwSupport = MIDICAPS_VOLUME|MIDICAPS_LRVOLUME;
|
||||||
|
|
||||||
midiOutDevices[numsynthdevs + i] = tmplpOutCaps;
|
midiOutDevices[numsynthdevs + i] = tmplpOutCaps;
|
||||||
|
|
||||||
tmplpInCaps = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIOUTCAPSA));
|
tmplpInCaps = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIINCAPSA));
|
||||||
if (!tmplpInCaps)
|
if (!tmplpInCaps)
|
||||||
break;
|
break;
|
||||||
/* This whole part is somewhat obscure to me. I'll keep trying to dig
|
/* This whole part is somewhat obscure to me. I'll keep trying to dig
|
||||||
@ -318,10 +321,13 @@ BOOL OSS_MidiInit(void)
|
|||||||
|
|
||||||
midiInDevices[i] = tmplpInCaps;
|
midiInDevices[i] = tmplpInCaps;
|
||||||
|
|
||||||
TRACE("name='%s' techn=%d voices=%d notes=%d support=%ld\n",
|
TRACE("MidiOut[%d]\tname='%s' techn=%d voices=%d notes=%d chnMsk=%04x support=%ld\n"
|
||||||
tmplpOutCaps->szPname, tmplpOutCaps->wTechnology, tmplpOutCaps->wVoices,
|
"MidiIn [%d]\tname='%s' support=%ld\n"
|
||||||
tmplpOutCaps->wNotes, tmplpOutCaps->dwSupport);
|
"\tOSS info: midi dev-type=%d, capa=%lx\n",
|
||||||
TRACE("OSS info: midi dev-type=%d, capa=%lx\n",
|
i, tmplpOutCaps->szPname, tmplpOutCaps->wTechnology,
|
||||||
|
tmplpOutCaps->wVoices, tmplpOutCaps->wNotes,
|
||||||
|
tmplpOutCaps->wChannelMask, tmplpOutCaps->dwSupport,
|
||||||
|
i, tmplpInCaps->szPname, tmplpInCaps->dwSupport,
|
||||||
minfo.dev_type, (long)minfo.capabilities);
|
minfo.dev_type, (long)minfo.capabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,12 +33,6 @@
|
|||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SOUND_VERSION
|
|
||||||
#define IOCTL(a,b,c) ioctl(a,b,&c)
|
|
||||||
#else
|
|
||||||
#define IOCTL(a,b,c) (c = ioctl(a,b,c))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern LONG OSS_WaveInit(void);
|
extern LONG OSS_WaveInit(void);
|
||||||
extern BOOL OSS_MidiInit(void);
|
extern BOOL OSS_MidiInit(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user