mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
breakout control protocol code into LGPL library; fix panner buttons even more than nick did, plus some other bits and pieces
git-svn-id: svn://localhost/trunk/ardour2@522 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a222c19737
commit
2fba6d0925
25 changed files with 414 additions and 142 deletions
11
SConstruct
11
SConstruct
|
|
@ -392,6 +392,13 @@ libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomeca
|
|||
|
||||
#libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
|
||||
|
||||
# The Ardour Control Protocol Library
|
||||
|
||||
libraries['ardour_cp'] = LibraryInfo (LIBS='ardour_cp', LIBPATH='#libs/surfaces/control_protocol',
|
||||
CPPPATH='#libs/surfaces/control_protocol')
|
||||
|
||||
# The Ardour backend/engine
|
||||
|
||||
libraries['ardour'] = LibraryInfo (LIBS='ardour', LIBPATH='#libs/ardour', CPPPATH='#libs/ardour')
|
||||
libraries['midi++2'] = LibraryInfo (LIBS='midi++', LIBPATH='#libs/midi++2', CPPPATH='#libs/midi++2')
|
||||
libraries['pbd3'] = LibraryInfo (LIBS='pbd', LIBPATH='#libs/pbd3', CPPPATH='#libs/pbd3')
|
||||
|
|
@ -564,9 +571,11 @@ else:
|
|||
surface_subdirs = []
|
||||
|
||||
if env['SURFACES']:
|
||||
surface_subdirs += [ 'libs/surfaces/generic_midi' ]
|
||||
surface_subdirs += [ 'libs/surfaces/control_protocol', 'libs/surfaces/generic_midi' ]
|
||||
if have_libusb:
|
||||
surface_subdirs += [ 'libs/surfaces/tranzport' ]
|
||||
if os.access ('libs/surfaces/sony9pin', os.F_OK):
|
||||
surface_subdirs += [ 'libs/surfaces/sony9pin' ]
|
||||
|
||||
opts.Save('scache.conf', env)
|
||||
Help(opts.GenerateHelpText(env))
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ gtkardour.Append(POTFILE=domain + '.pot')
|
|||
|
||||
gtkardour.Merge ([
|
||||
libraries['ardour'],
|
||||
libraries['ardour_cp'],
|
||||
libraries['gtkmm2ext'],
|
||||
# libraries['flowcanvas'],
|
||||
libraries['midi++2'],
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
export ARDOUR_PATH=./glade:./pixmaps:.:..
|
||||
|
||||
export LD_LIBRARY_PATH=../libs/ardour:../libs/midi++2:../libs/pbd3:../libs/soundtouch:../libs/gtkmm2ext:../libs/sigc++2:../libs/glibmm2:../libs/gtkmm2/atk:../libs/gtkmm2/pango:../libs/gtkmm2/gdk:../libs/gtkmm2/gtk:../libs/libgnomecanvasmm:../libs/libglademm:$LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH=../libs/surfaces/control_protocol:../libs/ardour:../libs/midi++2:../libs/pbd3:../libs/soundtouch:../libs/gtkmm2ext:../libs/sigc++2:../libs/glibmm2:../libs/gtkmm2/atk:../libs/gtkmm2/pango:../libs/gtkmm2/gdk:../libs/gtkmm2/gtk:../libs/libgnomecanvasmm:../libs/libglademm:$LD_LIBRARY_PATH
|
||||
|
||||
# DYLD_LIBRARY_PATH is for darwin.
|
||||
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@
|
|||
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/control_protocol_manager.h>
|
||||
#include <ardour/control_protocol.h>
|
||||
|
||||
#include "control_protocol.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@
|
|||
#include <ardour/session_route.h>
|
||||
#include <ardour/tempo.h>
|
||||
#include <ardour/utils.h>
|
||||
#include <ardour/control_protocol.h>
|
||||
|
||||
#include "control_protocol.h"
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "editor.h"
|
||||
|
|
|
|||
|
|
@ -123,9 +123,9 @@ PannerUI::PannerUI (IO& io, Session& s)
|
|||
(mem_fun(*this, &PannerUI::panning_link_direction_clicked));
|
||||
|
||||
panning_link_button.signal_button_press_event().connect
|
||||
(mem_fun(*this, &PannerUI::panning_link_button_press));
|
||||
(mem_fun(*this, &PannerUI::panning_link_button_press), false);
|
||||
panning_link_button.signal_button_release_event().connect
|
||||
(mem_fun(*this, &PannerUI::panning_link_button_release));
|
||||
(mem_fun(*this, &PannerUI::panning_link_button_release), false);
|
||||
|
||||
panning_up.set_border_width (3);
|
||||
panning_down.set_border_width (3);
|
||||
|
|
@ -154,19 +154,21 @@ PannerUI::PannerUI (IO& io, Session& s)
|
|||
pan_automation_state_changed ();
|
||||
}
|
||||
|
||||
gint
|
||||
bool
|
||||
PannerUI::panning_link_button_press (GdkEventButton* ev)
|
||||
{
|
||||
return stop_signal (panning_link_button, "button-press-event");
|
||||
cerr << "link press\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
gint
|
||||
bool
|
||||
PannerUI::panning_link_button_release (GdkEventButton* ev)
|
||||
{
|
||||
cerr << "link release\n";
|
||||
if (!ignore_toggle) {
|
||||
_io.panner().set_linked (!_io.panner().linked());
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -395,7 +397,7 @@ PannerUI::setup_pan ()
|
|||
}
|
||||
}
|
||||
|
||||
gint
|
||||
bool
|
||||
PannerUI::pan_button_event (GdkEventButton* ev, uint32_t which)
|
||||
{
|
||||
switch (ev->button) {
|
||||
|
|
@ -406,13 +408,13 @@ PannerUI::pan_button_event (GdkEventButton* ev, uint32_t which)
|
|||
}
|
||||
build_pan_menu (which);
|
||||
pan_menu->popup (1, ev->time);
|
||||
return TRUE;
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return FALSE; // what's wrong with gcc?
|
||||
return false; // what's wrong with gcc?
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -90,22 +90,20 @@ class PannerUI : public Gtk::HBox
|
|||
Gtk::Arrow panning_down_arrow;
|
||||
Gtk::VBox pan_vbox;
|
||||
Width _width;
|
||||
gint panning_scroll_button_press_event (GdkEventButton*, int32_t dir);
|
||||
gint panning_scroll_button_release_event (GdkEventButton*, int32_t dir);
|
||||
|
||||
Gtk::ToggleButton panning_link_button;
|
||||
Gtk::Button panning_link_direction_button;
|
||||
Gtk::HBox panning_link_box;
|
||||
|
||||
bool panning_link_button_press (GdkEventButton*);
|
||||
bool panning_link_button_release (GdkEventButton*);
|
||||
|
||||
Gtk::Menu pan_astate_menu;
|
||||
Gtk::Menu pan_astyle_menu;
|
||||
|
||||
Gtk::Button pan_automation_style_button;
|
||||
Gtk::ToggleButton pan_automation_state_button;
|
||||
|
||||
|
||||
gint panning_link_button_press (GdkEventButton*);
|
||||
gint panning_link_button_release (GdkEventButton*);
|
||||
void panning_link_direction_clicked ();
|
||||
|
||||
vector<Gtk::Adjustment*> pan_adjustments;
|
||||
|
|
@ -128,7 +126,8 @@ class PannerUI : public Gtk::HBox
|
|||
gint start_pan_touch (GdkEventButton*);
|
||||
gint end_pan_touch (GdkEventButton*);
|
||||
|
||||
gint pan_button_event (GdkEventButton*, uint32_t which);
|
||||
bool pan_button_event (GdkEventButton*, uint32_t which);
|
||||
|
||||
Gtk::Menu* pan_menu;
|
||||
Gtk::CheckMenuItem* bypass_menu_item;
|
||||
void build_pan_menu (uint32_t which);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ ardour.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
|
|||
ardour.Append(PACKAGE = domain)
|
||||
ardour.Append(POTFILE = domain + '.pot')
|
||||
|
||||
#
|
||||
# explicitly reference the control protocol LGPL library for includes
|
||||
#
|
||||
|
||||
ardour.Append(CPPPATH = '#libs/surfaces/control_protocol')
|
||||
|
||||
ardour_files=Split("""
|
||||
audio_library.cc
|
||||
audio_playlist.cc
|
||||
|
|
@ -30,10 +36,8 @@ audioregion.cc
|
|||
auditioner.cc
|
||||
automation.cc
|
||||
automation_event.cc
|
||||
basic_ui.cc
|
||||
configuration.cc
|
||||
connection.cc
|
||||
control_protocol.cc
|
||||
control_protocol_manager.cc
|
||||
crossfade.cc
|
||||
curve.cc
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
#ifndef __ardour_basic_ui_h__
|
||||
#define __ardour_basic_ui_h__
|
||||
|
||||
namespace ARDOUR {
|
||||
class Session;
|
||||
}
|
||||
|
||||
class BasicUI {
|
||||
public:
|
||||
BasicUI (ARDOUR::Session&);
|
||||
virtual ~BasicUI ();
|
||||
|
||||
void add_marker ();
|
||||
|
||||
/* transport control */
|
||||
|
||||
void loop_toggle ();
|
||||
void goto_start ();
|
||||
void goto_end ();
|
||||
void rewind ();
|
||||
void ffwd ();
|
||||
void transport_stop ();
|
||||
void transport_play ();
|
||||
void set_transport_speed (float speed);
|
||||
float get_transport_speed (float speed);
|
||||
|
||||
void save_state ();
|
||||
void prev_marker ();
|
||||
void next_marker ();
|
||||
void undo ();
|
||||
void redo ();
|
||||
void toggle_punch_in ();
|
||||
void toggle_punch_out ();
|
||||
|
||||
void rec_enable_toggle ();
|
||||
void toggle_all_rec_enables ();
|
||||
|
||||
protected:
|
||||
BasicUI ();
|
||||
ARDOUR::Session* session;
|
||||
};
|
||||
|
||||
#endif /* __ardour_basic_ui_h__ */
|
||||
|
|
@ -31,7 +31,8 @@
|
|||
#include <sigc++/sigc++.h>
|
||||
|
||||
#include <ardour/types.h>
|
||||
#include <ardour/basic_ui.h>
|
||||
|
||||
#include "basic_ui.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class Session;
|
||||
|
|
|
|||
|
|
@ -360,6 +360,9 @@ class Session : public sigc::trackable, public Stateful
|
|||
void request_diskstream_speed (DiskStream&, float speed);
|
||||
void request_input_change_handling ();
|
||||
|
||||
bool locate_pending() const { return static_cast<bool>(post_transport_work&PostTransportLocate); }
|
||||
bool transport_locked () const;
|
||||
|
||||
int wipe ();
|
||||
int wipe_diskstream (DiskStream *);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@
|
|||
#include <pbd/error.h>
|
||||
#include <pbd/pathscanner.h>
|
||||
|
||||
#include "control_protocol.h"
|
||||
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/control_protocol.h>
|
||||
#include <ardour/control_protocol_manager.h>
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
using namespace std;
|
||||
|
|
@ -168,18 +172,23 @@ ControlProtocolManager::control_protocol_discover (string path)
|
|||
|
||||
if ((descriptor = get_descriptor (path)) != 0) {
|
||||
|
||||
ControlProtocolInfo* info = new ControlProtocolInfo ();
|
||||
ControlProtocolInfo* cpi = new ControlProtocolInfo ();
|
||||
|
||||
info->descriptor = descriptor;
|
||||
info->name = descriptor->name;
|
||||
info->path = path;
|
||||
info->protocol = 0;
|
||||
info->requested = false;
|
||||
info->mandatory = descriptor->mandatory;
|
||||
if (!descriptor->probe (descriptor)) {
|
||||
info << string_compose (_("Control protocol %1 not usable"), descriptor->name) << endmsg;
|
||||
} else {
|
||||
|
||||
control_protocol_info.push_back (info);
|
||||
cpi->descriptor = descriptor;
|
||||
cpi->name = descriptor->name;
|
||||
cpi->path = path;
|
||||
cpi->protocol = 0;
|
||||
cpi->requested = false;
|
||||
cpi->mandatory = descriptor->mandatory;
|
||||
|
||||
cerr << "discovered control surface protocol \"" << info->name << '"' << endl;
|
||||
control_protocol_info.push_back (cpi);
|
||||
|
||||
info << string_compose(_("Control surface protocol discovered: \"%1\""), cpi->name) << endmsg;
|
||||
}
|
||||
|
||||
dlclose (descriptor->module);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,6 +421,18 @@ Session::reset_slave_state ()
|
|||
slave_state = Stopped;
|
||||
}
|
||||
|
||||
bool
|
||||
Session::transport_locked () const
|
||||
{
|
||||
Slave* sl = _slave;
|
||||
|
||||
if (!locate_pending() && ((_slave_type == None) || (sl && sl->ok() && sl->locked()))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
|
||||
{
|
||||
|
|
|
|||
54
libs/surfaces/control_protocol/SConscript
Normal file
54
libs/surfaces/control_protocol/SConscript
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# -*- python -*-
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
|
||||
Import('env final_prefix install_prefix final_config_prefix libraries i18n')
|
||||
|
||||
cp = env.Copy()
|
||||
|
||||
#
|
||||
# this defines the version number of libardour_cp
|
||||
#
|
||||
|
||||
domain = 'ardour_cp'
|
||||
|
||||
cp.Append(DOMAIN = domain, MAJOR = 1, MINOR = 0, MICRO = 0)
|
||||
cp.Append(CXXFLAGS = "-DPACKAGE=\\\"" + domain + "\\\"")
|
||||
cp.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
|
||||
cp.Append(PACKAGE = domain)
|
||||
cp.Append(POTFILE = domain + '.pot')
|
||||
|
||||
cp_files=Split("""
|
||||
basic_ui.cc
|
||||
control_protocol.cc
|
||||
""")
|
||||
|
||||
cp.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
|
||||
cp.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"")
|
||||
cp.Append(CXXFLAGS="-DCONFIG_DIR=\\\""+final_config_prefix+"\\\"")
|
||||
cp.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
|
||||
|
||||
cp.Merge ([
|
||||
libraries['ardour'],
|
||||
libraries['sigc2'],
|
||||
libraries['pbd3'],
|
||||
libraries['midi++2'],
|
||||
libraries['xml'],
|
||||
libraries['usb']
|
||||
])
|
||||
|
||||
libardour_cp = cp.SharedLibrary('ardour_cp', cp_files)
|
||||
|
||||
Default(libardour_cp)
|
||||
|
||||
if env['NLS']:
|
||||
i18n (cp, cp_files, env)
|
||||
|
||||
env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2/surfaces'), libardour_cp))
|
||||
|
||||
env.Alias('tarball', env.Distribute (env['DISTTREE'],
|
||||
[ 'SConscript', 'i18n.h', 'gettext.h' ] +
|
||||
cp_files +
|
||||
glob.glob('po/*.po') + glob.glob('*.h')))
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
Copyright (C) 2006 Paul Davis
|
||||
|
||||
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 free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Lesser
|
||||
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
|
||||
|
|
@ -18,10 +19,10 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#include <ardour/basic_ui.h>
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/location.h>
|
||||
|
||||
#include "basic_ui.h"
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
|
|
@ -92,7 +93,7 @@ BasicUI::transport_stop ()
|
|||
}
|
||||
|
||||
void
|
||||
BasicUI::transport_play ()
|
||||
BasicUI::transport_play (bool from_last_start)
|
||||
{
|
||||
bool rolling = session->transport_rolling ();
|
||||
|
||||
|
|
@ -104,7 +105,7 @@ BasicUI::transport_play ()
|
|||
session->request_play_range (false);
|
||||
}
|
||||
|
||||
if (rolling) {
|
||||
if (from_last_start && rolling) {
|
||||
session->request_locate (session->last_transport_start(), true);
|
||||
|
||||
}
|
||||
|
|
@ -167,6 +168,12 @@ BasicUI::set_transport_speed (float speed)
|
|||
session->request_transport_speed (speed);
|
||||
}
|
||||
|
||||
float
|
||||
BasicUI::get_transport_speed ()
|
||||
{
|
||||
return session->transport_speed ();
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::undo ()
|
||||
{
|
||||
|
|
@ -200,3 +207,67 @@ BasicUI::toggle_punch_out ()
|
|||
{
|
||||
session->set_punch_out (!session->get_punch_out());
|
||||
}
|
||||
|
||||
bool
|
||||
BasicUI::get_record_enabled ()
|
||||
{
|
||||
return session->get_record_enabled();
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::set_record_enable (bool yn)
|
||||
{
|
||||
if (yn) {
|
||||
session->maybe_enable_record ();
|
||||
} else {
|
||||
session->disable_record (false, true);
|
||||
}
|
||||
}
|
||||
|
||||
jack_nframes_t
|
||||
BasicUI::transport_frame ()
|
||||
{
|
||||
return session->transport_frame();
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::locate (jack_nframes_t where, bool roll_after_locate)
|
||||
{
|
||||
session->request_locate (where, roll_after_locate);
|
||||
}
|
||||
|
||||
bool
|
||||
BasicUI::locating ()
|
||||
{
|
||||
return session->locate_pending();
|
||||
}
|
||||
|
||||
bool
|
||||
BasicUI::locked ()
|
||||
{
|
||||
return session->transport_locked ();
|
||||
}
|
||||
|
||||
jack_nframes_t
|
||||
BasicUI::smpte_frames_per_hour ()
|
||||
{
|
||||
return session->smpte_frames_per_hour ();
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::smpte_time (jack_nframes_t where, SMPTE_t& smpte)
|
||||
{
|
||||
session->smpte_time (where, *((SMPTE_Time *) &smpte));
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::smpte_to_sample (SMPTE_t& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const
|
||||
{
|
||||
session->smpte_to_sample (*((SMPTE_Time*)&smpte), sample, use_offset, use_subframes);
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::sample_to_smpte (jack_nframes_t sample, SMPTE_t& smpte, bool use_offset, bool use_subframes) const
|
||||
{
|
||||
session->sample_to_smpte (sample, *((SMPTE_Time*)&smpte), use_offset, use_subframes);
|
||||
}
|
||||
98
libs/surfaces/control_protocol/basic_ui.h
Normal file
98
libs/surfaces/control_protocol/basic_ui.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
Copyright (C) 2006 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Lesser
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef __ardour_basic_ui_h__
|
||||
#define __ardour_basic_ui_h__
|
||||
|
||||
#include <jack/types.h>
|
||||
|
||||
namespace ARDOUR {
|
||||
class Session;
|
||||
}
|
||||
|
||||
class BasicUI {
|
||||
public:
|
||||
BasicUI (ARDOUR::Session&);
|
||||
virtual ~BasicUI ();
|
||||
|
||||
void add_marker ();
|
||||
|
||||
/* transport control */
|
||||
|
||||
void loop_toggle ();
|
||||
void goto_start ();
|
||||
void goto_end ();
|
||||
void rewind ();
|
||||
void ffwd ();
|
||||
void transport_stop ();
|
||||
void transport_play (bool jump_back = true);
|
||||
void set_transport_speed (float speed);
|
||||
float get_transport_speed ();
|
||||
|
||||
jack_nframes_t transport_frame ();
|
||||
void locate (jack_nframes_t frame, bool play = false);
|
||||
bool locating ();
|
||||
bool locked ();
|
||||
|
||||
void save_state ();
|
||||
void prev_marker ();
|
||||
void next_marker ();
|
||||
void undo ();
|
||||
void redo ();
|
||||
void toggle_punch_in ();
|
||||
void toggle_punch_out ();
|
||||
|
||||
void set_record_enable (bool yn);
|
||||
bool get_record_enabled ();
|
||||
|
||||
void rec_enable_toggle ();
|
||||
void toggle_all_rec_enables ();
|
||||
|
||||
jack_nframes_t smpte_frames_per_hour ();
|
||||
|
||||
struct SMPTE_t {
|
||||
bool negative;
|
||||
uint32_t hours;
|
||||
uint32_t minutes;
|
||||
uint32_t seconds;
|
||||
uint32_t frames;
|
||||
uint32_t subframes; // mostly not used
|
||||
|
||||
SMPTE_t () {
|
||||
negative = false;
|
||||
hours = 0;
|
||||
minutes = 0;
|
||||
seconds = 0;
|
||||
frames = 0;
|
||||
subframes = 0;
|
||||
}
|
||||
};
|
||||
|
||||
void smpte_time (jack_nframes_t where, SMPTE_t&);
|
||||
void smpte_to_sample (SMPTE_t& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const;
|
||||
void sample_to_smpte (jack_nframes_t sample, SMPTE_t& smpte, bool use_offset, bool use_subframes) const;
|
||||
|
||||
protected:
|
||||
BasicUI ();
|
||||
ARDOUR::Session* session;
|
||||
};
|
||||
|
||||
#endif /* __ardour_basic_ui_h__ */
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
Copyright (C) 2006 Paul Davis
|
||||
|
||||
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 free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Lesser
|
||||
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
|
||||
|
|
@ -18,11 +19,12 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#include <ardour/control_protocol.h>
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/route.h>
|
||||
#include <ardour/audio_track.h>
|
||||
|
||||
#include "control_protocol.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -135,6 +137,24 @@ ControlProtocol::set_route_table (uint32_t table_index, ARDOUR::Route*)
|
|||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ControlProtocol::set_route_table (uint32_t table_index, uint32_t remote_control_id)
|
||||
{
|
||||
if (table_index >= route_table.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Route* r = session->route_by_remote_id (remote_control_id);
|
||||
|
||||
if (!r) {
|
||||
return false;
|
||||
}
|
||||
|
||||
route_table[table_index] = r;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn)
|
||||
{
|
||||
|
|
@ -1,3 +1,24 @@
|
|||
/*
|
||||
Copyright (C) 2006 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Lesser
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef ardour_control_protocols_h
|
||||
#define ardour_control_protocols_h
|
||||
|
||||
|
|
@ -6,7 +27,7 @@
|
|||
#include <list>
|
||||
#include <sigc++/sigc++.h>
|
||||
|
||||
#include <ardour/basic_ui.h>
|
||||
#include "basic_ui.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
|
|
@ -25,7 +46,6 @@ class ControlProtocol : public sigc::trackable, public BasicUI {
|
|||
|
||||
sigc::signal<void> ActiveChanged;
|
||||
|
||||
|
||||
/* signals that a control protocol can emit and other (presumably graphical)
|
||||
user interfaces can respond to
|
||||
*/
|
||||
|
|
@ -54,6 +74,7 @@ class ControlProtocol : public sigc::trackable, public BasicUI {
|
|||
|
||||
void set_route_table_size (uint32_t size);
|
||||
void set_route_table (uint32_t table_index, ARDOUR::Route*);
|
||||
bool set_route_table (uint32_t table_index, uint32_t remote_control_id);
|
||||
|
||||
void route_set_rec_enable (uint32_t table_index, bool yn);
|
||||
bool route_get_rec_enable (uint32_t table_index);
|
||||
|
|
@ -88,6 +109,7 @@ extern "C" {
|
|||
void* ptr; /* protocol can store a value here */
|
||||
void* module; /* not for public access */
|
||||
int mandatory; /* if non-zero, always load and do not make optional */
|
||||
bool (*probe)(ControlProtocolDescriptor*);
|
||||
ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
|
||||
void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
|
||||
|
||||
|
|
@ -32,6 +32,7 @@ genericmidi.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
|
|||
|
||||
genericmidi.Merge ([
|
||||
libraries['ardour'],
|
||||
libraries['ardour_cp'],
|
||||
libraries['midi++2'],
|
||||
libraries['pbd3'],
|
||||
libraries['sigc2'],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ardour_generic_midi_control_protocol_h
|
||||
#define ardour_generic_midi_control_protocol_h
|
||||
|
||||
#include <ardour/control_protocol.h>
|
||||
#include "control_protocol.h"
|
||||
|
||||
namespace MIDI {
|
||||
class Port;
|
||||
|
|
@ -15,6 +15,7 @@ class GenericMidiControlProtocol : public ControlProtocol {
|
|||
virtual ~GenericMidiControlProtocol();
|
||||
|
||||
int set_active (bool yn);
|
||||
static bool probe() { return true; }
|
||||
|
||||
void set_port (MIDI::Port*);
|
||||
MIDI::Port* port () const { return _port; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <ardour/control_protocol.h>
|
||||
#include "control_protocol.h"
|
||||
|
||||
#include "generic_midi_control_protocol.h"
|
||||
|
||||
|
|
@ -23,12 +23,19 @@ delete_generic_midi_protocol (ControlProtocolDescriptor* descriptor, ControlProt
|
|||
delete cp;
|
||||
}
|
||||
|
||||
bool
|
||||
probe_generic_midi_protocol (ControlProtocolDescriptor* descriptor)
|
||||
{
|
||||
return GenericMidiControlProtocol::probe ();
|
||||
}
|
||||
|
||||
static ControlProtocolDescriptor generic_midi_descriptor = {
|
||||
name : "Generic MIDI",
|
||||
id : "uri://ardour.org/surfaces/generic_midi:0",
|
||||
ptr : 0,
|
||||
module : 0,
|
||||
mandatory : 0,
|
||||
probe : probe_generic_midi_protocol,
|
||||
initialize : new_generic_midi_protocol,
|
||||
destroy : delete_generic_midi_protocol
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ tranzport.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
|
|||
|
||||
tranzport.Merge ([
|
||||
libraries['ardour'],
|
||||
libraries['ardour_cp'],
|
||||
libraries['sigc2'],
|
||||
libraries['pbd3'],
|
||||
libraries['midi++2'],
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <ardour/control_protocol.h>
|
||||
#include "control_protocol.h"
|
||||
|
||||
#include "tranzport_control_protocol.h"
|
||||
|
||||
|
|
@ -24,12 +24,19 @@ delete_tranzport_protocol (ControlProtocolDescriptor* descriptor, ControlProtoco
|
|||
delete cp;
|
||||
}
|
||||
|
||||
bool
|
||||
probe_tranzport_protocol (ControlProtocolDescriptor* descriptor)
|
||||
{
|
||||
return TranzportControlProtocol::probe();
|
||||
}
|
||||
|
||||
static ControlProtocolDescriptor tranzport_descriptor = {
|
||||
name : "Tranzport",
|
||||
id : "uri://ardour.org/surfaces/tranzport:0",
|
||||
ptr : 0,
|
||||
module : 0,
|
||||
mandatory : 0,
|
||||
probe : probe_tranzport_protocol,
|
||||
initialize : new_tranzport_protocol,
|
||||
destroy : delete_tranzport_protocol
|
||||
};
|
||||
|
|
|
|||
|
|
@ -66,9 +66,7 @@ slider_position_to_gain (double pos)
|
|||
|
||||
|
||||
TranzportControlProtocol::TranzportControlProtocol (Session& s)
|
||||
: ControlProtocol (s, X_("Tranzport")),
|
||||
AbstractUI<TranzportRequest> (X_("Tranzport"), false)
|
||||
|
||||
: ControlProtocol (s, X_("Tranzport"))
|
||||
{
|
||||
/* tranzport controls one track at a time */
|
||||
|
||||
|
|
@ -106,6 +104,28 @@ TranzportControlProtocol::~TranzportControlProtocol ()
|
|||
set_active (false);
|
||||
}
|
||||
|
||||
bool
|
||||
TranzportControlProtocol::probe ()
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *dev;
|
||||
|
||||
usb_init();
|
||||
usb_find_busses();
|
||||
usb_find_devices();
|
||||
|
||||
for (bus = usb_busses; bus; bus = bus->next) {
|
||||
|
||||
for(dev = bus->devices; dev; dev = dev->next) {
|
||||
if (dev->descriptor.idVendor == VENDORID && dev->descriptor.idProduct == PRODUCTID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
TranzportControlProtocol::set_active (bool yn)
|
||||
{
|
||||
|
|
@ -559,7 +579,7 @@ TranzportControlProtocol::monitor_work ()
|
|||
|
||||
if ((err = pthread_setschedparam (pthread_self(), SCHED_FIFO, &rtparam)) != 0) {
|
||||
// do we care? not particularly.
|
||||
info << string_compose (_("%1: thread not running with realtime scheduling (%2)"), BaseUI::name(), strerror (errno)) << endmsg;
|
||||
info << string_compose (_("%1: thread not running with realtime scheduling (%2)"), name(), strerror (errno)) << endmsg;
|
||||
}
|
||||
|
||||
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0);
|
||||
|
|
@ -1554,18 +1574,3 @@ TranzportControlProtocol::print (int row, int col, const char *text)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TranzportControlProtocol::caller_is_ui_thread ()
|
||||
{
|
||||
return (pthread_self() == thread);
|
||||
}
|
||||
|
||||
void
|
||||
TranzportControlProtocol::do_request (TranzportRequest* req)
|
||||
{
|
||||
if (req->type == SetCurrentTrack) {
|
||||
route_table[0] = req->track;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,24 +7,12 @@
|
|||
#include <pbd/lockmonitor.h>
|
||||
#include <pthread.h>
|
||||
#include <usb.h>
|
||||
#include <ardour/control_protocol.h>
|
||||
|
||||
#include <ardour/types.h>
|
||||
|
||||
#include <pbd/abstract_ui.h>
|
||||
#include "control_protocol.h"
|
||||
|
||||
extern BaseUI::RequestType LEDChange;
|
||||
extern BaseUI::RequestType Print;
|
||||
extern BaseUI::RequestType SetCurrentTrack;
|
||||
|
||||
struct TranzportRequest : public BaseUI::BaseRequestObject {
|
||||
int led;
|
||||
int row;
|
||||
int col;
|
||||
char* text;
|
||||
ARDOUR::Route* track;
|
||||
};
|
||||
|
||||
class TranzportControlProtocol : public ARDOUR::ControlProtocol, public AbstractUI<TranzportRequest>
|
||||
class TranzportControlProtocol : public ARDOUR::ControlProtocol
|
||||
{
|
||||
public:
|
||||
TranzportControlProtocol (ARDOUR::Session&);
|
||||
|
|
@ -32,7 +20,7 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol, public Abstract
|
|||
|
||||
int set_active (bool yn);
|
||||
|
||||
bool caller_is_ui_thread();
|
||||
static bool probe ();
|
||||
|
||||
private:
|
||||
static const int VENDORID = 0x165b;
|
||||
|
|
@ -107,8 +95,6 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol, public Abstract
|
|||
DisplayMode display_mode;
|
||||
ARDOUR::gain_t gain_fraction;
|
||||
|
||||
void do_request (TranzportRequest*);
|
||||
|
||||
PBD::Lock update_lock;
|
||||
char current_screen[2][20];
|
||||
char pending_screen[2][20];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue