moved OSC into libardour

git-svn-id: svn://localhost/trunk/ardour2@510 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-05-18 16:44:07 +00:00
parent 69aef2cd91
commit 00a106197a
11 changed files with 113 additions and 81 deletions

View file

@ -390,9 +390,6 @@ libraries['pango'].ParseConfig ('pkg-config --cflags --libs pango')
libraries['libgnomecanvas2'] = LibraryInfo() libraries['libgnomecanvas2'] = LibraryInfo()
libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomecanvas-2.0') libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomecanvas-2.0')
libraries['glade2'] = LibraryInfo()
libraries['glade2'].ParseConfig ('pkg-config --cflags --libs libglade-2.0')
#libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas') #libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
libraries['ardour'] = LibraryInfo (LIBS='ardour', LIBPATH='#libs/ardour', CPPPATH='#libs/ardour') libraries['ardour'] = LibraryInfo (LIBS='ardour', LIBPATH='#libs/ardour', CPPPATH='#libs/ardour')
@ -424,10 +421,9 @@ libraries['usb'] = conf.Finish ()
libraries['lo'] = LibraryInfo () libraries['lo'] = LibraryInfo ()
conf = Configure (libraries['lo']) conf = Configure (libraries['lo'])
if conf.CheckLib ('lo', 'lo_server_new'): if conf.CheckLib ('lo', 'lo_server_new') == False:
have_liblo = True print "liblo does not appear to be installed."
else: exit (0)
have_liblo = False
libraries['lo'] = conf.Finish () libraries['lo'] = conf.Finish ()
@ -486,8 +482,9 @@ if env['SYSLIBS']:
libraries['pangomm'].ParseConfig ('pkg-config --cflags --libs pangomm-1.4') libraries['pangomm'].ParseConfig ('pkg-config --cflags --libs pangomm-1.4')
libraries['libgnomecanvasmm'] = LibraryInfo() libraries['libgnomecanvasmm'] = LibraryInfo()
libraries['libgnomecanvasmm'].ParseConfig ('pkg-config --cflags --libs libgnomecanvasmm-2.6') libraries['libgnomecanvasmm'].ParseConfig ('pkg-config --cflags --libs libgnomecanvasmm-2.6')
libraries['libglademm'] = LibraryInfo()
libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4') # libraries['libglademm'] = LibraryInfo()
# libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
# libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas') # libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
libraries['soundtouch'] = LibraryInfo() libraries['soundtouch'] = LibraryInfo()
@ -535,9 +532,9 @@ else:
libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch', libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch',
LIBPATH='#libs/soundtouch', LIBPATH='#libs/soundtouch',
CPPPATH=['#libs', '#libs/soundtouch']) CPPPATH=['#libs', '#libs/soundtouch'])
libraries['libglademm'] = LibraryInfo(LIBS='libglademm', # libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
LIBPATH='#libs/libglademm', # LIBPATH='#libs/libglademm',
CPPPATH='#libs/libglademm') # CPPPATH='#libs/libglademm')
coredirs = [ coredirs = [
'libs/soundtouch', 'libs/soundtouch',
@ -558,7 +555,6 @@ else:
'libs/gtkmm2/atk', 'libs/gtkmm2/atk',
'libs/gtkmm2/gdk', 'libs/gtkmm2/gdk',
'libs/gtkmm2/gtk', 'libs/gtkmm2/gtk',
'libs/libglademm',
'libs/libgnomecanvasmm', 'libs/libgnomecanvasmm',
# 'libs/flowcanvas', # 'libs/flowcanvas',
'libs/gtkmm2ext', 'libs/gtkmm2ext',
@ -571,8 +567,6 @@ if env['SURFACES']:
surface_subdirs += [ 'libs/surfaces/generic_midi' ] surface_subdirs += [ 'libs/surfaces/generic_midi' ]
if have_libusb: if have_libusb:
surface_subdirs += [ 'libs/surfaces/tranzport' ] surface_subdirs += [ 'libs/surfaces/tranzport' ]
if have_liblo:
surface_subdirs += [ 'libs/surfaces/osc' ]
opts.Save('scache.conf', env) opts.Save('scache.conf', env)
Help(opts.GenerateHelpText(env)) Help(opts.GenerateHelpText(env))
@ -850,9 +844,9 @@ for subdir in coredirs:
SConscript (subdir + '/SConscript') SConscript (subdir + '/SConscript')
for sublistdir in [subdirs, gtk_subdirs, surface_subdirs]: for sublistdir in [subdirs, gtk_subdirs, surface_subdirs]:
for subdir in sublistdir: for subdir in sublistdir:
SConscript (subdir + '/SConscript') SConscript (subdir + '/SConscript')
# cleanup # cleanup
env.Clean ('scrub', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log']) env.Clean ('scrub', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log'])

View file

@ -54,6 +54,7 @@ ladspa_plugin.cc
location.cc location.cc
mtc_slave.cc mtc_slave.cc
named_selection.cc named_selection.cc
osc.cc
panner.cc panner.cc
pcm_utils.cc pcm_utils.cc
playlist.cc playlist.cc
@ -184,7 +185,7 @@ ardour.Merge ([
libraries['pbd3'], libraries['pbd3'],
libraries['soundtouch'], libraries['soundtouch'],
libraries['midi++2'], libraries['midi++2'],
libraries['xslt'], libraries['lo'],
]) ])

