diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2017-09-12 20:59:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-12 20:59:35 +0200 |
commit | 7f40734a1ca7d00f5b1224bb37cb933fb5ba0b44 (patch) | |
tree | cac0bb1df13f83318447de68ea4c1591c6783711 /platform/osx/audio_driver_osx.cpp | |
parent | fe33ef5a1948af7c89a6d71de3580341cf2c0d6a (diff) | |
parent | 730d36f350274a055a612d39307b02b43dd59eb2 (diff) |
Merge pull request #10568 from marcelofg55/surround_fixes
Fixed issues with surround sound on audio server
Diffstat (limited to 'platform/osx/audio_driver_osx.cpp')
-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() { |