Project Alice
Loading...
Searching...
No Matches
sound_nix.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "system_state.hpp"
4#include "miniaudio.h"
5
6namespace sound {
7
9public:
11
12 audio_instance() = default;
15 return *this;
16 }
19 filename = native_string(name);
20 }
21};
22
24public:
25 std::optional<ma_sound> effect_sound;
26 std::optional<ma_sound> interface_sound;
27 std::optional<ma_sound> music;
28
29 ma_engine engine;
30 bool global_pause = false;
31
79
80 std::vector<audio_instance> music_list;
81 int32_t last_music = -1;
82 int32_t first_music = -1;
83 int32_t current_music = -1;
84
85 sound_impl();
87 void set_volume(std::optional<ma_sound>& sound, float volume);
88 void override_sound(std::optional<ma_sound>& sound, audio_instance& s, float volume);
89 void play_music(int32_t track, float volume);
90 void play_new_track(sys::state& ws);
93 bool music_finished();
94};
95
96} // namespace sound
native_string filename
Definition: sound_nix.hpp:10
audio_instance & operator=(audio_instance const &o)
Definition: sound_nix.hpp:13
void set_file(native_string_view name)
Definition: sound_nix.hpp:18
audio_instance province_select_sounds[4]
Definition: sound_nix.hpp:74
void set_volume(std::optional< ma_sound > &sound, float volume)
Definition: sound_nix.cpp:28
audio_instance tab_diplomacy_sound
Definition: sound_nix.hpp:43
audio_instance land_battle_sounds[6]
Definition: sound_nix.hpp:72
int32_t first_music
Definition: sound_nix.hpp:82
audio_instance railroad_built_sound
Definition: sound_nix.hpp:63
std::optional< ma_sound > effect_sound
Definition: sound_nix.hpp:25
audio_instance revolt_sound
Definition: sound_nix.hpp:61
audio_instance decline_sound
Definition: sound_nix.hpp:67
audio_instance naval_base_built_sound
Definition: sound_nix.hpp:64
audio_instance navy_move_sound
Definition: sound_nix.hpp:51
void play_music(int32_t track, float volume)
Definition: sound_nix.cpp:48
audio_instance click_left_sound
Definition: sound_nix.hpp:33
audio_instance army_select_sound
Definition: sound_nix.hpp:50
audio_instance major_event_sound
Definition: sound_nix.hpp:66
audio_instance tab_production_sound
Definition: sound_nix.hpp:46
audio_instance minor_event_sound
Definition: sound_nix.hpp:65
audio_instance console_open_sound
Definition: sound_nix.hpp:70
audio_instance checkbox_sound
Definition: sound_nix.hpp:37
audio_instance declaration_of_war_sound
Definition: sound_nix.hpp:53
audio_instance diplomatic_request_sound
Definition: sound_nix.hpp:69
std::vector< audio_instance > music_list
Definition: sound_nix.hpp:80
audio_instance tab_politics_sound
Definition: sound_nix.hpp:42
audio_instance decision_sound
Definition: sound_nix.hpp:76
audio_instance fort_built_sound
Definition: sound_nix.hpp:62
int32_t last_music
Definition: sound_nix.hpp:81
audio_instance navy_select_sound
Definition: sound_nix.hpp:52
audio_instance tab_budget_sound
Definition: sound_nix.hpp:35
audio_instance factory_built_sound
Definition: sound_nix.hpp:59
audio_instance accept_sound
Definition: sound_nix.hpp:68
audio_instance tab_military_sound
Definition: sound_nix.hpp:44
audio_instance autochoose_sound
Definition: sound_nix.hpp:41
audio_instance army_move_sound
Definition: sound_nix.hpp:49
ma_engine engine
Definition: sound_nix.hpp:29
void play_new_track(sys::state &ws)
Definition: sound_nix.cpp:56
audio_instance console_close_sound
Definition: sound_nix.hpp:71
int32_t current_music
Definition: sound_nix.hpp:83
audio_instance unpause_sound
Definition: sound_nix.hpp:78
void play_previous_track(sys::state &ws)
Definition: sound_nix.cpp:71
audio_instance naval_battle_sounds[6]
Definition: sound_nix.hpp:73
audio_instance delete_sound
Definition: sound_nix.hpp:40
audio_instance tab_technology_sound
Definition: sound_nix.hpp:47
audio_instance tab_population_sound
Definition: sound_nix.hpp:45
audio_instance subtab_sound
Definition: sound_nix.hpp:39
audio_instance click_right_sound
Definition: sound_nix.hpp:34
audio_instance error_sound
Definition: sound_nix.hpp:55
audio_instance enact_sound
Definition: sound_nix.hpp:38
std::optional< ma_sound > interface_sound
Definition: sound_nix.hpp:26
audio_instance click_sound
Definition: sound_nix.hpp:32
audio_instance army_built_sound
Definition: sound_nix.hpp:57
bool music_finished()
Definition: sound_nix.cpp:78
void play_next_track(sys::state &ws)
Definition: sound_nix.cpp:65
audio_instance technology_finished_sound
Definition: sound_nix.hpp:48
audio_instance chat_message_sound
Definition: sound_nix.hpp:54
std::optional< ma_sound > music
Definition: sound_nix.hpp:27
audio_instance election_sound
Definition: sound_nix.hpp:60
void override_sound(std::optional< ma_sound > &sound, audio_instance &s, float volume)
Definition: sound_nix.cpp:34
audio_instance hover_sound
Definition: sound_nix.hpp:36
audio_instance pause_sound
Definition: sound_nix.hpp:77
audio_instance navy_built_sound
Definition: sound_nix.hpp:58
audio_instance peace_sound
Definition: sound_nix.hpp:56
audio_instance event_sound
Definition: sound_nix.hpp:75
Definition: sound.hpp:15
std::string_view native_string_view
std::string native_string