diff --git a/libmve/movie_sound.cpp b/libmve/movie_sound.cpp index 345f3b0c..875c3ec0 100644 --- a/libmve/movie_sound.cpp +++ b/libmve/movie_sound.cpp @@ -16,21 +16,15 @@ * along with this program. If not, see . */ -#include #include "movie_sound.h" namespace D3 { -MovieSoundDevice::MovieSoundDevice(int sample_rate, uint16_t sample_size, uint8_t channels, uint32_t buf_size, - bool is_compressed) { - SDL_AudioFormat format = (sample_size == 2) ? AUDIO_S16LSB : AUDIO_U8; - SDL_AudioSpec spec; +MovieSoundDevice::MovieSoundDevice(int sample_rate, uint16_t sample_size, uint8_t channels, bool is_compressed) { + SDL_AudioSpec spec{}; spec.freq = sample_rate; - spec.format = format; + spec.format = (sample_size == 2) ? AUDIO_S16LSB : AUDIO_U8; spec.channels = channels; - spec.size = buf_size; - spec.callback = nullptr; - spec.userdata = this; m_device_id = SDL_OpenAudioDevice(nullptr, 0, &spec, nullptr, 0); m_is_compressed = is_compressed; diff --git a/libmve/movie_sound.h b/libmve/movie_sound.h index 43bf84ad..fcaf8aaf 100644 --- a/libmve/movie_sound.h +++ b/libmve/movie_sound.h @@ -37,11 +37,10 @@ public: * @param sample_rate sample rate in Hz (22050, 44100...) * @param sample_size sample size (8, 16) * @param channels count of channels (1 for mono, 2 for stereo) - * @param buf_size buffer size for SDL audio device * @param is_compressed mark stream as compressed (on streaming will be used decompression functions) */ - MovieSoundDevice(int sample_rate, uint16_t sample_size, uint8_t channels, uint32_t buf_size, bool is_compressed); - ~MovieSoundDevice(); + MovieSoundDevice(int sample_rate, uint16_t sample_size, uint8_t channels, bool is_compressed); + ~MovieSoundDevice() override; /** * Check if sound device is properly initialized diff --git a/libmve/mveplay.cpp b/libmve/mveplay.cpp index 272e47fa..9355d0d0 100644 --- a/libmve/mveplay.cpp +++ b/libmve/mveplay.cpp @@ -184,7 +184,7 @@ static int create_audiobuf_handler(unsigned char major, unsigned char minor, uns is_compressed = true; } - snd_ds = std::make_unique(sample_rate, sample_size, channels, 4096, is_compressed); + snd_ds = std::make_unique(sample_rate, sample_size, channels, is_compressed); #endif return 1; diff --git a/libmve/sound_interface.h b/libmve/sound_interface.h index a532f919..f74e382d 100644 --- a/libmve/sound_interface.h +++ b/libmve/sound_interface.h @@ -29,6 +29,8 @@ protected: bool m_is_compressed = false; public: + virtual ~ISoundDevice() = default; + /// Play stream virtual void Play() {}; /// Stop stream