Commit Graph

45 Commits

Author SHA1 Message Date
Ken Thomases 0e52c42aa6 winecoreaudio: Report actual supported input wave formats.
Also, added some output formats that Core Audio ought to be able to handle.
2006-12-29 12:49:43 +01:00
Ken Thomases fa84451647 winecoreaudio: Implement CoreAudio_wiAudioUnitIOProc, the input callback. 2006-12-29 12:49:43 +01:00
Ken Thomases 959ec2aa44 winecoreaudio: Implement widStart. 2006-12-29 12:49:43 +01:00
Ken Thomases c47c82a20b winecoreaudio: Implement widStop. 2006-12-29 12:49:43 +01:00
Ken Thomases 335ab8c1a2 winecoreaudio: Changed widReset to stop the audio unit. 2006-12-29 12:49:43 +01:00
Ken Thomases cff4da8db8 winecoreaudio: Add mechanism for cross-thread call of widHelper_NotifyCompletions.
wodSendNotifyInputCompletionsMessage sends the kWaveInNotifyCompletionsMessage
to the message thread, which calls widHelper_NotifyCompletions.
2006-12-29 12:49:43 +01:00
Ken Thomases 9ef54e4ebe winecoreaudio: Add widHelper_NotifyCompletions.
It scans for completed input wavehdrs, removes them from the queue,
and notifies the application that they're done.
2006-12-29 12:49:42 +01:00
Ken Thomases 19c75a4ec6 winecoreaudio: Store the device ID in the WINE_WAVEOUT structure. 2006-12-29 12:49:42 +01:00
Ken Thomases 127523d7a2 winecoreaudio: Allocate/deallocate audio buffers in widOpen/widClose. 2006-12-29 12:49:42 +01:00
Ken Thomases 4b904bbf13 winecoreaudio: Do additional setup in AudioUnit_CreateInputUnit.
It now returns in an output parameter the frame count that the AU will use.
Also, initialize the Audio Unit.
2006-12-29 12:49:42 +01:00
Ken Thomases 5c489283c9 winecoreaudio: Implement widDevInterfaceSize and widDevInterface. 2006-12-29 12:49:42 +01:00
Ken Thomases 503f9be161 winecoreaudio: Implement widReset. 2006-12-29 12:49:42 +01:00
Ken Thomases 58ea6abe72 winecoreaudio: Implement widAddBuffer. 2006-12-29 12:49:42 +01:00
Ken Thomases 5432adaaac winecoreaudio: Implement widOpen and widClose. 2006-12-29 12:49:42 +01:00
Ken Thomases 8ba3daaf5c winecoreaudio: Add stub implementation of CoreAudio_wiAudioUnitIOProc.
It will serve as the input callback called when our Audio Unit has sound
data available.
2006-12-29 12:49:41 +01:00
Ken Thomases 5319b64b39 winecoreaudio: Initial implementation of widGetDevCaps. 2006-12-29 12:49:41 +01:00
Ken Thomases eccfe6e8a3 winecoreaudio: Initial stub implementation of audio input support. 2006-12-29 12:49:41 +01:00
Ken Thomases 5cbc520318 winecoreaudio: Replace pthread mutex with OSSpinLock. 2006-12-21 12:08:37 +01:00
Ken Thomases 234558c2c7 winecoreaudio: Move a memset out of a mutex-guarded section. 2006-12-21 12:01:12 +01:00
Ken Thomases acf3499916 winecoreaudio: Merge wodReset and wodHelper_Reset. 2006-12-21 12:01:02 +01:00
Ken Thomases 3ade58b0b9 winecoreaudio: Change to faster non-recursive mutex. 2006-12-21 12:00:49 +01:00
Ken Thomases d5975872af winecoreaudio: Push notify of completions from render callback to message thread.
Rather than have the Audio Unit render callback traverse the queue of wave
headers looking for complete ones, and sending a message to the message thread
for each one it finds, just send one message to tell the message thread to do
that work itself.  The render callback is called in a real-time priority
thread and is expected to return as quickly as possible.
2006-12-21 12:00:36 +01:00
Ken Thomases e24533cb6d winecoreaudio: Remove more mutexes from around Audio Unit calls. 2006-12-21 12:00:20 +01:00
Ken Thomases 0bb13dd31c winecoreaudio: Report when the render callback is just providing silence. 2006-12-21 12:00:09 +01:00
Ken Thomases 82fff94c33 winecoreaudio: Lift mutex lock/unlock out of wodHelper_PlayPtrNext to caller. 2006-12-21 11:59:53 +01:00
Ken Thomases bdbe803cb6 winecoreaudio: Leave audio unit running, except when waveout device paused. 2006-12-21 11:45:36 +01:00
Ken Thomases aef21c19c1 winecoreaudio: Eliminate unnecessary variable, unreachable code, unused retval. 2006-12-21 11:45:11 +01:00
Ken Thomases 7cecf7a40a winecoreaudio: Inline & eliminate the specializations of wodHelper_BeginWaveHdr. 2006-12-21 11:44:42 +01:00
Ken Thomases be4a17876d winecoreaudio: Specialize wodHelper_BeginWaveHdr for its two callers and simplify.
wodHelper_PlayPtrNext is only called when state == WINE_WS_PLAYING.  Also, it
clears dwPartialOffset itself.

