Implementing MIDI Device Connection Control

[git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 459708]
This commit is contained in:
Valeriy Kamyshniy 2014-05-12 09:21:16 -05:00
parent 8b9d31f44b
commit e48ec55893
10 changed files with 193 additions and 49 deletions

View file

@ -27,8 +27,9 @@ DeviceConnectionControl::DeviceConnectionControl (std::string device_capture_nam
, _active_off_button (NULL)
, _name_label (NULL)
, _track_name_label (NULL)
, _number_label (NULL)
{
build_layout("device_capture_connection_conrol.xml");
build_layout("device_capture_control.xml");
_active_on_button = &_children.get_waves_button ("capture_on_button");
_active_off_button = &_children.get_waves_button ("capture_off_button");
_name_label = &_children.get_label ("capture_name_label");
@ -44,8 +45,9 @@ DeviceConnectionControl::DeviceConnectionControl (std::string device_playback_na
, _active_off_button (NULL)
, _name_label (NULL)
, _track_name_label (NULL)
, _number_label (NULL)
{
build_layout("device_playback_connection_conrol.xml");
build_layout("device_playback_control.xml");
_active_on_button = &_children.get_waves_button ("playback_on_button");
_active_off_button = &_children.get_waves_button ("playback_off_button");
_name_label = &_children.get_label ("playback_name_label");
@ -53,15 +55,54 @@ DeviceConnectionControl::DeviceConnectionControl (std::string device_playback_na
init(device_playback_name, active, playback_number);
}
DeviceConnectionControl::DeviceConnectionControl (std::string midi_capture_name, bool active)
: Gtk::Layout()
, _active_on_button (NULL)
, _active_off_button (NULL)
, _name_label (NULL)
, _track_name_label (NULL)
, _number_label (NULL)
{
build_layout("midi_capture_control.xml");
_active_on_button = &_children.get_waves_button ("capture_on_button");
_active_off_button = &_children.get_waves_button ("capture_off_button");
_name_label = &_children.get_label ("capture_name_label");
init(midi_capture_name, active, NoNumber);
}
DeviceConnectionControl::DeviceConnectionControl (bool active)
: Gtk::Layout()
, _active_on_button (NULL)
, _active_off_button (NULL)
, _name_label (NULL)
, _track_name_label (NULL)
, _number_label (NULL)
{
build_layout("midi_playback_control.xml");
_active_on_button = &_children.get_waves_button ("playback_on_button");
_active_off_button = &_children.get_waves_button ("playback_off_button");
init("", active, NoNumber);
}
void DeviceConnectionControl::init(std::string name, bool active, uint16_t number, std::string track_name)
{
_active_on_button->signal_clicked.connect (sigc::mem_fun (*this, &DeviceConnectionControl::on_active_on));
_active_off_button->signal_clicked.connect (sigc::mem_fun (*this, &DeviceConnectionControl::on_active_off));
_name_label->set_text (name);
_number_label->set_text(PBD::to_string (number, std::dec));
if (_name_label != NULL) {
_name_label->set_text (name);
}
if (_number_label != NULL) {
_number_label->set_text(PBD::to_string (number, std::dec));
}
if (_track_name_label != NULL) {
_track_name_label->set_text (track_name);
}
_active_on_button->set_active (active);
_active_off_button->set_active (!active);
}
@ -86,11 +127,13 @@ DeviceConnectionControl::build_layout (std::string file_name)
void
DeviceConnectionControl::set_number (uint16_t number)
{
if (number == DeviceConnectionControl::NoNumber) {
_number_label->get_parent()->hide ();
} else {
_number_label->get_parent()->show ();
_number_label->set_text(PBD::to_string (number, std::dec));
if (_number_label != NULL) {
if (number == NoNumber) {
_number_label->get_parent()->hide ();
} else {
_number_label->get_parent()->show ();
_number_label->set_text(PBD::to_string (number, std::dec));
}
}
}

View file

@ -35,6 +35,9 @@ class DeviceConnectionControl : public Gtk::Layout
DeviceConnectionControl (std::string device_capture_name, bool active, uint16_t capture_number, std::string track_name);
DeviceConnectionControl (std::string device_playback_name, bool active, uint16_t playback_number);
DeviceConnectionControl (std::string midi_capture_name, bool active);
DeviceConnectionControl (bool active);
bool build_layout (std::string file_name);
void set_number (uint16_t number);
void set_active (bool active);

View file

@ -63,6 +63,8 @@ TracksControlPanel::TracksControlPanel ()
: WavesDialog ("tracks_preferences.xml")
, _device_capture_list (named_children ().get_vbox("device_capture_list"))
, _device_playback_list (named_children ().get_vbox("device_playback_list"))
, _midi_capture_list (named_children ().get_vbox("midi_capture_list"))
, _midi_playback_list (named_children ().get_vbox("midi_playback_list"))
, _audio_settings_layout (named_children ().get_layout ("audio_settings_layout"))
, _midi_settings_layout (named_children ().get_layout ("midi_settings_layout"))
, _session_settings_layout (named_children ().get_layout ("session_settings_layout"))

View file

@ -42,6 +42,8 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
private:
Gtk::VBox& _device_capture_list;
Gtk::VBox& _device_playback_list;
Gtk::VBox& _midi_capture_list;
Gtk::VBox& _midi_playback_list;
Gtk::Layout& _audio_settings_layout;
Gtk::Layout& _midi_settings_layout;
Gtk::Layout& _session_settings_layout;

View file

@ -70,8 +70,6 @@ TracksControlPanel::init ()
_buffer_size_combo.signal_changed().connect (sigc::mem_fun (*this, &TracksControlPanel::buffer_size_changed));
populate_engine_combo ();
_midi_settings_layout.hide ();
_session_settings_layout.hide ();
_audio_settings_tab_button.set_active(true);
_multi_out_button.set_active(ARDOUR::Config->get_output_auto_connect() & ARDOUR::AutoConnectPhysical);
_stereo_out_button.set_active(ARDOUR::Config->get_output_auto_connect() & ARDOUR::AutoConnectMaster);
@ -93,6 +91,22 @@ DeviceConnectionControl& TracksControlPanel::add_device_playback_control(std::st
return playback_control;
}
DeviceConnectionControl& TracksControlPanel::add_midi_capture_control(std::string device_capture_name, bool active)
{
DeviceConnectionControl &capture_control = *manage (new DeviceConnectionControl(device_capture_name, active));
_midi_capture_list.pack_start (capture_control, false, false);
capture_control.signal_active_changed.connect (sigc::mem_fun (*this, &TracksControlPanel::on_midi_capture_active_changed));
return capture_control;
}
DeviceConnectionControl& TracksControlPanel::add_midi_playback_control(bool active)
{
DeviceConnectionControl &playback_control = *manage (new DeviceConnectionControl(active));
_midi_playback_list.pack_start (playback_control, false, false);
playback_control.signal_active_changed.connect(sigc::mem_fun (*this, &TracksControlPanel::on_midi_playback_active_changed));
return playback_control;
}
void
TracksControlPanel::populate_engine_combo()
{
@ -225,11 +239,16 @@ TracksControlPanel::on_control_panel(WavesButton*)
number++;
active = !active;
std::string name = string_compose (_("Input %1"), number);
std::string name = string_compose (_("Audio Capture %1"), number);
add_device_capture_control (name, active, number, name);
name = string_compose (_("Output %1"), number);
name = string_compose (_("Audio Playback Output %1"), number);
add_device_playback_control (name, active, number);
name = string_compose (_("Midi Capture %1"), number);
add_midi_capture_control (name, active);
add_midi_playback_control (active);
}
void TracksControlPanel::engine_changed ()
@ -523,6 +542,16 @@ void TracksControlPanel::on_playback_active_changed(DeviceConnectionControl* pla
}
void TracksControlPanel::on_midi_capture_active_changed(DeviceConnectionControl* capture_control, bool active)
{
}
void TracksControlPanel::on_midi_playback_active_changed(DeviceConnectionControl* playback_control, bool active)
{
}
std::string
TracksControlPanel::bufsize_as_string (uint32_t sz)
{

View file

@ -73,6 +73,8 @@
virtual void init();
DeviceConnectionControl& add_device_capture_control(std::string device_capture_name, bool active, uint16_t capture_number, std::string track_name);
DeviceConnectionControl& add_device_playback_control(std::string device_playback_name, bool active, uint16_t playback_number);
DeviceConnectionControl& add_midi_capture_control(std::string device_capture_name, bool active);
DeviceConnectionControl& add_midi_playback_control(bool active);
void on_audio_settings (WavesButton*);
void on_midi_settings (WavesButton*);
@ -85,6 +87,8 @@
void on_apply(WavesButton*);
void on_capture_active_changed (DeviceConnectionControl* capture_control, bool active);
void on_playback_active_changed (DeviceConnectionControl* playback_control, bool active);
void on_midi_capture_active_changed (DeviceConnectionControl* capture_control, bool active);
void on_midi_playback_active_changed (DeviceConnectionControl* playback_control, bool active);
void engine_changed ();
void device_changed ();

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Layout bgnormal="#565656" width="361" height="20">
<style name="generic_control" font ="Arial 10"/>
<Layout bgnormal="#797979" x="0" y="0" width="291" height="19">
<Label style="generic_control"
id="capture_name_label"
text="-"
fgnormal="#000000"
x="7" y="3"/>
</Layout>
<Button id="capture_on_button"
text="ON"
style="generic_control"
fgnormal="#FFFFFF"
bgnormal="#606060"
fgactive="#FFFFFF"
bgactive="#1CA3B3"
fghover="#FFFFFF"
bghover="#808080"
borderwidth="0 0 0 0"
x="296" y="0" width="30" height="19"/>
<Button id="capture_off_button"
text="OFF"
style="generic_control"
fgnormal="#FFFFFF"
bgnormal="#606060"
fgactive="#FFFFFF"
bgactive="#FC3334"
fghover="#FFFFFF"
bghover="#808080"
borderwidth="0 0 0 0"
x="326" y="0" width="30" height="19"/>
</Layout>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<Layout bgnormal="#565656" width="60" height="20">
<style name="generic_control" font ="Arial 10"/>
<Button id="playback_on_button"
text="ON"
style="generic_control"
fgnormal="#FFFFFF"
bgnormal="#606060"
fgactive="#FFFFFF"
bgactive="#1CA3B3"
fghover="#FFFFFF"
bghover="#808080"
borderwidth="0 0 0 0"
x="0" y="0" width="30" height="19"/>
<Button id="playback_off_button"
text="OFF"
style="generic_control"
fgnormal="#FFFFFF"
bgnormal="#606060"
fgactive="#FFFFFF"
bgactive="#FC3334"
fghover="#FFFFFF"
bghover="#808080"
borderwidth="0 0 0 0"
x="30" y="0" width="30" height="19"/>
</Layout>

View file

@ -45,7 +45,44 @@
font ="Arial Bold 10"
x="2" y="134" width="107" height="65"/>
<Layout id="audio_settings_layout" bgnormal="#000000" x="113" y="1" width="505" height="558">
<Layout bgnormal="#565656" x="113" y="559" width="505" height="63">
<Button
id="ok_button"
text="OK"
style="generic_button"
x="275" y="18" width="71" height="28"/>
<Button
id="cancel_button"
text="CANCEL"
style="generic_button"
x="347" y="18" width="71" height="28"/>
<Button
id="apply_button"
text="APPLY"
style="generic_button"
x="419" y="18" width="71" height="28"/>
</Layout>
<Layout id="midi_settings_layout" bgnormal="#565656" x="113" y="1" width="505" height="557" visible="true">
<Layout bgnormal="#000000" x="21" y="20" width="291" height="19">
<Label style="generic_control" text="MIDI PORTS" fgnormal="#ffffff" font ="Arial Bold 10" x="7" y="3"/>
</Layout>
<Layout bgnormal="#797979" x="317" y="20" width="60" height="19">
<Label style="generic_control" text="INPUT" fgnormal="#ffffff" font="Arial Bold 10" x="7" y="3"/>
</Layout>
<Layout bgnormal="#797979" x="382" y="20" width="60" height="19">
<Label style="generic_control" text="OUTPUT" fgnormal="#ffffff" font="Arial Bold 10" x="7" y="3"/>
</Layout>
<Layout bgnormal="#000000" x="447" y="20" width="14" height="19" />
<ScrolledWindow x="21" y="62" bgnormal="#565656" width="440" height="218" hscroll="never" vscroll="auto">
<HBox>
<VBox id="midi_capture_list">
</VBox>
<VBox id="midi_playback_list">
</VBox>
</HBox>
</ScrolledWindow>
</Layout>
<Layout id="audio_settings_layout" bgnormal="#000000" x="113" y="1" width="505" height="558" visible="true">
<Layout bgnormal="#565656" x="0" y="0" width="505" height="100">
<Label style="generic_control" text="AUDIO ENGINE" x="12" y="17"/>
<ComboBoxText style="generic_control" id="engine_combo" x="97" y="12" width="126" height="20"/>
@ -163,12 +200,6 @@
</VBox>
</HBox>
</ScrolledWindow>
<!--VBox x="14" y="62">
<Layout bgnormal="#565656" width="475" height="800">
<Layout bgnormal="#862579" x="0" y="0" width="3" height="299"/>
<Layout bgnormal="#27ae36" x="274" y="0" width="3" height="299"/>
</Layout>
</VBox-->
<Button
id="name_track_after_driver_button"
text="NAME TRACK\nAFTER DRIVER"
@ -191,35 +222,6 @@
x="345" y="369" width="52" height="39"/>
</Layout>
</Layout>
<Layout bgnormal="#565656" x="113" y="559" width="505" height="63">
<Button
id="ok_button"
text="OK"
style="generic_button"
x="275" y="18" width="71" height="28"/>
<Button
id="cancel_button"
text="CANCEL"
style="generic_button"
x="347" y="18" width="71" height="28"/>
<Button
id="apply_button"
text="APPLY"
style="generic_button"
x="419" y="18" width="71" height="28"/>
</Layout>
<Layout id="midi_settings_layout" bgnormal="#565656" x="113" y="1" width="505" height="557" visible="false">
<Layout bgnormal="#000000" x="21" y="20" width="291" height="19">
<Label style="generic_control" text="MIDI PORTS" fgnormal="#ffffff" font ="Arial Bold 10" x="7" y="3"/>
</Layout>
<Layout bgnormal="#797979" x="317" y="20" width="60" height="19">
<Label style="generic_control" text="INPUT" fgnormal="#ffffff" font="Arial Bold 10" x="7" y="3"/>
</Layout>
<Layout bgnormal="#797979" x="382" y="20" width="60" height="19">
<Label style="generic_control" text="OUTPUT" fgnormal="#ffffff" font="Arial Bold 10" x="7" y="3"/>
</Layout>
</Layout>
<Layout id="session_settings_layout" bgnormal="#565656" x="113" y="1" width="505" height="557" visible="false">
<!--