Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Müller <nexyon@gmail.com>2020-06-13 16:19:03 +0300
committerJeroen Bakker <jeroen@blender.org>2020-06-25 11:08:14 +0300
commit68fae13d9b414f8f0722c60901858b4b236ee31f (patch)
tree1226e6a6a59019f2d930bdaf7cdf2367a65d3b67
parente553408bee693d7cbff1b359af330f4963d2db12 (diff)
Fix T66786: Audio SDL: Video editor Sound muted without muting it
Porting fix for SDL 2 audio formats from audaspace upstream.
-rw-r--r--extern/audaspace/plugins/sdl/SDLDevice.cpp40
1 files changed, 33 insertions, 7 deletions
diff --git a/extern/audaspace/plugins/sdl/SDLDevice.cpp b/extern/audaspace/plugins/sdl/SDLDevice.cpp
index 603e16001b8..8d7a605fa36 100644
--- a/extern/audaspace/plugins/sdl/SDLDevice.cpp
+++ b/extern/audaspace/plugins/sdl/SDLDevice.cpp
@@ -52,7 +52,7 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
- specs.format = FORMAT_S16;
+ specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
@@ -61,10 +61,25 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
SDL_AudioSpec format, obtained;
format.freq = m_specs.rate;
- if(m_specs.format == FORMAT_U8)
+ switch(m_specs.format)
+ {
+ case FORMAT_U8:
format.format = AUDIO_U8;
- else
+ break;
+ case FORMAT_S16:
format.format = AUDIO_S16SYS;
+ break;
+ case FORMAT_S32:
+ format.format = AUDIO_S32SYS;
+ break;
+ case FORMAT_FLOAT32:
+ format.format = AUDIO_F32SYS;
+ break;
+ default:
+ format.format = AUDIO_F32SYS;
+ break;
+ }
+
format.channels = m_specs.channels;
format.samples = buffersize;
format.callback = SDLDevice::SDL_mix;
@@ -75,14 +90,25 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
m_specs.rate = (SampleRate)obtained.freq;
m_specs.channels = (Channels)obtained.channels;
- if(obtained.format == AUDIO_U8)
+
+ switch(obtained.format)
+ {
+ case AUDIO_U8:
m_specs.format = FORMAT_U8;
- else if(obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB)
+ break;
+ case AUDIO_S16SYS:
m_specs.format = FORMAT_S16;
- else
- {
+ break;
+ case AUDIO_S32SYS:
+ m_specs.format = FORMAT_S32;
+ break;
+ case AUDIO_F32SYS:
+ m_specs.format = FORMAT_FLOAT32;
+ break;
+ default:
SDL_CloseAudio();
AUD_THROW(DeviceException, "The sample format obtained from SDL is not supported.");
+ break;
}
create();