Loading...
Searching...
No Matches
tunerswitcher.h
Go to the documentation of this file.
/*
* Copyright (C) 2013 Andreas Degert
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* --------------------------------------------------------------------------
*/
#pragma once
#ifndef SRC_HEADERS_TUNERSWITCHER_H_
#define SRC_HEADERS_TUNERSWITCHER_H_
/****************************************************************
** class TunerSwitcher
*/
class TunerSwitcher: public sigc::trackable {
public:
enum SwitcherState { normal_mode, wait_start, listening, wait_stop };
private:
enum SwitcherActions {
mute_on = -1,
mute_off = -2,
bypass_on = -3,
bypass_off = -4,
tuner_on = -5,
tuner_off = -6,
};
gx_preset::GxSettings& settings;
gx_engine::GxEngine& engine;
sigc::signal<void,const Glib::ustring&,const Glib::ustring&> display;
sigc::signal<void,SwitcherState> set_state;
sigc::signal<void, bool> selection_done;
sigc::connection switcher_conn;
sigc::connection timeout_conn;
int current_note;
SwitcherState state;
gx_engine::GxEngineState old_engine_state;
gx_engine::GxEngineState new_engine_state;
bool old_tuner_active;
bool new_tuner_active;
int last_bank_idx;
int last_preset_idx;
private:
bool on_note_timeout();
bool on_state_timeout();
void on_tuner_freq_changed();
void try_load_preset();
bool display_bank_key(int idx);
bool display_preset_key(int idx);
void change_state(SwitcherState newstate);
public:
TunerSwitcher(gx_preset::GxSettings& settings, gx_engine::GxEngine& engine);
bool get_active() { return switcher_conn.connected(); }
void activate(bool tuner_active);
void deactivate();
void toggle(bool tuner_active);
sigc::signal<void,const Glib::ustring&,const Glib::ustring&>& signal_display() { return display; }
sigc::signal<void,SwitcherState>& signal_set_state() { return set_state; }
sigc::signal<void, bool>& signal_selection_done() { return selection_done; }
};
#endif // SRC_HEADERS_TUNERSWITCHER_H_
TunerSwitcher::old_tuner_active
bool old_tuner_active
Definition tunerswitcher.h:52
TunerSwitcher::new_engine_state
gx_engine::GxEngineState new_engine_state
Definition tunerswitcher.h:51
TunerSwitcher::activate
void activate(bool tuner_active)
TunerSwitcher::selection_done
sigc::signal< void, bool > selection_done
Definition tunerswitcher.h:45
TunerSwitcher::last_bank_idx
int last_bank_idx
Definition tunerswitcher.h:54
TunerSwitcher::engine
gx_engine::GxEngine & engine
Definition tunerswitcher.h:42
TunerSwitcher::TunerSwitcher
TunerSwitcher(gx_preset::GxSettings &settings, gx_engine::GxEngine &engine)
TunerSwitcher::last_preset_idx
int last_preset_idx
Definition tunerswitcher.h:55
TunerSwitcher::on_tuner_freq_changed
void on_tuner_freq_changed()
TunerSwitcher::old_engine_state
gx_engine::GxEngineState old_engine_state
Definition tunerswitcher.h:50
TunerSwitcher::display_bank_key
bool display_bank_key(int idx)
TunerSwitcher::toggle
void toggle(bool tuner_active)
TunerSwitcher::try_load_preset
void try_load_preset()
TunerSwitcher::new_tuner_active
bool new_tuner_active
Definition tunerswitcher.h:53
TunerSwitcher::switcher_conn
sigc::connection switcher_conn
Definition tunerswitcher.h:46
TunerSwitcher::settings
gx_preset::GxSettings & settings
Definition tunerswitcher.h:41
TunerSwitcher::SwitcherState
SwitcherState
Definition tunerswitcher.h:31
TunerSwitcher::wait_stop
@ wait_stop
Definition tunerswitcher.h:31
TunerSwitcher::normal_mode
@ normal_mode
Definition tunerswitcher.h:31
TunerSwitcher::wait_start
@ wait_start
Definition tunerswitcher.h:31
TunerSwitcher::listening
@ listening
Definition tunerswitcher.h:31
TunerSwitcher::SwitcherActions
SwitcherActions
Definition tunerswitcher.h:33
TunerSwitcher::mute_on
@ mute_on
Definition tunerswitcher.h:34
TunerSwitcher::tuner_on
@ tuner_on
Definition tunerswitcher.h:38
TunerSwitcher::bypass_off
@ bypass_off
Definition tunerswitcher.h:37
TunerSwitcher::bypass_on
@ bypass_on
Definition tunerswitcher.h:36
TunerSwitcher::tuner_off
@ tuner_off
Definition tunerswitcher.h:39
TunerSwitcher::mute_off
@ mute_off
Definition tunerswitcher.h:35
TunerSwitcher::signal_set_state
sigc::signal< void, SwitcherState > & signal_set_state()
Definition tunerswitcher.h:71
TunerSwitcher::on_state_timeout
bool on_state_timeout()
TunerSwitcher::state
SwitcherState state
Definition tunerswitcher.h:49
TunerSwitcher::display
sigc::signal< void, const Glib::ustring &, const Glib::ustring & > display
Definition tunerswitcher.h:43
TunerSwitcher::timeout_conn
sigc::connection timeout_conn
Definition tunerswitcher.h:47
TunerSwitcher::display_preset_key
bool display_preset_key(int idx)
TunerSwitcher::on_note_timeout
bool on_note_timeout()
TunerSwitcher::signal_selection_done
sigc::signal< void, bool > & signal_selection_done()
Definition tunerswitcher.h:72
TunerSwitcher::change_state
void change_state(SwitcherState newstate)
TunerSwitcher::set_state
sigc::signal< void, SwitcherState > set_state
Definition tunerswitcher.h:44
TunerSwitcher::signal_display
sigc::signal< void, const Glib::ustring &, const Glib::ustring & > & signal_display()
Definition tunerswitcher.h:70
TunerSwitcher::get_active
bool get_active()
Definition tunerswitcher.h:66
TunerSwitcher::deactivate
void deactivate()
TunerSwitcher::current_note
int current_note
Definition tunerswitcher.h:48
gx_engine::GxEngine
Definition gx_engine.h:70
gx_preset::GxSettings
Definition gx_preset.h:140
gx_engine::GxEngineState
GxEngineState
Definition gx_modulesequencer.h:301