#include <midi++/port.h>
#include <midi++/manager.h>
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/pthread_utils.h>
#include <ardour/configuration.h>
#include <ardour/audioengine.h>
#include <ardour/session.h>
#include <ardour/audio_track.h>
-#include <ardour/diskstream.h>
+#include <ardour/audio_diskstream.h>
#include <ardour/slave.h>
#include <ardour/cycles.h>
using namespace std;
using namespace ARDOUR;
-//using namespace sigc;
+using namespace PBD;
using namespace MIDI;
MachineControl::CommandSignature MMC_CommandSignature;
set_dirty();
poke_midi_thread ();
- if (_midi_port) {
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
- for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
- (*i)->reset_midi_control (_midi_port, midi_control);
- }
- }
-
ControlChanged (MidiControl); /* EMIT SIGNAL */
}
ControlChanged (SendMMC); /* EMIT SIGNAL */
}
+void
+Session::set_midi_feedback (bool yn)
+{
+}
+
+bool
+Session::get_midi_feedback () const
+{
+ return false;
+}
+
bool
Session::get_send_mtc () const
{
}
_midi_port = port;
+
+ /* XXX need something to forward this to control protocols ? or just
+ use the signal below
+ */
Config->set_midi_port_name (port_tag);
}
-
-void
-Session::set_midi_feedback (bool yn)
-{
- if (_midi_port == 0) {
- return;
- }
-
- midi_feedback = yn;
- set_dirty();
-
- if (yn) {
- /* make sure the feedback thread is alive */
- start_feedback ();
- } else {
- /* maybe put the feedback thread to sleep */
- stop_feedback ();
- }
-
- ControlChanged (MidiFeedback); /* EMIT SIGNAL */
-
- send_all_midi_feedback ();
-}
-
-void
-Session::send_all_midi_feedback ()
-{
- if (midi_feedback) {
- // send out current state of all routes
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
- for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
- (*i)->send_all_midi_feedback ();
- }
- }
-}
-
void
Session::setup_midi_control ()
{
*/
save_state ("", true);
- atomic_set (&_record_status, Enabled);
+ g_atomic_int_set (&_record_status, Enabled);
RecordStateChanged (); /* EMIT SIGNAL */
request_transport_speed (1.0);
Session::mmc_record_exit (MIDI::MachineControl &mmc)
{
if (mmc_control) {
- disable_record ();
+ disable_record (false);
}
}
}
jack_nframes_t target_frame;
- SMPTE_Time smpte;
+ SMPTE::Time smpte;
smpte.hours = mmc_tc[0] & 0xf;
smpte.minutes = mmc_tc[1];
if (mmc_control) {
RouteList::iterator i;
- RWLockMonitor (route_lock, false, __LINE__, __FILE__);
+ boost::shared_ptr<RouteList> r = routes.reader();
- for (i = routes.begin(); i != routes.end(); ++i) {
+ for (i = r->begin(); i != r->end(); ++i) {
AudioTrack *at;
- if ((at = dynamic_cast<AudioTrack*>(*i)) != 0) {
+ if ((at = dynamic_cast<AudioTrack*>((*i).get())) != 0) {
if (trk == at->remote_control_id()) {
at->set_record_enable (enabled, &mmc);
break;
{
MIDI::byte msg[10];
- SMPTE_Time smpte;
+ SMPTE::Time smpte;
if (_mtc_port == 0 || !send_mtc) {
return 0;
outbound_mtc_smpte_frame = _transport_frame;
if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) {
// start MTC quarter frame transmission on an even frame
- smpte_increment( transmitting_smpte_time );
+ SMPTE::increment( transmitting_smpte_time );
outbound_mtc_smpte_frame += (jack_nframes_t) _frames_per_smpte_frame;
}
}
msg[8] = smpte.frames;
{
- LockMonitor lm (midi_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (midi_lock);
if (_mtc_port->midimsg (msg, sizeof (msg))) {
error << _("Session: could not send full MIDI time code") << endmsg;
// Send quarter frames up to current time
{
- LockMonitor lm (midi_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (midi_lock);
switch(next_quarter_frame_to_send) {
case 0:
// Wrap quarter frame counter
next_quarter_frame_to_send = 0;
// Increment smpte time twice
- smpte_increment( transmitting_smpte_time );
- smpte_increment( transmitting_smpte_time );
+ SMPTE::increment( transmitting_smpte_time );
+ SMPTE::increment( transmitting_smpte_time );
// Re-calculate timing of first quarter frame
smpte_to_sample( transmitting_smpte_time, outbound_mtc_smpte_frame, true /* use_offset */, false );
// Compensate for audio latency
{
using namespace MIDI;
int nbytes = 4;
- SMPTE_Time smpte;
+ SMPTE::Time smpte;
if (_mmc_port == 0 || !send_mmc) {
return;
mmc_buffer[nbytes++] = 0xf7; // terminate SysEx/MMC message
- LockMonitor lm (midi_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (midi_lock);
if (_mmc_port->write (mmc_buffer, nbytes) != nbytes) {
error << string_compose(_("MMC: cannot send command %1%2%3"), &hex, cmd, &dec) << endmsg;
bool restart;
vector<MIDI::Port*> ports;
- PBD::ThreadCreated (pthread_self(), X_("MIDI"));
+ PBD::ThreadCreatedWithRequestSize (pthread_self(), X_("MIDI"), 2048);
memset (&rtparam, 0, sizeof (rtparam));
rtparam.sched_priority = 9; /* XXX should be relative to audio (JACK) thread */
{
return mmc_control;
}
-bool
-Session::get_midi_feedback () const
-{
- /* since this a "write" function we have to check the port as well
- as the control toggle.
- */
- return _midi_port && midi_feedback;
-}
+
bool
Session::get_midi_control () const
{