2727
2828#include < iostream>
2929
30+ static const float c_default_vol = 0 .5f ;
31+
3032// TODO:
3133// --1. Seagulls.--
3234// --2. Hide from enemies in the clouds.--
@@ -197,7 +199,7 @@ class Game : public t8x::GameEngine<>
197199 if (enable_audio && chip_tune.load_tune (folder::join_path ({ tune_path, " chiptune2.ct" })))
198200 {
199201 // chip_tune.play_tune();
200- chip_tune.set_volume_slider (volume_music);
202+ chip_tune.set_volume_slider (volume_music, min_dB, nl_taper );
201203 chip_tune.play_tune_async ();
202204 chip_tune.wait_for_completion ();
203205 }
@@ -210,13 +212,13 @@ class Game : public t8x::GameEngine<>
210212 if (enable_audio)
211213 {
212214 src_fx_0 = audio.create_source ();
213- src_fx_0->set_volume_slider (volume_sfx);
215+ src_fx_0->set_volume_slider (volume_sfx, min_dB, nl_taper );
214216
215217 src_fx_1 = audio.create_source ();
216- src_fx_1->set_volume_slider (volume_sfx);
218+ src_fx_1->set_volume_slider (volume_sfx, min_dB, nl_taper );
217219
218220 src_fx_2 = audio.create_source ();
219- src_fx_2->set_volume_slider (volume_sfx);
221+ src_fx_2->set_volume_slider (volume_sfx, min_dB, nl_taper );
220222 }
221223
222224 std::string font_data_path = t8x::get_path_to_font_data (get_exe_folder ());
@@ -470,8 +472,10 @@ class Game : public t8x::GameEngine<>
470472 beat::AudioSource* src_fx_0 = nullptr ;
471473 beat::AudioSource* src_fx_1 = nullptr ;
472474 beat::AudioSource* src_fx_2 = nullptr ;
473- float volume_music = 1 .f;
474- float volume_sfx = 1 .f;
475+ float volume_music = c_default_vol;
476+ float volume_sfx = c_default_vol;
477+ float min_dB = -60 .f;
478+ float nl_taper = 0 .28f ;
475479
476480 std::vector<t8x::ColorScheme> color_schemes;
477481 t8x::FontDataColl font_data;
@@ -494,8 +498,8 @@ int main(int argc, char** argv)
494498
495499 bool use_audio = true ;
496500 bool show_help = false ;
497- float music_volume = 1 . f ;
498- float sfx_volume = 1 . f ;
501+ float music_volume = c_default_vol ;
502+ float sfx_volume = c_default_vol ;
499503
500504 for (int i = 1 ; i < argc; ++i)
501505 {
@@ -546,8 +550,8 @@ int main(int argc, char** argv)
546550 std::cout << " <altitude_km> : " << game.get_alt_km () << std::endl;
547551 std::cout << " <fps> : " << game.get_real_fps () << std::endl;
548552 std::cout << " <delay_us> : " << game.get_sim_delay_us () << std::endl;
549- std::cout << " <music_vol> : " << music_volume << " (valid range: [0, 1])" <<std::endl;
550- std::cout << " <sfx_vol> : " << sfx_volume << " (valid range: [0, 1])" <<std::endl;
553+ std::cout << " <music_vol> : " << c_default_vol << " (valid range: [0, 1])" <<std::endl;
554+ std::cout << " <sfx_vol> : " << c_default_vol << " (valid range: [0, 1])" <<std::endl;
551555 return EXIT_SUCCESS;
552556 }
553557
0 commit comments