-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathframe.hpp
171 lines (103 loc) · 3.88 KB
/
frame.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
# include <wx/wx.h>
#endif
#include <wx/sizer.h>
#include <wx/gbsizer.h>
#include <wx/tglbtn.h>
#include <wx/fileconf.h>
#include "audiomixer.hpp"
class SoundboardVUMeter: public wxPanel {
public:
explicit SoundboardVUMeter(wxWindow *parent);
~SoundboardVUMeter();
void paint_event(wxPaintEvent& event);
void paint_now(void);
void render(wxDC& dc);
void set_level(float);
private:
float level;
wxDECLARE_EVENT_TABLE();
};
class SoundboardMainPanel;
class SoundboardPlayerPanel: public wxPanel {
public:
static const int WIDTH = 150;
static const int HEIGHT = 150;
SoundboardPlayerPanel(SoundboardMainPanel *parent, int x, int y);
~SoundboardPlayerPanel();
std::shared_ptr<AudioPlayer> get_player(void);
private:
std::shared_ptr<AudioMixer> mixer;
int xpos,ypos;
void open_file_in_player(std::string filename);
std::string configuration_own_keyify(const std::string &key);
void configuration_set_int(const std::string &key, int);
int configuration_get_int(const std::string &key, int vdefault);
void configuration_set_float(const std::string &key, float);
float configuration_get_float(const std::string &key, float vdefault);
void configuration_set_string(const std::string &key, std::string);
std::string configuration_get_string(const std::string &key, std::string vdefault);
void on_button_play(wxCommandEvent& event);
void on_button_loop(wxCommandEvent& event);
void on_button_mute(wxCommandEvent& event);
void on_button_open(wxCommandEvent& event);
void on_timer(wxTimerEvent& event);
void on_slider(wxCommandEvent& event);
void on_destroy(wxWindowDestroyEvent& event);
SoundboardMainPanel *main_panel;
AudioPlayerID pid;
SoundboardVUMeter *vumeter;
wxSlider *slider_volume;
wxToggleButton *play_button;
wxToggleButton *loop_button;
wxToggleButton *mute_button;
wxButton *open_button;
wxTimer *timer;
wxDECLARE_EVENT_TABLE();
};
class SoundboardFrame;
class SoundboardMainPanel: public wxPanel {
public:
SoundboardMainPanel(SoundboardFrame *parent, std::string app_name);
std::shared_ptr<AudioMixer> mixer;
void configuration_set_int(const std::string &key, int);
int configuration_get_int(const std::string &key, int vdefault);
void configuration_set_float(const std::string &key, float);
float configuration_get_float(const std::string &key, float vdefault);
void configuration_set_string(const std::string &key, std::string);
std::string configuration_get_string(const std::string &key, std::string vdefault);
void increment_player_grid_size(int,int);
private:
wxGridBagSizer *gs;
std::unique_ptr<wxFileConfig> config;
bool load_configuration_from_file(std::string app_name);
void create_new_player_panel_at_position(int i, int j);
void remove_player_panel_at_position(int i, int j);
void set_player_grid_size(int,int);
wxDECLARE_EVENT_TABLE();
};
class SoundboardFrame: public wxFrame {
public:
SoundboardFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
std::shared_ptr<AudioMixer> get_mixer();
private:
wxMenu *menu;
wxMenu *menu_device;
wxMenu *menu_mode;
wxGridBagSizer *ugs;
void on_device_menu(wxCommandEvent& event);
void on_mode_menu(wxCommandEvent& event);
void on_size(wxSizeEvent& event);
void set_mixer_device(PaDeviceIndex);
void set_mixer_mode(AudioMixerMode);
void on_button_new_column(wxCommandEvent& event);
void on_button_remove_column(wxCommandEvent& event);
void on_button_new_row(wxCommandEvent& event);
void on_button_remove_row(wxCommandEvent& event);
void set_sizer_and_fit(void);
std::shared_ptr<AudioMixer> mixer;
wxMenuBar *menubar;
SoundboardMainPanel *panel;
wxDECLARE_EVENT_TABLE();
};