gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

mqSettingsGui.h (1195B)


      1 #pragma once
      2 
      3 #include <array>
      4 
      5 #include <cpp-terminal/window.hpp>
      6 #undef B0	// added on macOS via termios.h, collides with DSP Register::B0
      7 
      8 #include "mqConsoleLib/mqGuiBase.h"
      9 
     10 namespace mqConsoleLib
     11 {
     12 class SettingsGui : public GuiBase
     13 {
     14 public:
     15 	SettingsGui();
     16 
     17 	void render(int _midiInput, int _midiOutput, int _audioOutput);
     18 	void onOpen() override;
     19 
     20 	void onEnter();
     21 	void onDown();
     22 	void onLeft();
     23 	void onRight();
     24 	void onUp();
     25 
     26 	bool processKey(int _ch);
     27 
     28 	const std::string& getMidiInput() const { return m_midiInput; }
     29 	const std::string& getMidiOutput() const { return m_midiOutput; }
     30 	const std::string& getAudioOutput() const { return m_audioOutput; }
     31 
     32 private:
     33 	struct Setting
     34 	{
     35 		int devId;
     36 		std::string name;
     37 	};
     38 
     39 	void findSettings();
     40 	void changeDevice(const Setting& _value, int column);
     41 	int renderSettings(int x, int y, int _selectedId, int _column, const std::string& _headline);
     42 	void moveCursor(int x, int y);
     43 	Term::Window m_win;
     44 
     45 	int m_cursorX = 0;
     46 	int m_cursorY = 0;
     47 	bool m_enter = false;
     48 
     49 	std::array<std::vector<Setting>, 3> m_settings;
     50 	std::array<int, 3> m_scrollPos{0};
     51 
     52 	std::string m_midiInput;
     53 	std::string m_midiOutput;
     54 	std::string m_audioOutput;
     55 };
     56 }