View file

@ -42,6 +42,9 @@ namespace MIDI {
namespace ARDOUR { namespace ARDOUR {
class AudioEngine; class AudioEngine;
class OSC;
extern OSC* osc;
static const jack_nframes_t max_frames = JACK_MAX_FRAMES; static const jack_nframes_t max_frames = JACK_MAX_FRAMES;

View file

@ -36,7 +36,8 @@ class BasicUI {
void toggle_all_rec_enables (); void toggle_all_rec_enables ();
protected: protected:
ARDOUR::Session& session; BasicUI ();
ARDOUR::Session* session;
}; };
#endif /* __ardour_basic_ui_h__ */ #endif /* __ardour_basic_ui_h__ */

View file

@ -39,6 +39,8 @@ CONFIG_VARIABLE(uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2
CONFIG_VARIABLE(SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat) CONFIG_VARIABLE(SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat)
CONFIG_VARIABLE(HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE) CONFIG_VARIABLE(HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE)
CONFIG_VARIABLE(bool, use_tranzport, "use-tranzport", false) CONFIG_VARIABLE(bool, use_tranzport, "use-tranzport", false)
CONFIG_VARIABLE(uint32_t, osc_port, "osc-port", 3819)
CONFIG_VARIABLE(bool, use_osc, "use-osc", true)
/* these variables have custom set() methods */ /* these variables have custom set() methods */

View file

@ -27,7 +27,12 @@
using namespace ARDOUR; using namespace ARDOUR;
BasicUI::BasicUI (Session& s) BasicUI::BasicUI (Session& s)
: session (s) : session (&s)
{
}
BasicUI::BasicUI ()
: session (0)
{ {
} }
@ -39,12 +44,12 @@ BasicUI::~BasicUI ()
void void
BasicUI::loop_toggle () BasicUI::loop_toggle ()
{ {
if (session.get_auto_loop()) { if (session->get_auto_loop()) {
session.request_auto_loop (false); session->request_auto_loop (false);
} else { } else {
session.request_auto_loop (true); session->request_auto_loop (true);
if (!session.transport_rolling()) { if (!session->transport_rolling()) {
session.request_transport_speed (1.0); session->request_transport_speed (1.0);
} }
} }
} }
@ -52,146 +57,146 @@ BasicUI::loop_toggle ()
void void
BasicUI::goto_start () BasicUI::goto_start ()
{ {
session.goto_start (); session->goto_start ();
} }
void void
BasicUI::goto_end () BasicUI::goto_end ()
{ {
session.goto_end (); session->goto_end ();
} }
void void
BasicUI::add_marker () BasicUI::add_marker ()
{ {
jack_nframes_t when = session.audible_frame(); jack_nframes_t when = session->audible_frame();
session.locations()->add (new Location (when, when, _("unnamed"), Location::IsMark)); session->locations()->add (new Location (when, when, _("unnamed"), Location::IsMark));
} }
void void
BasicUI::rewind () BasicUI::rewind ()
{ {
session.request_transport_speed (-2.0f); session->request_transport_speed (-2.0f);
} }
void void
BasicUI::ffwd () BasicUI::ffwd ()
{ {
session.request_transport_speed (2.0f); session->request_transport_speed (2.0f);
} }
void void
BasicUI::transport_stop () BasicUI::transport_stop ()
{ {
session.request_transport_speed (0.0); session->request_transport_speed (0.0);
} }
void void
BasicUI::transport_play () BasicUI::transport_play ()
{ {
bool rolling = session.transport_rolling (); bool rolling = session->transport_rolling ();
if (session.get_auto_loop()) { if (session->get_auto_loop()) {
session.request_auto_loop (false); session->request_auto_loop (false);
} }
if (session.get_play_range ()) { if (session->get_play_range ()) {
session.request_play_range (false); session->request_play_range (false);
} }
if (rolling) { if (rolling) {
session.request_locate (session.last_transport_start(), true); session->request_locate (session->last_transport_start(), true);
} }
session.request_transport_speed (1.0f); session->request_transport_speed (1.0f);
} }
void void
BasicUI::rec_enable_toggle () BasicUI::rec_enable_toggle ()
{ {
switch (session.record_status()) { switch (session->record_status()) {
case Session::Disabled: case Session::Disabled:
if (session.ntracks() == 0) { if (session->ntracks() == 0) {
// string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu."); // string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu.");
// MessageDialog msg (*editor, txt); // MessageDialog msg (*editor, txt);
// msg.run (); // msg.run ();
return; return;
} }
session.maybe_enable_record (); session->maybe_enable_record ();
break; break;
case Session::Recording: case Session::Recording:
case Session::Enabled: case Session::Enabled:
session.disable_record (true); session->disable_record (true);
} }
} }
void void
BasicUI::save_state () BasicUI::save_state ()
{ {
session.save_state (""); session->save_state ("");
} }
void void
BasicUI::prev_marker () BasicUI::prev_marker ()
{ {
Location *location = session.locations()->first_location_before (session.transport_frame()); Location *location = session->locations()->first_location_before (session->transport_frame());
if (location) { if (location) {
session.request_locate (location->start(), session.transport_rolling()); session->request_locate (location->start(), session->transport_rolling());
} else { } else {
session.goto_start (); session->goto_start ();
} }
} }
void void
BasicUI::next_marker () BasicUI::next_marker ()
{ {
Location *location = session.locations()->first_location_after (session.transport_frame()); Location *location = session->locations()->first_location_after (session->transport_frame());
if (location) { if (location) {
session.request_locate (location->start(), session.transport_rolling()); session->request_locate (location->start(), session->transport_rolling());
} else { } else {
session.request_locate (session.current_end_frame()); session->request_locate (session->current_end_frame());
} }
} }
void void
BasicUI::set_transport_speed (float speed) BasicUI::set_transport_speed (float speed)
{ {
session.request_transport_speed (speed); session->request_transport_speed (speed);
} }
void void
BasicUI::undo () BasicUI::undo ()
{ {
session.undo (1); session->undo (1);
} }
void void
BasicUI::redo () BasicUI::redo ()
{ {
session.redo (1); session->redo (1);
} }
void void
BasicUI::toggle_all_rec_enables () BasicUI::toggle_all_rec_enables ()
{ {
if (session.get_record_enabled()) { if (session->get_record_enabled()) {
session.record_disenable_all (); session->record_disenable_all ();
} else { } else {
session.record_enable_all (); session->record_enable_all ();
} }
} }
void void
BasicUI::toggle_punch_in () BasicUI::toggle_punch_in ()
{ {
session.set_punch_in (!session.get_punch_in()); session->set_punch_in (!session->get_punch_in());
} }
void void
BasicUI::toggle_punch_out () BasicUI::toggle_punch_out ()
{ {
session.set_punch_out (!session.get_punch_out()); session->set_punch_out (!session->get_punch_out());
} }

View file

@ -46,7 +46,7 @@ ControlProtocol::~ControlProtocol ()
void void
ControlProtocol::next_track (uint32_t initial_id) ControlProtocol::next_track (uint32_t initial_id)
{ {
uint32_t limit = session.nroutes(); uint32_t limit = session->nroutes();
Route* cr = route_table[0]; Route* cr = route_table[0];
uint32_t id; uint32_t id;
@ -63,7 +63,7 @@ ControlProtocol::next_track (uint32_t initial_id)
} }
while (id < limit) { while (id < limit) {
if ((cr = session.route_by_remote_id (id)) != 0) { if ((cr = session->route_by_remote_id (id)) != 0) {
break; break;
} }
id++; id++;
@ -72,7 +72,7 @@ ControlProtocol::next_track (uint32_t initial_id)
if (id == limit) { if (id == limit) {
id = 0; id = 0;
while (id != initial_id) { while (id != initial_id) {
if ((cr = session.route_by_remote_id (id)) != 0) { if ((cr = session->route_by_remote_id (id)) != 0) {
break; break;
} }
id++; id++;
@ -85,7 +85,7 @@ ControlProtocol::next_track (uint32_t initial_id)
void void
ControlProtocol::prev_track (uint32_t initial_id) ControlProtocol::prev_track (uint32_t initial_id)
{ {
uint32_t limit = session.nroutes() - 1; uint32_t limit = session->nroutes() - 1;
Route* cr = route_table[0]; Route* cr = route_table[0];
uint32_t id; uint32_t id;
@ -96,13 +96,13 @@ ControlProtocol::prev_track (uint32_t initial_id)
} }
if (id == 0) { if (id == 0) {
id = session.nroutes() - 1; id = session->nroutes() - 1;
} else { } else {
id--; id--;
} }
while (id >= 0) { while (id >= 0) {
if ((cr = session.route_by_remote_id (id)) != 0) { if ((cr = session->route_by_remote_id (id)) != 0) {
break; break;
} }
id--; id--;
@ -111,7 +111,7 @@ ControlProtocol::prev_track (uint32_t initial_id)
if (id < 0) { if (id < 0) {
id = limit; id = limit;
while (id > initial_id) { while (id > initial_id) {
if ((cr = session.route_by_remote_id (id)) != 0) { if ((cr = session->route_by_remote_id (id)) != 0) {
break; break;
} }
id--; id--;

View file

@ -47,6 +47,7 @@
#include <ardour/utils.h> #include <ardour/utils.h>
#include <ardour/session.h> #include <ardour/session.h>
#include <ardour/control_protocol_manager.h> #include <ardour/control_protocol_manager.h>
#include <ardour/osc.h>
#include <ardour/mix.h> #include <ardour/mix.h>
@ -58,6 +59,7 @@
ARDOUR::Configuration* ARDOUR::Config = 0; ARDOUR::Configuration* ARDOUR::Config = 0;
ARDOUR::AudioLibrary* ARDOUR::Library = 0; ARDOUR::AudioLibrary* ARDOUR::Library = 0;
ARDOUR::OSC* ARDOUR::osc = 0;
using namespace ARDOUR; using namespace ARDOUR;
using namespace std; using namespace std;
@ -72,6 +74,22 @@ Change ARDOUR::PositionChanged = ARDOUR::new_change ();
Change ARDOUR::NameChanged = ARDOUR::new_change (); Change ARDOUR::NameChanged = ARDOUR::new_change ();
Change ARDOUR::BoundsChanged = Change (0); // see init(), below Change ARDOUR::BoundsChanged = Change (0); // see init(), below
static int
setup_osc ()
{
/* no real cost to creating this object, and it avoids
conditionals anywhere that uses it
*/
osc = new OSC (Config->get_osc_port());
if (Config->get_use_osc ()) {
return osc->start ();
} else {
return 0;
}
}
static int static int
setup_midi () setup_midi ()
{ {
@ -180,6 +198,10 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization, void (*s
return -1; return -1;
} }
if (setup_osc ()) {
return -1;
}
#ifdef VST_SUPPORT #ifdef VST_SUPPORT
if (Config->get_use_vst() && fst_init (sighandler)) { if (Config->get_use_vst() && fst_init (sighandler)) {
return -1; return -1;

View file

@ -64,7 +64,7 @@
#include <ardour/crossfade.h> #include <ardour/crossfade.h>
#include <ardour/playlist.h> #include <ardour/playlist.h>
#include <ardour/click.h> #include <ardour/click.h>
#include <ardour/timestamps.h> #include <ardour/osc.h>
#include "i18n.h" #include "i18n.h"
@ -794,6 +794,10 @@ Session::when_engine_running ()
_engine.set_session (this); _engine.set_session (this);
/* and to OSC */
osc->set_session (*this);
_state_of_the_state = Clean; _state_of_the_state = Clean;
DirtyChanged (); /* EMIT SIGNAL */ DirtyChanged (); /* EMIT SIGNAL */

View file

@ -31,7 +31,7 @@ GenericMidiControlProtocol::set_active (bool yn)
void void
GenericMidiControlProtocol::port_change () GenericMidiControlProtocol::port_change ()
{ {
_port = session.midi_port (); _port = session->midi_port ();
} }
void void

View file

@ -297,14 +297,14 @@ TranzportControlProtocol::show_meter ()
void void
TranzportControlProtocol::show_transport_time () TranzportControlProtocol::show_transport_time ()
{ {
jack_nframes_t where = session.transport_frame(); jack_nframes_t where = session->transport_frame();
if (where != last_where) { if (where != last_where) {
char buf[5]; char buf[5];
SMPTE_Time smpte; SMPTE_Time smpte;
session.smpte_time (where, smpte); session->smpte_time (where, smpte);
if (smpte.negative) { if (smpte.negative) {
sprintf (buf, "-%02ld:", smpte.hours); sprintf (buf, "-%02ld:", smpte.hours);
@ -698,25 +698,25 @@ TranzportControlProtocol::update_state ()
/* global */ /* global */
if (session.get_auto_loop()) { if (session->get_auto_loop()) {
pending_lights[LightLoop] = true; pending_lights[LightLoop] = true;
} else { } else {
pending_lights[LightLoop] = false; pending_lights[LightLoop] = false;
} }
if (session.get_punch_in() || session.get_punch_out()) { if (session->get_punch_in() || session->get_punch_out()) {
pending_lights[LightPunch] = true; pending_lights[LightPunch] = true;
} else { } else {
pending_lights[LightPunch] = false; pending_lights[LightPunch] = false;
} }
if (session.get_record_enabled()) { if (session->get_record_enabled()) {
pending_lights[LightRecord] = true; pending_lights[LightRecord] = true;
} else { } else {
pending_lights[LightRecord] = false; pending_lights[LightRecord] = false;
} }
if (session.soloing ()) { if (session->soloing ()) {
pending_lights[LightAnysolo] = true; pending_lights[LightAnysolo] = true;
} else { } else {
pending_lights[LightAnysolo] = false; pending_lights[LightAnysolo] = false;
@ -1037,7 +1037,7 @@ TranzportControlProtocol::button_event_tracksolo_press (bool shifted)
} }
if (shifted) { if (shifted) {
session.set_all_solo (!session.soloing()); session->set_all_solo (!session->soloing());
} else { } else {
route_set_soloed (0, !route_get_soloed (0)); route_set_soloed (0, !route_get_soloed (0));
} }
@ -1357,16 +1357,16 @@ void
TranzportControlProtocol::shuttle () TranzportControlProtocol::shuttle ()
{ {
if (_datawheel < WheelDirectionThreshold) { if (_datawheel < WheelDirectionThreshold) {
if (session.transport_speed() < 0) { if (session->transport_speed() < 0) {
session.request_transport_speed (1.0); session->request_transport_speed (1.0);
} else { } else {
session.request_transport_speed (session.transport_speed() + 0.1); session->request_transport_speed (session->transport_speed() + 0.1);
} }
} else { } else {
if (session.transport_speed() > 0) { if (session->transport_speed() > 0) {
session.request_transport_speed (-1.0); session->request_transport_speed (-1.0);
} else { } else {
session.request_transport_speed (session.transport_speed() - 0.1); session->request_transport_speed (session->transport_speed() - 0.1);
} }
} }
} }