make OSC off by default, and add menu item to control it

git-svn-id: svn://localhost/ardour2/trunk@1594 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-03-15 13:25:01 +00:00
parent a1960ba3c0
commit 6fadaae2cb
6 changed files with 37 additions and 4 deletions

View file

@ -342,6 +342,7 @@
<menuitem action='SendMMC'/>
<menuitem action='UseMMC'/>
<separator/>
<menuitem action='UseOSC'/>
<menuitem action='StopPluginsWithTransport'/>
<menuitem action='DoNotRunPluginsWhileRecording'/>
<menuitem action='LatchedRecordEnable'/>

View file

@ -658,6 +658,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void toggle_use_midi_control();
void toggle_send_mtc ();
void toggle_use_osc ();
void set_input_auto_connect (ARDOUR::AutoConnectOption);
void set_output_auto_connect (ARDOUR::AutoConnectOption);
void set_solo_model (ARDOUR::SoloModel);

View file

@ -393,6 +393,8 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (option_actions, X_("UseMIDIcontrol"), _("Use MIDI control"), mem_fun (*this, &ARDOUR_UI::toggle_use_midi_control));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (option_actions, X_("UseOSC"), _("Use OSC"), mem_fun (*this, &ARDOUR_UI::toggle_use_osc));
ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport));
ActionManager::register_toggle_action (option_actions, X_("VerifyRemoveLastCapture"), _("Verify remove last capture"), mem_fun (*this, &ARDOUR_UI::toggle_VerifyRemoveLastCapture));
ActionManager::register_toggle_action (option_actions, X_("StopRecordingOnXrun"), _("Stop recording on xrun"), mem_fun (*this, &ARDOUR_UI::toggle_StopRecordingOnXrun));

View file

@ -24,6 +24,7 @@
#include <ardour/configuration.h>
#include <ardour/session.h>
#include <ardour/osc.h>
#include <ardour/audioengine.h>
#include "ardour_ui.h"
@ -62,6 +63,12 @@ ARDOUR_UI::toggle_use_mmc ()
ActionManager::toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control);
}
void
ARDOUR_UI::toggle_use_osc ()
{
ActionManager::toggle_config_state ("options", "UseOSC", &Configuration::set_use_osc, &Configuration::get_use_osc);
}
void
ARDOUR_UI::toggle_use_midi_control ()
{
@ -844,6 +851,16 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
ActionManager::map_some_state ("options", "SendMMC", &Configuration::get_send_mmc);
} else if (PARAM_IS ("use-osc")) {
if (Config->get_use_osc()) {
osc->start ();
} else {
osc->stop ();
}
ActionManager::map_some_state ("options", "UseOSC", &Configuration::get_use_osc);
} else if (PARAM_IS ("mmc-control")) {
ActionManager::map_some_state ("options", "UseMMC", &Configuration::get_mmc_control);
} else if (PARAM_IS ("midi-feedback")) {

View file

@ -38,7 +38,7 @@ CONFIG_VARIABLE (HeaderFormat, native_file_header_format, "native-file-header-f
/* OSC */
CONFIG_VARIABLE (uint32_t, osc_port, "osc-port", 3819)
CONFIG_VARIABLE (bool, use_osc, "use-osc", true)
CONFIG_VARIABLE (bool, use_osc, "use-osc", false)
/* crossfades */

View file

@ -58,6 +58,11 @@ int
OSC::start ()
{
char tmpstr[255];
if (_osc_server) {
/* already started */
return 0;
}
for (int j=0; j < 20; ++j) {
snprintf(tmpstr, sizeof(tmpstr), "%d", _port);
@ -108,16 +113,22 @@ OSC::start ()
int
OSC::stop ()
{
if (_osc_server == 0) {
/* already stopped */
return 0;
}
// stop server thread
terminate_osc_thread();
lo_server_free (_osc_server);
_osc_server = 0;
if (!_osc_unix_socket_path.empty()) {
// unlink it
unlink(_osc_unix_socket_path.c_str());
}
// stop server thread
terminate_osc_thread();
return 0;
}