wodWrite only calls wodHelper_BeginWaveHdr[Write] with a non-NULL lpWaveHdr
parameter.  wodWrite is not called from the Audio Unit render callback, so it
can use Wine debug channels.
2006-12-21 11:43:21 +01:00
Ken Thomases 551f7d94a3 winecoreaudio: Simplify handling of BEGIN+ENDLOOP wave headers. 2006-12-21 11:42:48 +01:00
Ken Thomases 91c5ec9616 winecoreaudio: Extract wodHelper_CheckForLoopBegin() from wodHelper_BeginWaveHdr().
This refactoring prepares the ground for subsequent refactoring of
wodHelper_BeginWaveHdr.
2006-12-21 11:42:28 +01:00
Ken Thomases a6da8f212d winecoreaudio: Create port for sending messages to the callback thread only once. 2006-12-21 11:42:12 +01:00
Ken Thomases 23bb112b10 winecoreaudio: Control the fprintf's by the Wine debug channel on/off settings. 2006-12-21 11:42:05 +01:00
Alexandre Julliard 6f4d2f8dc4 winecoreaudio.drv: Win64 printf format fixes. 2006-10-20 12:36:38 +02:00
Francois Gouget 21668ad76a winecoreaudio: Protect pthread.h inclusion. 2006-06-26 13:05:00 +02:00
Alexandre Julliard ea50196447 winecoreaudio: Fixed the FSF address. 2006-06-01 13:15:54 +02:00
Ken Thomases 1612ce8659 winecoreaudio: Don't CFAllocate buffer for port message. 2006-06-01 13:09:44 +02:00
Ken Thomases fb5a073e46 winecoreaudio: Use unique name for message port.
Use a unique port name for the message port to the message thread.
Port names are system-global, so using a non-unique constant name
prevents the CoreAudio driver from being used in multiple processes
simultaneously.
2006-06-01 13:08:21 +02:00
Ken Thomases a1e6989a9b winecoreaudio: 8-bit Linear PCM data is unsigned. 2006-06-01 13:05:59 +02:00
Ken Thomases 178f9fecd9 winecoreaudio: Keep processing wavehdrs to satisfy AudioUnit data request.
When fulfilling the output AudioUnit's request for audio data, don't
stop when the current wavehdr is exhausted; advance to the next.  This
addresses the buzzy quality of the sound.
2006-06-01 13:03:22 +02:00
Ken Thomases 6a6aec72d3 winecoreaudio: Improve state tracking.
Improved tracking of device state (stopped, playing, or paused).
Also, tied starting and stopping the AudioUnit more directly to the
state.  No need to change the state when preparing or unpreparing
wavehdrs.  Pausing overrides both playing and stopped states; if
stopped, pausing prevents output from starting when the program
writes.  When, restarting from the paused state, the device starts
playing if there are queued wavehdrs.  Otherwise, it goes to stopped
state.
2006-06-01 12:59:50 +02:00
Ken Thomases fb9f878849 winecoreaudio: Miscellaneous cleanup.
Miscellaneous cleanup: release resources when done with them; protect
against null pointers; reduce redundant code; avoid potential integer
underflow; clarify a do-nothing loop.
2006-06-01 12:59:38 +02:00
Ken Thomases 00e9996339 winecoreaudio: Fix race to open.
Fixes a race condition (noted in a comment for wodOpen) when multiple
threads try to open the same wave-out device simultaneously.
Addressed by creating the device mutexes when the driver is
initialized, instead of as each device is opened.  Then use the mutex
to protect the open operation against races.  At the same time, made
the mutexes recursive to avoid self-deadlocks the driver was
encountering when reentered from the callback.
2006-06-01 12:50:46 +02:00
Alexandre Julliard 11fe657466 winecoreaudio: Fixed a bunch of compiler warnings. 2006-05-31 14:52:58 +02:00
Emmanuel Maillard 144a5353ef winecoreaudio: Initial Audio Driver for Mac OS X. 2006-05-30 19:34:20 +02:00