diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-01-16 19:19:45 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-01-16 19:19:45 +0100 |
commit | 7b059965e8df745c5b45b4ec6bfbdfe1a7397642 (patch) | |
tree | bdba6b41f51fcb4c8aa5178aebd378bdf97b93a8 /drivers/rtaudio | |
parent | 6a3dae5be944d9e226cca7bf0bd80fb0036e8324 (diff) |
Adapt platforms to AudioServer refactoring
Fixes compilation on Windows and likely other platforms (at least
as far as AudioServer changes were concerned), though they were
not tested.
Diffstat (limited to 'drivers/rtaudio')
-rw-r--r-- | drivers/rtaudio/audio_driver_rtaudio.cpp | 27 | ||||
-rw-r--r-- | drivers/rtaudio/audio_driver_rtaudio.h | 8 |
2 files changed, 18 insertions, 17 deletions
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index 6a54eb43fb..6ada0aaa68 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -85,6 +85,8 @@ Error AudioDriverRtAudio::init() { ERR_EXPLAIN("Cannot initialize RtAudio audio driver: No devices present.") ERR_FAIL_COND_V( dac->getDeviceCount() < 1, ERR_UNAVAILABLE ); + // FIXME: Adapt to the OutputFormat -> SpeakerMode change + /* String channels = GLOBAL_DEF("audio/output","stereo"); if (channels=="5.1") @@ -95,6 +97,7 @@ Error AudioDriverRtAudio::init() { output_format=OUTPUT_MONO; else output_format=OUTPUT_STEREO; + */ RtAudio::StreamParameters parameters; parameters.deviceId = dac->getDefaultOutputDevice(); @@ -125,11 +128,10 @@ Error AudioDriverRtAudio::init() { while(true) { while( true) { - switch(output_format) { - case OUTPUT_MONO: parameters.nChannels = 1; break; - case OUTPUT_STEREO: parameters.nChannels = 2; break; - case OUTPUT_QUAD: parameters.nChannels = 4; break; - case OUTPUT_5_1: parameters.nChannels = 6; break; + switch(speaker_mode) { + case SPEAKER_MODE_STEREO: parameters.nChannels = 2; break; + case SPEAKER_SURROUND_51: parameters.nChannels = 6; break; + case SPEAKER_SURROUND_71: parameters.nChannels = 8; break; }; try { @@ -142,11 +144,10 @@ Error AudioDriverRtAudio::init() { // try with less channels ERR_PRINT("Unable to open audio, retrying with fewer channels.."); - switch(output_format) { - case OUTPUT_MONO: ERR_EXPLAIN("Unable to open audio."); ERR_FAIL_V( ERR_UNAVAILABLE ); break; - case OUTPUT_STEREO: output_format=OUTPUT_MONO; break; - case OUTPUT_QUAD: output_format=OUTPUT_STEREO; break; - case OUTPUT_5_1: output_format=OUTPUT_QUAD; break; + switch(speaker_mode) { + case SPEAKER_MODE_STEREO: speaker_mode=SPEAKER_MODE_STEREO; break; + case SPEAKER_SURROUND_51: speaker_mode=SPEAKER_SURROUND_51; break; + case SPEAKER_SURROUND_71: speaker_mode=SPEAKER_SURROUND_71; break; }; } } @@ -189,9 +190,9 @@ int AudioDriverRtAudio::get_mix_rate() const { return mix_rate; } -AudioDriverSW::OutputFormat AudioDriverRtAudio::get_output_format() const { +AudioDriver::SpeakerMode AudioDriverRtAudio::get_speaker_mode() const { - return output_format; + return speaker_mode; } void AudioDriverRtAudio::start() { @@ -229,7 +230,7 @@ AudioDriverRtAudio::AudioDriverRtAudio() mutex=NULL; mix_rate=44100; - output_format=OUTPUT_STEREO; + speaker_mode=SPEAKER_MODE_STEREO; } diff --git a/drivers/rtaudio/audio_driver_rtaudio.h b/drivers/rtaudio/audio_driver_rtaudio.h index aa7fae038a..3f293db6a6 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.h +++ b/drivers/rtaudio/audio_driver_rtaudio.h @@ -31,16 +31,16 @@ #ifdef RTAUDIO_ENABLED -#include "servers/audio/audio_server_sw.h" +#include "servers/audio_server.h" #include <RtAudio.h> -class AudioDriverRtAudio : public AudioDriverSW { +class AudioDriverRtAudio : public AudioDriver { static int callback( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *userData ); - OutputFormat output_format; + SpeakerMode speaker_mode; Mutex *mutex; RtAudio *dac; int mix_rate; @@ -53,7 +53,7 @@ public: virtual Error init(); virtual void start(); virtual int get_mix_rate() const ; - virtual OutputFormat get_output_format() const; + virtual SpeakerMode get_speaker_mode() const; virtual void lock(); virtual void unlock(); virtual void finish(); |