Play sounds with SDL audio and stb_vorbis instead of SDL_mixer
Sounds decode once to 48 kHz stereo floats. Each play is a stream on one shared device, opened on the first play. A render's audio is mixed offline at 48 kHz, so command line renders get their sounds too. The About music is Ogg Vorbis now. Opus, libopus and libogg are gone.
This commit is contained in:
1 parent
7afdf709c3
commit
7e81ea4259
17 files changed
+249
-225
No files matched your search
+4
-4
@@ -105,9 +105,9 @@ static constexpr About::Credit CREDITS[] = {
|
||||
{"https://github.com/libsdl-org/SDL"},
|
||||
{"License: zlib"},
|
||||
{""},
|
||||
{"SDL_mixer"},
|
||||
{"https://github.com/libsdl-org/SDL_mixer"},
|
||||
{"License: zlib"},
|
||||
{"stb"},
|
||||
{"https://github.com/nothings/stb"},
|
||||
{"License: MIT or public domain"},
|
||||
{""},
|
||||
{"pugixml"},
|
||||
{"https://github.com/zeux/pugixml"},
|
||||
@@ -468,7 +468,7 @@ static void roll_draw(About& about, Resources& resources, ImVec2 min, ImVec2 siz
|
||||
|
||||
void About::reset(Resources& resources)
|
||||
{
|
||||
audio_play(resources.music_track(), true);
|
||||
audio_play(resources.music_track(), AUDIO_LOOP);
|
||||
roll = {};
|
||||
|
||||
for (int i = 0; i < FRIEND_COUNT; ++i)
|
||||
|
||||
@@ -134,14 +134,14 @@ void AnimationPreview::tick(Manager& manager, Settings& settings, float deltaSec
|
||||
|
||||
auto stop_all_sounds = [&]() {
|
||||
for (auto sound : document.sounds_get())
|
||||
audio_stop(*sound, mixer);
|
||||
audio_stop(*sound);
|
||||
};
|
||||
|
||||
if (manager.isRecording)
|
||||
{
|
||||
if (recorder.is_done())
|
||||
{
|
||||
recorder.finish(document, audioStream);
|
||||
recorder.finish();
|
||||
recording_stop(manager, document);
|
||||
}
|
||||
stop_all_sounds();
|
||||
@@ -177,7 +177,7 @@ void AnimationPreview::tick(Manager& manager, Settings& settings, float deltaSec
|
||||
if (manager.isRecording || !isSound)
|
||||
continue;
|
||||
for (auto sound : document.trigger_sounds_get(*animation, soundFrame))
|
||||
audio_play(*sound, false, mixer);
|
||||
audio_play(*sound);
|
||||
}
|
||||
|
||||
frameTime = playback.time;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "audio_stream.h"
|
||||
#include "ui/canvas_view.h"
|
||||
#include "manager.h"
|
||||
#include "model/draw.h"
|
||||
@@ -13,8 +12,6 @@
|
||||
|
||||
class AnimationPreview : public CanvasView
|
||||
{
|
||||
MIX_Mixer* mixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, nullptr);
|
||||
AudioStream audioStream = AudioStream(mixer);
|
||||
bool wasPlaybackPlaying = false;
|
||||
int soundFrame = -1;
|
||||
bool isMoveDragging = false;
|
||||
|
||||
Reference in new issue
Block a user