diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-08-22 18:27:17 -0300 |
---|---|---|
committer | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-09-12 15:13:28 -0300 |
commit | 730d36f350274a055a612d39307b02b43dd59eb2 (patch) | |
tree | 61943817253ef32869a45ffa0717f0292076cdc8 /platform/osx | |
parent | 647a9141558e0dd618e62b0563dca3363387e897 (diff) |
Fixed issues with surround sound on audio server
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/audio_driver_osx.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp index 78c52af201..3b3ba60507 100644 --- a/platform/osx/audio_driver_osx.cpp +++ b/platform/osx/audio_driver_osx.cpp @@ -58,14 +58,14 @@ Error AudioDriverOSX::initDevice() { AudioStreamBasicDescription strdesc; - // TODO: Implement this - /*zeromem(&strdesc, sizeof(strdesc)); + zeromem(&strdesc, sizeof(strdesc)); UInt32 size = sizeof(strdesc); result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size); ERR_FAIL_COND_V(result != noErr, FAILED); switch (strdesc.mChannelsPerFrame) { case 2: // Stereo + case 4: // Surround 3.1 case 6: // Surround 5.1 case 8: // Surround 7.1 channels = strdesc.mChannelsPerFrame; @@ -75,7 +75,7 @@ Error AudioDriverOSX::initDevice() { // Unknown number of channels, default to stereo channels = 2; break; - }*/ + } mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE); @@ -103,7 +103,8 @@ Error AudioDriverOSX::initDevice() { samples_in.resize(buffer_size); if (OS::get_singleton()->is_stdout_verbose()) { - print_line("audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); + print_line("CoreAudio: detected " + itos(channels) + " channels"); + print_line("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); } AURenderCallbackStruct callback; @@ -242,7 +243,7 @@ int AudioDriverOSX::get_mix_rate() const { }; AudioDriver::SpeakerMode AudioDriverOSX::get_speaker_mode() const { - return SPEAKER_MODE_STEREO; + return get_speaker_mode_by_total_channels(channels); }; void AudioDriverOSX::lock() { |