Guitarix
tunerswitcher.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Andreas Degert
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  * --------------------------------------------------------------------------
18  */
19 
20 #pragma once
21 
22 #ifndef SRC_HEADERS_TUNERSWITCHER_H_
23 #define SRC_HEADERS_TUNERSWITCHER_H_
24 
25 /****************************************************************
26  ** class TunerSwitcher
27  */
28 
29 class TunerSwitcher: public sigc::trackable {
30 public:
32 private:
34  mute_on = -1,
35  mute_off = -2,
36  bypass_on = -3,
37  bypass_off = -4,
38  tuner_on = -5,
39  tuner_off = -6,
40  };
43  sigc::signal<void,const Glib::ustring&,const Glib::ustring&> display;
44  sigc::signal<void,SwitcherState> set_state;
45  sigc::signal<void, bool> selection_done;
46  sigc::connection switcher_conn;
47  sigc::connection timeout_conn;
56 private:
61  bool display_bank_key(int idx);
62  bool display_preset_key(int idx);
63  void change_state(SwitcherState newstate);
64 public:
66  bool get_active() { return switcher_conn.connected(); }
67  void activate(bool tuner_active);
68  void deactivate();
69  void toggle(bool tuner_active);
70  sigc::signal<void,const Glib::ustring&,const Glib::ustring&>& signal_display() { return display; }
71  sigc::signal<void,SwitcherState>& signal_set_state() { return set_state; }
72  sigc::signal<void, bool>& signal_selection_done() { return selection_done; }
73 };
74 
75 #endif // SRC_HEADERS_TUNERSWITCHER_H_
bool old_tuner_active
Definition: tunerswitcher.h:52
gx_engine::GxEngineState new_engine_state
Definition: tunerswitcher.h:51
void activate(bool tuner_active)
sigc::signal< void, bool > selection_done
Definition: tunerswitcher.h:45
gx_engine::GxEngine & engine
Definition: tunerswitcher.h:42
TunerSwitcher(gx_preset::GxSettings &settings, gx_engine::GxEngine &engine)
sigc::signal< void, SwitcherState > & signal_set_state()
Definition: tunerswitcher.h:71
sigc::signal< void, bool > & signal_selection_done()
Definition: tunerswitcher.h:72
void on_tuner_freq_changed()
gx_engine::GxEngineState old_engine_state
Definition: tunerswitcher.h:50
bool display_bank_key(int idx)
void toggle(bool tuner_active)
void try_load_preset()
bool new_tuner_active
Definition: tunerswitcher.h:53
sigc::connection switcher_conn
Definition: tunerswitcher.h:46
gx_preset::GxSettings & settings
Definition: tunerswitcher.h:41
bool on_state_timeout()
SwitcherState state
Definition: tunerswitcher.h:49
sigc::signal< void, const Glib::ustring &, const Glib::ustring & > display
Definition: tunerswitcher.h:43
sigc::connection timeout_conn
Definition: tunerswitcher.h:47
bool display_preset_key(int idx)
bool on_note_timeout()
void change_state(SwitcherState newstate)
sigc::signal< void, SwitcherState > set_state
Definition: tunerswitcher.h:44
sigc::signal< void, const Glib::ustring &, const Glib::ustring & > & signal_display()
Definition: tunerswitcher.h:70
bool get_active()
Definition: tunerswitcher.h:66
void deactivate()