diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2014-04-01 12:03:38 -0400 |
|---|---|---|
| committer | Gary Scavone <gary@music.mcgill.ca> | 2014-04-01 12:05:51 -0400 |
| commit | 18e6f5126073320450438e99b4833cabc3347dba (patch) | |
| tree | 3b7fb305eec569873cf8fe00ef5ff56c572315ff /RtAudio.h | |
| parent | a71027332b636913443e66f6af4566dd86983f24 (diff) | |
Added Wasapi code (though untested); Updates for better data format support in PulseAudio; Commented-out various unused function arguments in tests/ files.
Diffstat (limited to 'RtAudio.h')
| -rw-r--r-- | RtAudio.h | 40 |
1 files changed, 39 insertions, 1 deletions
@@ -270,6 +270,7 @@ class RtAudio LINUX_OSS, /*!< The Linux Open Sound System API. */ UNIX_JACK, /*!< The Jack Low-Latency Audio Server API. */ MACOSX_CORE, /*!< Macintosh OS-X Core Audio API. */ + WINDOWS_WASAPI, /*!< The Microsoft WASAPI API. */ WINDOWS_ASIO, /*!< The Steinberg Audio Stream I/O API. */ WINDOWS_DS, /*!< The Microsoft Direct Sound API. */ RTAUDIO_DUMMY /*!< A compilable but non-functional API. */ @@ -566,7 +567,7 @@ class RtAudio }; // Operating system dependent thread functionality. -#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) +#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__) #include <windows.h> #include <process.h> @@ -977,6 +978,43 @@ public: #endif +#if defined(__WINDOWS_WASAPI__) + +struct IMMDeviceEnumerator; + +class RtApiWasapi : public RtApi +{ +public: + RtApiWasapi(); + ~RtApiWasapi(); + + RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_WASAPI; } + unsigned int getDeviceCount( void ); + RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); + unsigned int getDefaultOutputDevice( void ); + unsigned int getDefaultInputDevice( void ); + void closeStream( void ); + void startStream( void ); + void stopStream( void ); + void abortStream( void ); + +private: + bool coInitialized_; + IMMDeviceEnumerator* deviceEnumerator_; + + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + unsigned int firstChannel, unsigned int sampleRate, + RtAudioFormat format, unsigned int* bufferSize, + RtAudio::StreamOptions* options ); + + static DWORD WINAPI runWasapiThread( void* wasapiPtr ); + static DWORD WINAPI stopWasapiThread( void* wasapiPtr ); + static DWORD WINAPI abortWasapiThread( void* wasapiPtr ); + void wasapiThread(); +}; + +#endif + #if defined(__LINUX_ALSA__) class RtApiAlsa: public RtApi |
