1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 * Wine Driver for aRts Sound Server
4 * http://www.arts-project.org
6 * Copyright 1994 Martin Ayotte
7 * 1999 Eric Pouech (async playing in waveOut/waveIn)
8 * 2000 Eric Pouech (loops in waveOut)
9 * 2002 Chris Morgan (aRts version of this file)
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * with arts we cannot stop the audio that is already in
27 * the servers buffer, so to reduce delays during starting
28 * and stoppping of audio streams adjust the
29 * audio buffer size in the kde control center or in the
30 * artsd startup script
33 * pause in waveOut does not work correctly in loop mode
36 * implement wave-in support with artsc
39 /*#define EMULATE_SB16*/
54 #include "wine/winuser16.h"
59 #include "wine/debug.h"
61 WINE_DEFAULT_DEBUG_CHANNEL(wave);
67 #define BUFFER_SIZE 16 * 1024
68 #define SPACE_THRESHOLD 5 * 1024
70 #define MAX_WAVEOUTDRV (10)
72 /* state diagram for waveOut writing:
74 * +---------+-------------+---------------+---------------------------------+
75 * | state | function | event | new state |
76 * +---------+-------------+---------------+---------------------------------+
77 * | | open() | | STOPPED |
78 * | PAUSED | write() | | PAUSED |
79 * | STOPPED | write() | <thrd create> | PLAYING |
80 * | PLAYING | write() | HEADER | PLAYING |
81 * | (other) | write() | <error> | |
82 * | (any) | pause() | PAUSING | PAUSED |
83 * | PAUSED | restart() | RESTARTING | PLAYING (if no thrd => STOPPED) |
84 * | (any) | reset() | RESETTING | STOPPED |
85 * | (any) | close() | CLOSING | CLOSED |
86 * +---------+-------------+---------------+---------------------------------+
89 /* states of the playing device */
90 #define WINE_WS_PLAYING 0
91 #define WINE_WS_PAUSED 1
92 #define WINE_WS_STOPPED 2
93 #define WINE_WS_CLOSED 3
95 /* events to be send to device */
97 WINE_WM_PAUSING = WM_USER + 1, WINE_WM_RESTARTING, WINE_WM_RESETTING, WINE_WM_HEADER,
98 WINE_WM_UPDATE, WINE_WM_BREAKLOOP, WINE_WM_CLOSING
102 enum win_wm_message msg; /* message identifier */
103 DWORD param; /* parameter for this message */
104 HANDLE hEvent; /* if message is synchronous, handle of event for synchro */
107 /* implement an in-process message ring for better performance
108 * (compared to passing thru the server)
109 * this ring will be used by the input (resp output) record (resp playback) routine
112 #define ARTS_RING_BUFFER_SIZE 30
113 RING_MSG messages[ARTS_RING_BUFFER_SIZE];
117 CRITICAL_SECTION msg_crst;
121 volatile int state; /* one of the WINE_WS_ manifest constants */
122 WAVEOPENDESC waveDesc;
124 PCMWAVEFORMAT format;
127 /* arts information */
128 arts_stream_t play_stream; /* the stream structure we get from arts when opening a stream for playing */
129 DWORD dwBufferSize; /* size of whole buffer in bytes */
135 DWORD volume_left; /* volume control information */
138 LPWAVEHDR lpQueuePtr; /* start of queued WAVEHDRs (waiting to be notified) */
139 LPWAVEHDR lpPlayPtr; /* start of not yet fully played buffers */
140 DWORD dwPartialOffset; /* Offset of not yet written bytes in lpPlayPtr */
142 LPWAVEHDR lpLoopPtr; /* pointer of first buffer in loop, if any */
143 DWORD dwLoops; /* private copy of loop counter */
145 DWORD dwPlayedTotal; /* number of bytes actually played since opening */
146 DWORD dwWrittenTotal; /* number of bytes written to the audio device since opening */
148 /* synchronization stuff */
149 HANDLE hStartUpEvent;
152 ARTS_MSG_RING msgRing;
155 static WINE_WAVEOUT WOutDev [MAX_WAVEOUTDRV];
157 static DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv);
159 /* These strings used only for tracing */
160 static const char *wodPlayerCmdString[] = {
162 "WINE_WM_RESTARTING",
170 /*======================================================================*
171 * Low level WAVE implementation *
172 *======================================================================*/
174 /* Volume functions derived from Alsaplayer source */
175 /* length is the number of 16 bit samples */
176 void volume_effect16(void *bufin, void* bufout, int length, int left,
177 int right, int nChannels)
179 short *d_out = (short *)bufout;
180 short *d_in = (short *)bufin;
184 TRACE("length == %d, nChannels == %d\n", length, nChannels);
187 if (right == -1) right = left;
189 for(i = 0; i < length; i+=(nChannels))
191 v = (int) ((*(d_in++) * left) / 100);
192 *(d_out++) = (v>32767) ? 32767 : ((v<-32768) ? -32768 : v);
195 v = (int) ((*(d_in++) * right) / 100);
196 *(d_out++) = (v>32767) ? 32767 : ((v<-32768) ? -32768 : v);
201 /* length is the number of 8 bit samples */
202 void volume_effect8(void *bufin, void* bufout, int length, int left,
203 int right, int nChannels)
205 BYTE *d_out = (BYTE *)bufout;
206 BYTE *d_in = (BYTE *)bufin;
210 TRACE("length == %d, nChannels == %d\n", length, nChannels);
213 if (right == -1) right = left;
215 for(i = 0; i < length; i+=(nChannels))
217 v = (BYTE) ((*(d_in++) * left) / 100);
218 *(d_out++) = (v>255) ? 255 : ((v<0) ? 0 : v);
221 v = (BYTE) ((*(d_in++) * right) / 100);
222 *(d_out++) = (v>255) ? 255 : ((v<0) ? 0 : v);
227 /******************************************************************
231 void ARTS_CloseDevice(WINE_WAVEOUT* wwo)
233 arts_close_stream(wwo->play_stream); /* close the arts stream */
234 wwo->play_stream = (arts_stream_t*)-1;
236 /* free up the buffer we use for volume and reset the size */
237 if(wwo->sound_buffer)
238 HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
240 wwo->buffer_size = 0;
243 /******************************************************************
246 static int ARTS_Init(void)
248 return arts_init(); /* initialize arts and return errorcode */
251 /******************************************************************
254 LONG ARTS_WaveClose(void)
258 /* close all open devices */
259 for(iDevice = 0; iDevice < MAX_WAVEOUTDRV; iDevice++)
261 if(WOutDev[iDevice].play_stream != (arts_stream_t*)-1)
263 ARTS_CloseDevice(&WOutDev[iDevice]);
267 arts_free(); /* free up arts */
271 /******************************************************************
274 * Initialize internal structures from ARTS server info
276 LONG ARTS_WaveInit(void)
283 if ((errorcode = ARTS_Init()) < 0)
285 ERR("arts_init() failed (%d)\n", errorcode);
289 /* initialize all device handles to -1 */
290 for (i = 0; i < MAX_WAVEOUTDRV; ++i)
292 WOutDev[i].play_stream = (arts_stream_t*)-1;
293 memset(&WOutDev[i].caps, 0, sizeof(WOutDev[i].caps)); /* zero out
295 /* FIXME: some programs compare this string against the content of the registry
296 * for MM drivers. The names have to match in order for the program to work
297 * (e.g. MS win9x mplayer.exe)
300 WOutDev[i].caps.wMid = 0x0002;
301 WOutDev[i].caps.wPid = 0x0104;
302 strcpy(WOutDev[i].caps.szPname, "SB16 Wave Out");
304 WOutDev[i].caps.wMid = 0x00FF; /* Manufac ID */
305 WOutDev[i].caps.wPid = 0x0001; /* Product ID */
306 /* strcpy(WOutDev[i].caps.szPname, "OpenSoundSystem WAVOUT Driver");*/
307 strcpy(WOutDev[i].caps.szPname, "CS4236/37/38");
309 WOutDev[i].caps.vDriverVersion = 0x0100;
310 WOutDev[i].caps.dwFormats = 0x00000000;
311 WOutDev[i].caps.dwSupport = WAVECAPS_VOLUME;
313 WOutDev[i].caps.wChannels = 2;
314 WOutDev[i].caps.dwSupport |= WAVECAPS_LRVOLUME;
316 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_4M08;
317 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_4S08;
318 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_4S16;
319 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_4M16;
320 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_2M08;
321 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_2S08;
322 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_2M16;
323 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_2S16;
324 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1M08;
325 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1S08;
326 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1M16;
327 WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1S16;
334 /******************************************************************
335 * ARTS_InitRingMessage
337 * Initialize the ring of messages for passing between driver's caller and playback/record
340 static int ARTS_InitRingMessage(ARTS_MSG_RING* mr)
344 mr->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
345 memset(mr->messages, 0, sizeof(RING_MSG) * ARTS_RING_BUFFER_SIZE);
346 InitializeCriticalSection(&mr->msg_crst);
350 /******************************************************************
351 * ARTS_DestroyRingMessage
354 static int ARTS_DestroyRingMessage(ARTS_MSG_RING* mr)
356 CloseHandle(mr->msg_event);
357 DeleteCriticalSection(&mr->msg_crst);
361 /******************************************************************
362 * ARTS_AddRingMessage
364 * Inserts a new message into the ring (should be called from DriverProc derivated routines)
366 static int ARTS_AddRingMessage(ARTS_MSG_RING* mr, enum win_wm_message msg, DWORD param, BOOL wait)
368 HANDLE hEvent = INVALID_HANDLE_VALUE;
370 EnterCriticalSection(&mr->msg_crst);
371 if ((mr->msg_toget == ((mr->msg_tosave + 1) % ARTS_RING_BUFFER_SIZE))) /* buffer overflow? */
373 ERR("buffer overflow !?\n");
374 LeaveCriticalSection(&mr->msg_crst);
379 hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
380 if (hEvent == INVALID_HANDLE_VALUE)
382 ERR("can't create event !?\n");
383 LeaveCriticalSection(&mr->msg_crst);
386 if (mr->msg_toget != mr->msg_tosave && mr->messages[mr->msg_toget].msg != WINE_WM_HEADER)
387 FIXME("two fast messages in the queue!!!!\n");
389 /* fast messages have to be added at the start of the queue */
390 mr->msg_toget = (mr->msg_toget + ARTS_RING_BUFFER_SIZE - 1) % ARTS_RING_BUFFER_SIZE;
392 mr->messages[mr->msg_toget].msg = msg;
393 mr->messages[mr->msg_toget].param = param;
394 mr->messages[mr->msg_toget].hEvent = hEvent;
398 mr->messages[mr->msg_tosave].msg = msg;
399 mr->messages[mr->msg_tosave].param = param;
400 mr->messages[mr->msg_tosave].hEvent = INVALID_HANDLE_VALUE;
401 mr->msg_tosave = (mr->msg_tosave + 1) % ARTS_RING_BUFFER_SIZE;
404 LeaveCriticalSection(&mr->msg_crst);
406 SetEvent(mr->msg_event); /* signal a new message */
410 /* wait for playback/record thread to have processed the message */
411 WaitForSingleObject(hEvent, INFINITE);
418 /******************************************************************
419 * ARTS_RetrieveRingMessage
421 * Get a message from the ring. Should be called by the playback/record thread.
423 static int ARTS_RetrieveRingMessage(ARTS_MSG_RING* mr,
424 enum win_wm_message *msg, DWORD *param, HANDLE *hEvent)
426 EnterCriticalSection(&mr->msg_crst);
428 if (mr->msg_toget == mr->msg_tosave) /* buffer empty ? */
430 LeaveCriticalSection(&mr->msg_crst);
434 *msg = mr->messages[mr->msg_toget].msg;
435 mr->messages[mr->msg_toget].msg = 0;
436 *param = mr->messages[mr->msg_toget].param;
437 *hEvent = mr->messages[mr->msg_toget].hEvent;
438 mr->msg_toget = (mr->msg_toget + 1) % ARTS_RING_BUFFER_SIZE;
439 LeaveCriticalSection(&mr->msg_crst);
443 /*======================================================================*
444 * Low level WAVE OUT implementation *
445 *======================================================================*/
447 /**************************************************************************
448 * wodNotifyClient [internal]
450 static DWORD wodNotifyClient(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dwParam1, DWORD dwParam2)
452 TRACE("wMsg = 0x%04x dwParm1 = %04lX dwParam2 = %04lX\n", wMsg, dwParam1, dwParam2);
458 if (wwo->wFlags != DCB_NULL &&
459 !DriverCallback(wwo->waveDesc.dwCallback, wwo->wFlags, wwo->waveDesc.hWave,
460 wMsg, wwo->waveDesc.dwInstance, dwParam1, dwParam2)) {
461 WARN("can't notify client !\n");
462 return MMSYSERR_ERROR;
466 FIXME("Unknown callback message %u\n", wMsg);
467 return MMSYSERR_INVALPARAM;
469 return MMSYSERR_NOERROR;
472 /**************************************************************************
473 * wodUpdatePlayedTotal [internal]
476 static BOOL wodUpdatePlayedTotal(WINE_WAVEOUT* wwo)
478 /* total played is the bytes written less the bytes to write ;-) */
479 wwo->dwPlayedTotal = wwo->dwWrittenTotal -
481 arts_stream_get(wwo->play_stream, ARTS_P_BUFFER_SPACE));
486 /**************************************************************************
487 * wodPlayer_BeginWaveHdr [internal]
489 * Makes the specified lpWaveHdr the currently playing wave header.
490 * If the specified wave header is a begin loop and we're not already in
491 * a loop, setup the loop.
493 static void wodPlayer_BeginWaveHdr(WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
495 wwo->lpPlayPtr = lpWaveHdr;
497 if (!lpWaveHdr) return;
499 if (lpWaveHdr->dwFlags & WHDR_BEGINLOOP) {
500 if (wwo->lpLoopPtr) {
501 WARN("Already in a loop. Discarding loop on this header (%p)\n", lpWaveHdr);
502 TRACE("Already in a loop. Discarding loop on this header (%p)\n", lpWaveHdr);
504 TRACE("Starting loop (%ldx) with %p\n", lpWaveHdr->dwLoops, lpWaveHdr);
505 wwo->lpLoopPtr = lpWaveHdr;
506 /* Windows does not touch WAVEHDR.dwLoops,
507 * so we need to make an internal copy */
508 wwo->dwLoops = lpWaveHdr->dwLoops;
511 wwo->dwPartialOffset = 0;
514 /**************************************************************************
515 * wodPlayer_PlayPtrNext [internal]
517 * Advance the play pointer to the next waveheader, looping if required.
519 static LPWAVEHDR wodPlayer_PlayPtrNext(WINE_WAVEOUT* wwo)
521 LPWAVEHDR lpWaveHdr = wwo->lpPlayPtr;
523 wwo->dwPartialOffset = 0;
524 if ((lpWaveHdr->dwFlags & WHDR_ENDLOOP) && wwo->lpLoopPtr) {
525 /* We're at the end of a loop, loop if required */
526 if (--wwo->dwLoops > 0) {
527 wwo->lpPlayPtr = wwo->lpLoopPtr;
529 /* Handle overlapping loops correctly */
530 if (wwo->lpLoopPtr != lpWaveHdr && (lpWaveHdr->dwFlags & WHDR_BEGINLOOP)) {
531 FIXME("Correctly handled case ? (ending loop buffer also starts a new loop)\n");
532 /* shall we consider the END flag for the closing loop or for
533 * the opening one or for both ???
534 * code assumes for closing loop only
537 lpWaveHdr = lpWaveHdr->lpNext;
539 wwo->lpLoopPtr = NULL;
540 wodPlayer_BeginWaveHdr(wwo, lpWaveHdr);
543 /* We're not in a loop. Advance to the next wave header */
544 wodPlayer_BeginWaveHdr(wwo, lpWaveHdr = lpWaveHdr->lpNext);
550 /**************************************************************************
551 * wodPlayer_DSPWait [internal]
552 * Returns the number of milliseconds to wait for the DSP buffer to clear.
553 * This is based on the number of fragments we want to be clear before
554 * writing and the number of free fragments we already have.
556 static DWORD wodPlayer_DSPWait(const WINE_WAVEOUT *wwo)
558 int waitvalue = (wwo->dwBufferSize - arts_stream_get(wwo->play_stream,
559 ARTS_P_BUFFER_SPACE)) / ((wwo->format.wf.nSamplesPerSec *
560 wwo->format.wBitsPerSample * wwo->format.wf.nChannels)
563 TRACE("wait value of %d\n", waitvalue);
565 /* return the time left to play the buffer */
569 /**************************************************************************
570 * wodPlayer_NotifyWait [internal]
571 * Returns the number of milliseconds to wait before attempting to notify
572 * completion of the specified wavehdr.
573 * This is based on the number of bytes remaining to be written in the
576 static DWORD wodPlayer_NotifyWait(const WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
580 if(lpWaveHdr->reserved < wwo->dwPlayedTotal)
586 dwMillis = (lpWaveHdr->reserved - wwo->dwPlayedTotal) * 1000 / wwo->format.wf.nAvgBytesPerSec;
587 if(!dwMillis) dwMillis = 1;
590 TRACE("dwMillis = %ld\n", dwMillis);
596 /**************************************************************************
597 * wodPlayer_WriteMaxFrags [internal]
598 * Writes the maximum number of bytes possible to the DSP and returns
599 * the number of bytes written.
601 static int wodPlayer_WriteMaxFrags(WINE_WAVEOUT* wwo, DWORD* bytes)
603 /* Only attempt to write to free bytes */
604 DWORD dwLength = wwo->lpPlayPtr->dwBufferLength - wwo->dwPartialOffset;
605 int toWrite = min(dwLength, *bytes);
608 TRACE("Writing wavehdr %p.%lu[%lu]\n",
609 wwo->lpPlayPtr, wwo->dwPartialOffset, wwo->lpPlayPtr->dwBufferLength);
611 /* see if our buffer isn't large enough for the data we are writing */
612 if(wwo->buffer_size < toWrite)
614 if(wwo->sound_buffer)
615 HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
618 /* if we don't have a buffer then get one */
619 if(!wwo->sound_buffer)
621 /* allocate some memory for the buffer */
622 wwo->sound_buffer = HeapAlloc(GetProcessHeap(), 0, toWrite);
623 wwo->buffer_size = toWrite;
626 /* if we don't have a buffer then error out */
627 if(!wwo->sound_buffer)
629 ERR("error allocating sound_buffer memory\n");
633 TRACE("toWrite == %d\n", toWrite);
635 /* apply volume to the bits */
636 /* for single channel audio streams we only use the LEFT volume */
637 if(wwo->format.wBitsPerSample == 16)
639 /* apply volume to the buffer we are about to send */
640 /* divide toWrite(bytes) by 2 as volume processes by 16 bits */
641 volume_effect16(wwo->lpPlayPtr->lpData + wwo->dwPartialOffset,
642 wwo->sound_buffer, toWrite>>1, wwo->volume_left,
643 wwo->volume_right, wwo->format.wf.nChannels);
644 } else if(wwo->format.wBitsPerSample == 8)
646 /* apply volume to the buffer we are about to send */
647 volume_effect8(wwo->lpPlayPtr->lpData + wwo->dwPartialOffset,
648 wwo->sound_buffer, toWrite, wwo->volume_left,
649 wwo->volume_right, wwo->format.wf.nChannels);
652 FIXME("unsupported wwo->format.wBitsPerSample of %d\n",
653 wwo->format.wBitsPerSample);
656 /* send the audio data to arts for playing */
657 written = arts_write(wwo->play_stream, wwo->sound_buffer, toWrite);
659 TRACE("written = %d\n", written);
661 if (written <= 0) return written; /* if we wrote nothing just return */
663 if (written >= dwLength)
664 wodPlayer_PlayPtrNext(wwo); /* If we wrote all current wavehdr, skip to the next one */
666 wwo->dwPartialOffset += written; /* Remove the amount written */
669 wwo->dwWrittenTotal += written; /* update stats on this wave device */
671 return written; /* return the number of bytes written */
675 /**************************************************************************
676 * wodPlayer_NotifyCompletions [internal]
678 * Notifies and remove from queue all wavehdrs which have been played to
679 * the speaker (ie. they have cleared the audio device). If force is true,
680 * we notify all wavehdrs and remove them all from the queue even if they
681 * are unplayed or part of a loop.
683 static DWORD wodPlayer_NotifyCompletions(WINE_WAVEOUT* wwo, BOOL force)
687 /* Start from lpQueuePtr and keep notifying until:
688 * - we hit an unwritten wavehdr
689 * - we hit the beginning of a running loop
690 * - we hit a wavehdr which hasn't finished playing
692 while ((lpWaveHdr = wwo->lpQueuePtr) &&
694 (lpWaveHdr != wwo->lpPlayPtr &&
695 lpWaveHdr != wwo->lpLoopPtr &&
696 lpWaveHdr->reserved <= wwo->dwPlayedTotal))) {
698 wwo->lpQueuePtr = lpWaveHdr->lpNext;
700 lpWaveHdr->dwFlags &= ~WHDR_INQUEUE;
701 lpWaveHdr->dwFlags |= WHDR_DONE;
703 wodNotifyClient(wwo, WOM_DONE, (DWORD)lpWaveHdr, 0);
705 return (lpWaveHdr && lpWaveHdr != wwo->lpPlayPtr && lpWaveHdr != wwo->lpLoopPtr) ?
706 wodPlayer_NotifyWait(wwo, lpWaveHdr) : INFINITE;
709 /**************************************************************************
710 * wodPlayer_Reset [internal]
712 * wodPlayer helper. Resets current output stream.
714 static void wodPlayer_Reset(WINE_WAVEOUT* wwo, BOOL reset)
716 wodUpdatePlayedTotal(wwo);
718 wodPlayer_NotifyCompletions(wwo, FALSE); /* updates current notify list */
720 /* we aren't able to flush any data that has already been written */
721 /* to arts, otherwise we would do the flushing here */
724 enum win_wm_message msg;
728 /* remove any buffer */
729 wodPlayer_NotifyCompletions(wwo, TRUE);
731 wwo->lpPlayPtr = wwo->lpQueuePtr = wwo->lpLoopPtr = NULL;
732 wwo->state = WINE_WS_STOPPED;
733 wwo->dwPlayedTotal = wwo->dwWrittenTotal = 0;
735 wwo->dwPartialOffset = 0; /* Clear partial wavehdr */
737 /* remove any existing message in the ring */
738 EnterCriticalSection(&wwo->msgRing.msg_crst);
740 /* return all pending headers in queue */
741 while (ARTS_RetrieveRingMessage(&wwo->msgRing, &msg, ¶m, &ev))
743 TRACE("flushing msg\n");
744 if (msg != WINE_WM_HEADER)
746 FIXME("shouldn't have headers left\n");
750 ((LPWAVEHDR)param)->dwFlags &= ~WHDR_INQUEUE;
751 ((LPWAVEHDR)param)->dwFlags |= WHDR_DONE;
753 wodNotifyClient(wwo, WOM_DONE, param, 0);
755 ResetEvent(wwo->msgRing.msg_event);
756 LeaveCriticalSection(&wwo->msgRing.msg_crst);
758 if (wwo->lpLoopPtr) {
759 /* complicated case, not handled yet (could imply modifying the loop counter */
760 FIXME("Pausing while in loop isn't correctly handled yet, except strange results\n");
761 wwo->lpPlayPtr = wwo->lpLoopPtr;
762 wwo->dwPartialOffset = 0;
763 wwo->dwWrittenTotal = wwo->dwPlayedTotal; /* this is wrong !!! */
765 /* the data already written is going to be played, so take */
766 /* this fact into account here */
767 wwo->dwPlayedTotal = wwo->dwWrittenTotal;
769 wwo->state = WINE_WS_PAUSED;
773 /**************************************************************************
774 * wodPlayer_ProcessMessages [internal]
776 static void wodPlayer_ProcessMessages(WINE_WAVEOUT* wwo)
779 enum win_wm_message msg;
783 while (ARTS_RetrieveRingMessage(&wwo->msgRing, &msg, ¶m, &ev)) {
784 TRACE("Received %s %lx\n", wodPlayerCmdString[msg - WM_USER - 1], param);
786 case WINE_WM_PAUSING:
787 wodPlayer_Reset(wwo, FALSE);
790 case WINE_WM_RESTARTING:
791 wwo->state = WINE_WS_PLAYING;
795 lpWaveHdr = (LPWAVEHDR)param;
797 /* insert buffer at the end of queue */
800 for (wh = &(wwo->lpQueuePtr); *wh; wh = &((*wh)->lpNext));
804 wodPlayer_BeginWaveHdr(wwo,lpWaveHdr);
805 if (wwo->state == WINE_WS_STOPPED)
806 wwo->state = WINE_WS_PLAYING;
808 case WINE_WM_RESETTING:
809 wodPlayer_Reset(wwo, TRUE);
813 wodUpdatePlayedTotal(wwo);
816 case WINE_WM_BREAKLOOP:
817 if (wwo->state == WINE_WS_PLAYING && wwo->lpLoopPtr != NULL) {
818 /* ensure exit at end of current loop */
823 case WINE_WM_CLOSING:
824 /* sanity check: this should not happen since the device must have been reset before */
825 if (wwo->lpQueuePtr || wwo->lpPlayPtr) ERR("out of sync\n");
827 wwo->state = WINE_WS_CLOSED;
830 /* shouldn't go here */
832 FIXME("unknown message %d\n", msg);
838 /**************************************************************************
839 * wodPlayer_FeedDSP [internal]
840 * Feed as much sound data as we can into the DSP and return the number of
841 * milliseconds before it will be necessary to feed the DSP again.
843 static DWORD wodPlayer_FeedDSP(WINE_WAVEOUT* wwo)
847 wodUpdatePlayedTotal(wwo);
848 availInQ = arts_stream_get(wwo->play_stream, ARTS_P_BUFFER_SPACE);
849 TRACE("availInQ = %ld\n", availInQ);
851 /* input queue empty and output buffer with no space */
852 if (!wwo->lpPlayPtr && availInQ) {
853 TRACE("Run out of wavehdr:s... flushing\n");
854 wwo->dwPlayedTotal = wwo->dwWrittenTotal;
858 /* no more room... no need to try to feed */
861 TRACE("no more room, no need to try to feed\n");
862 return wodPlayer_DSPWait(wwo);
865 /* Feed from partial wavehdr */
866 if (wwo->lpPlayPtr && wwo->dwPartialOffset != 0)
868 TRACE("feeding from partial wavehdr\n");
869 wodPlayer_WriteMaxFrags(wwo, &availInQ);
872 /* Feed wavehdrs until we run out of wavehdrs or DSP space */
873 if (!wwo->dwPartialOffset)
875 while(wwo->lpPlayPtr && availInQ > SPACE_THRESHOLD)
877 TRACE("feeding waveheaders until we run out of space\n");
878 /* note the value that dwPlayedTotal will return when this wave finishes playing */
879 wwo->lpPlayPtr->reserved = wwo->dwWrittenTotal + wwo->lpPlayPtr->dwBufferLength;
880 wodPlayer_WriteMaxFrags(wwo, &availInQ);
884 return wodPlayer_DSPWait(wwo);
888 /**************************************************************************
889 * wodPlayer [internal]
891 static DWORD CALLBACK wodPlayer(LPVOID pmt)
893 WORD uDevID = (DWORD)pmt;
894 WINE_WAVEOUT* wwo = (WINE_WAVEOUT*)&WOutDev[uDevID];
895 DWORD dwNextFeedTime = INFINITE; /* Time before DSP needs feeding */
896 DWORD dwNextNotifyTime = INFINITE; /* Time before next wave completion */
899 wwo->state = WINE_WS_STOPPED;
900 SetEvent(wwo->hStartUpEvent);
903 /** Wait for the shortest time before an action is required. If there
904 * are no pending actions, wait forever for a command.
906 dwSleepTime = min(dwNextFeedTime, dwNextNotifyTime);
907 TRACE("waiting %lums (%lu,%lu)\n", dwSleepTime, dwNextFeedTime, dwNextNotifyTime);
908 WaitForSingleObject(wwo->msgRing.msg_event, dwSleepTime);
909 wodPlayer_ProcessMessages(wwo);
910 if (wwo->state == WINE_WS_PLAYING) {
911 dwNextFeedTime = wodPlayer_FeedDSP(wwo);
912 dwNextNotifyTime = wodPlayer_NotifyCompletions(wwo, FALSE);
914 dwNextFeedTime = dwNextNotifyTime = INFINITE;
919 /**************************************************************************
920 * wodGetDevCaps [internal]
922 static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
924 TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
926 if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
928 if (wDevID >= MAX_WAVEOUTDRV) {
929 TRACE("MAX_WAVOUTDRV reached !\n");
930 return MMSYSERR_BADDEVICEID;
933 memcpy(lpCaps, &WOutDev[wDevID].caps, min(dwSize, sizeof(*lpCaps)));
934 return MMSYSERR_NOERROR;
937 /**************************************************************************
940 static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
944 TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
945 if (lpDesc == NULL) {
946 WARN("Invalid Parameter !\n");
947 return MMSYSERR_INVALPARAM;
949 if (wDevID >= MAX_WAVEOUTDRV) {
950 TRACE("MAX_WAVOUTDRV reached !\n");
951 return MMSYSERR_BADDEVICEID;
954 /* if this device is already open tell the app that it is allocated */
955 if(WOutDev[wDevID].play_stream != (arts_stream_t*)-1)
957 TRACE("device already allocated\n");
958 return MMSYSERR_ALLOCATED;
961 /* only PCM format is supported so far... */
962 if (lpDesc->lpFormat->wFormatTag != WAVE_FORMAT_PCM ||
963 lpDesc->lpFormat->nChannels == 0 ||
964 lpDesc->lpFormat->nSamplesPerSec == 0) {
965 WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n",
966 lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels,
967 lpDesc->lpFormat->nSamplesPerSec);
968 return WAVERR_BADFORMAT;
971 if (dwFlags & WAVE_FORMAT_QUERY) {
972 TRACE("Query format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n",
973 lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels,
974 lpDesc->lpFormat->nSamplesPerSec);
975 return MMSYSERR_NOERROR;
978 wwo = &WOutDev[wDevID];
980 /* direct sound not supported, ignore the flag */
981 dwFlags &= ~WAVE_DIRECTSOUND;
983 wwo->wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
985 memcpy(&wwo->waveDesc, lpDesc, sizeof(WAVEOPENDESC));
986 memcpy(&wwo->format, lpDesc->lpFormat, sizeof(PCMWAVEFORMAT));
988 if (wwo->format.wBitsPerSample == 0) {
989 WARN("Resetting zeroed wBitsPerSample\n");
990 wwo->format.wBitsPerSample = 8 *
991 (wwo->format.wf.nAvgBytesPerSec /
992 wwo->format.wf.nSamplesPerSec) /
993 wwo->format.wf.nChannels;
996 wwo->play_stream = arts_play_stream(wwo->format.wf.nSamplesPerSec,
997 wwo->format.wBitsPerSample, wwo->format.wf.nChannels, "winearts");
999 /* clear these so we don't have any confusion ;-) */
1000 wwo->sound_buffer = 0;
1001 wwo->buffer_size = 0;
1003 arts_stream_set(wwo->play_stream, ARTS_P_BLOCKING, 0); /* disable blocking on this stream */
1005 if(!wwo->play_stream) return MMSYSERR_ALLOCATED;
1007 /* Try to set buffer size from constant and store the value that it
1008 was set to for future use */
1009 wwo->dwBufferSize = arts_stream_set(wwo->play_stream,
1010 ARTS_P_BUFFER_SIZE, BUFFER_SIZE);
1011 TRACE("Tried to set BUFFER_SIZE of %d, wwo->dwBufferSize is actually %ld\n", BUFFER_SIZE, wwo->dwBufferSize);
1012 wwo->dwPlayedTotal = 0;
1013 wwo->dwWrittenTotal = 0;
1015 /* Initialize volume to full level */
1016 wwo->volume_left = 100;
1017 wwo->volume_right = 100;
1019 ARTS_InitRingMessage(&wwo->msgRing);
1021 /* create player thread */
1022 if (!(dwFlags & WAVE_DIRECTSOUND)) {
1023 wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
1024 wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
1025 WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
1026 CloseHandle(wwo->hStartUpEvent);
1028 wwo->hThread = INVALID_HANDLE_VALUE;
1029 wwo->dwThreadID = 0;
1031 wwo->hStartUpEvent = INVALID_HANDLE_VALUE;
1033 TRACE("stream=0x%lx, dwBufferSize=%ld\n",
1034 (long)wwo->play_stream, wwo->dwBufferSize);
1036 TRACE("wBitsPerSample=%u, nAvgBytesPerSec=%lu, nSamplesPerSec=%lu, nChannels=%u nBlockAlign=%u!\n",
1037 wwo->format.wBitsPerSample, wwo->format.wf.nAvgBytesPerSec,
1038 wwo->format.wf.nSamplesPerSec, wwo->format.wf.nChannels,
1039 wwo->format.wf.nBlockAlign);
1041 return wodNotifyClient(wwo, WOM_OPEN, 0L, 0L);
1044 /**************************************************************************
1045 * wodClose [internal]
1047 static DWORD wodClose(WORD wDevID)
1049 DWORD ret = MMSYSERR_NOERROR;
1052 TRACE("(%u);\n", wDevID);
1054 if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream ==
1057 WARN("bad device ID !\n");
1058 return MMSYSERR_BADDEVICEID;
1061 wwo = &WOutDev[wDevID];
1062 if (wwo->lpQueuePtr) {
1063 WARN("buffers still playing !\n");
1064 ret = WAVERR_STILLPLAYING;
1066 TRACE("imhere[3-close]\n");
1067 if (wwo->hThread != INVALID_HANDLE_VALUE) {
1068 ARTS_AddRingMessage(&wwo->msgRing, WINE_WM_CLOSING, 0, TRUE);
1071 ARTS_DestroyRingMessage(&wwo->msgRing);
1073 ARTS_CloseDevice(wwo); /* close the stream and clean things up */
1075 ret = wodNotifyClient(wwo, WOM_CLOSE, 0L, 0L);
1080 /**************************************************************************
1081 * wodWrite [internal]
1084 static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
1086 TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
1088 /* first, do the sanity checks... */
1089 if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream ==
1092 WARN("bad dev ID !\n");
1093 return MMSYSERR_BADDEVICEID;
1096 if (lpWaveHdr->lpData == NULL || !(lpWaveHdr->dwFlags & WHDR_PREPARED))
1098 TRACE("unprepared\n");
1099 return WAVERR_UNPREPARED;
1102 if (lpWaveHdr->dwFlags & WHDR_INQUEUE)
1104 TRACE("still playing\n");
1105 return WAVERR_STILLPLAYING;
1108 lpWaveHdr->dwFlags &= ~WHDR_DONE;
1109 lpWaveHdr->dwFlags |= WHDR_INQUEUE;
1110 lpWaveHdr->lpNext = 0;
1112 TRACE("adding ring message\n");
1113 ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_HEADER, (DWORD)lpWaveHdr, FALSE);
1115 return MMSYSERR_NOERROR;
1118 /**************************************************************************
1119 * wodPrepare [internal]
1121 static DWORD wodPrepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
1123 TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
1125 if (wDevID >= MAX_WAVEOUTDRV) {
1126 WARN("bad device ID !\n");
1127 return MMSYSERR_BADDEVICEID;
1130 if (lpWaveHdr->dwFlags & WHDR_INQUEUE)
1131 return WAVERR_STILLPLAYING;
1133 lpWaveHdr->dwFlags |= WHDR_PREPARED;
1134 lpWaveHdr->dwFlags &= ~WHDR_DONE;
1135 return MMSYSERR_NOERROR;
1138 /**************************************************************************
1139 * wodUnprepare [internal]
1141 static DWORD wodUnprepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
1143 TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
1145 if (wDevID >= MAX_WAVEOUTDRV) {
1146 WARN("bad device ID !\n");
1147 return MMSYSERR_BADDEVICEID;
1150 if (lpWaveHdr->dwFlags & WHDR_INQUEUE)
1151 return WAVERR_STILLPLAYING;
1153 lpWaveHdr->dwFlags &= ~WHDR_PREPARED;
1154 lpWaveHdr->dwFlags |= WHDR_DONE;
1156 return MMSYSERR_NOERROR;
1159 /**************************************************************************
1160 * wodPause [internal]
1162 static DWORD wodPause(WORD wDevID)
1164 TRACE("(%u);!\n", wDevID);
1166 if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream ==
1169 WARN("bad device ID !\n");
1170 return MMSYSERR_BADDEVICEID;
1173 TRACE("imhere[3-PAUSING]\n");
1174 ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_PAUSING, 0, TRUE);
1176 return MMSYSERR_NOERROR;
1179 /**************************************************************************
1180 * wodRestart [internal]
1182 static DWORD wodRestart(WORD wDevID)
1184 TRACE("(%u);\n", wDevID);
1186 if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream ==
1189 WARN("bad device ID !\n");
1190 return MMSYSERR_BADDEVICEID;
1193 if (WOutDev[wDevID].state == WINE_WS_PAUSED) {
1194 TRACE("imhere[3-RESTARTING]\n");
1195 ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_RESTARTING, 0, TRUE);
1198 /* FIXME: is NotifyClient with WOM_DONE right ? (Comet Busters 1.3.3 needs this notification) */
1199 /* FIXME: Myst crashes with this ... hmm -MM
1200 return wodNotifyClient(wwo, WOM_DONE, 0L, 0L);
1203 return MMSYSERR_NOERROR;
1206 /**************************************************************************
1207 * wodReset [internal]
1209 static DWORD wodReset(WORD wDevID)
1211 TRACE("(%u);\n", wDevID);
1213 if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream ==
1216 WARN("bad device ID !\n");
1217 return MMSYSERR_BADDEVICEID;
1220 TRACE("imhere[3-RESET]\n");
1221 ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_RESETTING, 0, TRUE);
1223 return MMSYSERR_NOERROR;
1226 /**************************************************************************
1227 * wodGetPosition [internal]
1229 static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize)
1235 TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize);
1237 if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream ==
1240 WARN("bad device ID !\n");
1241 return MMSYSERR_BADDEVICEID;
1244 if (lpTime == NULL) return MMSYSERR_INVALPARAM;
1246 wwo = &WOutDev[wDevID];
1247 ARTS_AddRingMessage(&wwo->msgRing, WINE_WM_UPDATE, 0, TRUE);
1248 val = wwo->dwPlayedTotal;
1250 TRACE("wType=%04X wBitsPerSample=%u nSamplesPerSec=%lu nChannels=%u nAvgBytesPerSec=%lu\n",
1251 lpTime->wType, wwo->format.wBitsPerSample,
1252 wwo->format.wf.nSamplesPerSec, wwo->format.wf.nChannels,
1253 wwo->format.wf.nAvgBytesPerSec);
1254 TRACE("dwPlayedTotal=%lu\n", val);
1256 switch (lpTime->wType) {
1259 TRACE("TIME_BYTES=%lu\n", lpTime->u.cb);
1262 lpTime->u.sample = val * 8 / wwo->format.wBitsPerSample /wwo->format.wf.nChannels;
1263 TRACE("TIME_SAMPLES=%lu\n", lpTime->u.sample);
1266 time = val / (wwo->format.wf.nAvgBytesPerSec / 1000);
1267 lpTime->u.smpte.hour = time / 108000;
1268 time -= lpTime->u.smpte.hour * 108000;
1269 lpTime->u.smpte.min = time / 1800;
1270 time -= lpTime->u.smpte.min * 1800;
1271 lpTime->u.smpte.sec = time / 30;
1272 time -= lpTime->u.smpte.sec * 30;
1273 lpTime->u.smpte.frame = time;
1274 lpTime->u.smpte.fps = 30;
1275 TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
1276 lpTime->u.smpte.hour, lpTime->u.smpte.min,
1277 lpTime->u.smpte.sec, lpTime->u.smpte.frame);
1280 FIXME("Format %d not supported ! use TIME_MS !\n", lpTime->wType);
1281 lpTime->wType = TIME_MS;
1283 lpTime->u.ms = val / (wwo->format.wf.nAvgBytesPerSec / 1000);
1284 TRACE("TIME_MS=%lu\n", lpTime->u.ms);
1287 return MMSYSERR_NOERROR;
1290 /**************************************************************************
1291 * wodBreakLoop [internal]
1293 static DWORD wodBreakLoop(WORD wDevID)
1295 TRACE("(%u);\n", wDevID);
1297 if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream ==
1300 WARN("bad device ID !\n");
1301 return MMSYSERR_BADDEVICEID;
1303 ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_BREAKLOOP, 0, TRUE);
1304 return MMSYSERR_NOERROR;
1307 /**************************************************************************
1308 * wodGetVolume [internal]
1310 static DWORD wodGetVolume(WORD wDevID, LPDWORD lpdwVol)
1314 left = WOutDev[wDevID].volume_left;
1315 right = WOutDev[wDevID].volume_right;
1317 TRACE("(%u, %p);\n", wDevID, lpdwVol);
1319 *lpdwVol = ((left * 0xFFFFl) / 100) + (((right * 0xFFFFl) / 100) <<
1322 return MMSYSERR_NOERROR;
1325 /**************************************************************************
1326 * wodSetVolume [internal]
1328 static DWORD wodSetVolume(WORD wDevID, DWORD dwParam)
1332 left = (LOWORD(dwParam) * 100) / 0xFFFFl;
1333 right = (HIWORD(dwParam) * 100) / 0xFFFFl;
1335 TRACE("(%u, %08lX);\n", wDevID, dwParam);
1337 WOutDev[wDevID].volume_left = left;
1338 WOutDev[wDevID].volume_right = right;
1340 return MMSYSERR_NOERROR;
1343 /**************************************************************************
1344 * wodGetNumDevs [internal]
1346 static DWORD wodGetNumDevs(void)
1348 return MAX_WAVEOUTDRV;
1351 /**************************************************************************
1352 * wodMessage (WINEARTS.@)
1354 DWORD WINAPI ARTS_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
1355 DWORD dwParam1, DWORD dwParam2)
1357 TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n",
1358 wDevID, wMsg, dwUser, dwParam1, dwParam2);
1365 /* FIXME: Pretend this is supported */
1367 case WODM_OPEN: return wodOpen (wDevID, (LPWAVEOPENDESC)dwParam1, dwParam2);
1368 case WODM_CLOSE: return wodClose (wDevID);
1369 case WODM_WRITE: return wodWrite (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
1370 case WODM_PAUSE: return wodPause (wDevID);
1371 case WODM_GETPOS: return wodGetPosition (wDevID, (LPMMTIME)dwParam1, dwParam2);
1372 case WODM_BREAKLOOP: return wodBreakLoop (wDevID);
1373 case WODM_PREPARE: return wodPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
1374 case WODM_UNPREPARE: return wodUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
1375 case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
1376 case WODM_GETNUMDEVS: return wodGetNumDevs ();
1377 case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
1378 case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
1379 case WODM_GETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED;
1380 case WODM_SETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED;
1381 case WODM_GETVOLUME: return wodGetVolume (wDevID, (LPDWORD)dwParam1);
1382 case WODM_SETVOLUME: return wodSetVolume (wDevID, dwParam1);
1383 case WODM_RESTART: return wodRestart (wDevID);
1384 case WODM_RESET: return wodReset (wDevID);
1386 case DRV_QUERYDSOUNDIFACE: return wodDsCreate(wDevID, (PIDSDRIVER*)dwParam1);
1388 FIXME("unknown message %d!\n", wMsg);
1390 return MMSYSERR_NOTSUPPORTED;
1393 /*======================================================================*
1394 * Low level DSOUND implementation *
1395 *======================================================================*/
1396 static DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv)
1398 /* we can't perform memory mapping as we don't have a file stream
1399 interface with arts like we do with oss */
1400 MESSAGE("This sound card's driver does not support direct access\n");
1401 MESSAGE("The (slower) DirectSound HEL mode will be used instead.\n");
1402 return MMSYSERR_NOTSUPPORTED;
1405 #else /* !HAVE_ARTS */
1407 /**************************************************************************
1408 * wodMessage (WINEARTS.@)
1410 DWORD WINAPI ARTS_wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
1411 DWORD dwParam1, DWORD dwParam2)
1413 FIXME("(%u, %04X, %08lX, %08lX, %08lX):stub\n", wDevID, wMsg, dwUser, dwParam1, dwParam2);
1414 return MMSYSERR_NOTENABLED;
1417 #endif /* HAVE_ARTS */