diff --git a/examples/audio.cpp b/examples/audio.cpp index aa54d3e1..7d5b144e 100644 --- a/examples/audio.cpp +++ b/examples/audio.cpp @@ -7,13 +7,17 @@ #include #include #include +#include #include #include #include #include #include +#include #include +#include #include +#include #include @@ -64,7 +68,7 @@ struct audio_app { mixer_ = audio::make_mixer(); volume_control_ = audio::volume_stereo(mixer_, 0.5f, 0.5f, 0.1f); - engine_.output()->stream(volume_control_); + engine_.output()->stream(audio::compressor(volume_control_, audio::from_db(-2.f), 0.95f, 0.002f, 1.f)); } void on_key_down(SDL_Keycode key) override @@ -101,6 +105,22 @@ struct audio_app volume_control_->gain_right(0.5f - 0.5f * volume); } + void present() override + { + gl::ClearColor(0.8f, 0.8f, 1.f, 1.f); + gl::Clear(gl::COLOR_BUFFER_BIT); + + { + gfx::painter::text_options opts; + opts.x = gfx::painter::x_align::left; + opts.y = gfx::painter::y_align::top; + opts.scale = 2.f; + opts.c = {0, 0, 0, 255}; + } + + painter_.render(geom::window_camera{width(), height()}.transform()); + } + private: audio::engine engine_; audio::mixer_ptr mixer_; @@ -108,6 +128,8 @@ private: std::map channels_; util::clock<> clock_; + + gfx::painter painter_; }; int main()