| 1 |
/* |
| 2 |
* KitController.h |
| 3 |
* |
| 4 |
* Created on: 19 Nov 2016 |
| 5 |
* Author: jeremy |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef SOURCE_CONTROLLERS_KITCONTROLLER_H_ |
| 9 |
#define SOURCE_CONTROLLERS_KITCONTROLLER_H_ |
| 10 |
|
| 11 |
|
| 12 |
#include "../Widgets/Fader.h" |
| 13 |
#include "../Widgets/VirtualPad.h" |
| 14 |
#include "../Widgets/TriggerIdAndLocation.h" |
| 15 |
#include "../Widgets/SoundTypeAndPath.h" |
| 16 |
#include "../Widgets/InstrumentSelector.h" |
| 17 |
|
| 18 |
#include <libexadrums/Api/eXaDrums.hpp> |
| 19 |
#include <libexadrums/Api/KitCreator/KitCreator_api.hpp> |
| 20 |
|
| 21 |
#include <gtkmm/builder.h> |
| 22 |
#include <gtkmm/button.h> |
| 23 |
#include <gtkmm/comboboxtext.h> |
| 24 |
#include <gtkmm/togglebutton.h> |
| 25 |
#include <gtkmm/box.h> |
| 26 |
#include <gtkmm/filechooserdialog.h> |
| 27 |
#include <gtkmm/window.h> |
| 28 |
|
| 29 |
#include <vector> |
| 30 |
#include <string> |
| 31 |
#include <memory> |
| 32 |
|
| 33 |
namespace Controllers |
| 34 |
{ |
| 35 |
|
| 36 |
class KitController |
| 37 |
{ |
| 38 |
|
| 39 |
public: |
| 40 |
|
| 41 |
KitController(Glib::RefPtr<Gtk::Builder> builder, std::shared_ptr<eXaDrumsApi::eXaDrums>& drumKit, bool isRoot); |
| 42 |
virtual ~KitController(); |
| 43 |
|
| 44 |
private: |
| 45 |
|
| 46 |
|
| 47 |
void CreateKitsList(); |
| 48 |
int GetCurrentKitId() const; |
| 49 |
void SaveKitConfig(int id) const { drumKit->SaveKitConfig(id); } |
| 50 |
void SaveKitConfig() const { drumKit->SaveKitConfig(GetCurrentKitId()); } |
| 51 |
void DeleteKit(int id); |
| 52 |
void KitAdded(); |
| 53 |
void EnableRecording(); |
| 54 |
void RecorderExport(); |
| 55 |
|
| 56 |
// Instruments |
| 57 |
int GetInstrumentVolume(int id) const { return drumKit->GetInstrumentVolume(id); }; |
| 58 |
void AddInstrumentToSelectedKit(); |
| 59 |
void AddInstrumentToKit(); |
| 60 |
void ModifyInstrument(int i); |
| 61 |
void RemoveInstrument(std::size_t i); |
| 62 |
|
| 63 |
// Signals |
| 64 |
void ChangeKit(); |
| 65 |
void PlayDrums(); |
| 66 |
void ValidateKitData(); |
| 67 |
void ChangeInstrumentType(); |
| 68 |
void ValidateInstrumentData(); |
| 69 |
void CancelInstrumentModif(); |
| 70 |
void ShowInstrumentSelectWindow(); |
| 71 |
void SaveKitPreferences(); |
| 72 |
void ChangeInstrumentSound(); |
| 73 |
|
| 74 |
// Faders |
| 75 |
void UpdateFaders(); |
| 76 |
void SaveFaders() const; |
| 77 |
|
| 78 |
// Virtual kit |
| 79 |
void UpdateVirtualKit(); |
| 80 |
|
| 81 |
// Keyboard |
| 82 |
void ShowKeyboard(); |
| 83 |
void HideKeyboard(); |
| 84 |
|
| 85 |
// Dialogs & Windows |
| 86 |
void DeleteKitDialog(); |
| 87 |
void AddNewKitWindow(); |
| 88 |
void AddNewKit(); |
| 89 |
|
| 90 |
// Instruments |
| 91 |
void SetInstrumentVolume(Widgets::FaderPtr& fader) const; |
| 92 |
|
| 93 |
Glib::RefPtr<Gtk::Builder> builder; |
| 94 |
std::shared_ptr<eXaDrumsApi::eXaDrums> drumKit; |
| 95 |
std::unique_ptr<eXaDrumsApi::KitCreator> kitCreator; |
| 96 |
bool isRoot; |
| 97 |
|
| 98 |
// Buttons |
| 99 |
Gtk::Button* deleteKitButton; |
| 100 |
Gtk::Button* addDrumKitButton; |
| 101 |
Gtk::Button* playButton; |
| 102 |
Gtk::ToggleButton* recordButton; |
| 103 |
Gtk::Button* kitPreferencesButton; |
| 104 |
|
| 105 |
// Comboboxes |
| 106 |
Gtk::ComboBoxText* kitsList; |
| 107 |
|
| 108 |
// Faders |
| 109 |
Gtk::Button* saveFaders; |
| 110 |
std::vector<Widgets::FaderPtr> faders; |
| 111 |
Gtk::Box* fadersList; |
| 112 |
|
| 113 |
// Virtual kit |
| 114 |
Gtk::Box* virtualPadsList; |
| 115 |
std::vector<Widgets::VirtualPadPtr> virtualPads; |
| 116 |
|
| 117 |
// Kit creation |
| 118 |
std::vector<Widgets::TriggerIdAndLocationPtr> triggersIdsAndLocations; |
| 119 |
std::vector<Widgets::SoundTypeAndPathPtr> soundsTypesAndPaths; |
| 120 |
std::vector<Widgets::InstrumentSelectorPtr> instrumentsSelectors; |
| 121 |
|
| 122 |
|
| 123 |
// Windows |
| 124 |
Gtk::Window* newKitWindow; |
| 125 |
Gtk::Window* recorderExportWindow; |
| 126 |
Gtk::Window* instrumentConfigWindow; |
| 127 |
Gtk::Window* instrumentSeclectWindow; |
| 128 |
Gtk::Window* virtualPadWindow; |
| 129 |
Gtk::FileChooserDialog* recorderWindow; |
| 130 |
|
| 131 |
// Class variables |
| 132 |
bool isModifyingKit = false; |
| 133 |
int numInstrumentsToCreate; |
| 134 |
int instrumentToModify; |
| 135 |
|
| 136 |
|
| 137 |
}; |
| 138 |
|
| 139 |
} /* namespace Gui */ |
| 140 |
|
| 141 |
#endif /* SOURCE_CONTROLLERS_KITCONTROLLER_H_ */ |