Remove MMC thread protection which is pointless now that only JACK MIDI ports are...
authorCarl Hetherington <carl@carlh.net>
Tue, 6 Jul 2010 00:27:03 +0000 (00:27 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 6 Jul 2010 00:27:03 +0000 (00:27 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7378 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audioengine.cc
libs/ardour/session_process.cc
libs/midi++2/midi++/mmc.h
libs/midi++2/mmc.cc

index 33a76fa7b4c4306e2217074d5a5c049ba3d791d5..fb81ccd144e62c814feaa5be89276fdd28c3f224 100644 (file)
@@ -148,7 +148,6 @@ _thread_init_callback (void * /*arg*/)
        SessionEvent::create_per_thread_pool (X_("Audioengine"), 512);
 
        MIDI::Port::set_process_thread (pthread_self());
-       MIDI::MachineControl::set_sending_thread (pthread_self ());
 }
 
 typedef void (*_JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
index e5553500885d89a4981295456c14553195066849..d7e9b7c99523c1b52831e12e471da4b549fbf8d9 100644 (file)
@@ -69,8 +69,6 @@ Session::process (nframes_t nframes)
                }
        }
 
-       _mmc->flush_pending ();
-        
         _engine.main_thread()->get_buffers ();
 
        (this->*process_function) (nframes);
index 61415d39f232a84a859ae160abcefb67a91c27ce..ec4852778902c65b799ca44b6d91e4ede39ca026 100644 (file)
@@ -98,10 +98,8 @@ class MachineControl
        byte send_device_id () const { return _send_device_id; }
        void enable_send (bool);
        void send (MachineControlCommand const &);
-       void flush_pending ();
 
        static bool is_mmc (byte *sysex_buf, size_t len);
-       static void set_sending_thread (pthread_t);
 
        /* Signals to connect to if you want to run "callbacks"
           when certain MMC commands are received.
@@ -260,14 +258,6 @@ class MachineControl
        Port* _port;
        bool _enable_send; ///< true if MMC sending is enabled
 
-       /** A ringbuffer of MMC commands that were `sent' from the wrong thread, which
-           are queued up and sent when flush_pending() is called.
-       */
-       RingBuffer<MachineControlCommand> _pending;
-
-       /** The thread to use for sending MMC commands */
-       static pthread_t _sending_thread;
-
        void process_mmc_message (Parser &p, byte *, size_t len);
        PBD::ScopedConnectionList port_connections; ///< connections to our parser for incoming data
 
@@ -275,7 +265,6 @@ class MachineControl
        int  do_locate (byte *, size_t len);
        int  do_step (byte *, size_t len);
        int  do_shuttle (byte *, size_t len);
-       void send_immediately (MachineControlCommand const &);
        
        void write_track_status (byte *, size_t len, byte reg);
        void spp_start (Parser&, nframes_t);
index 79132f0e1a1f7c3555630097d1ffe0a3970d5462..597904d29319ca8cf7ac5399a80dc5f25203afad 100644 (file)
@@ -30,8 +30,6 @@ using namespace std;
 using namespace MIDI;
 using namespace PBD;
 
-pthread_t MachineControl::_sending_thread;
-
 static std::map<int,string> mmc_cmd_map;
 static void build_mmc_cmd_map ()
 {
@@ -197,7 +195,6 @@ static void build_mmc_cmd_map ()
 
 MachineControl::MachineControl ()
        : _port (0)
-       , _pending (16)
 {
        build_mmc_cmd_map ();
 
@@ -640,36 +637,11 @@ MachineControl::enable_send (bool yn)
        _enable_send = yn;
 }
 
-/** Send a MMC command.  It will be sent immediately if the call is made in _sending_thread,
- *  otherwise it will be queued and sent next time flush_pending()
- *  is called.
- *  @param c command, which this method takes ownership of.
+/** Send a MMC command to a the MMC port.
+ *  @param c command.
  */
 void
 MachineControl::send (MachineControlCommand const & c)
-{
-       if (pthread_self() == _sending_thread) {
-               send_immediately (c);
-       } else {
-               _pending.write (&c, 1);
-       }
-}
-
-/** Send any pending MMC commands immediately.  Must be called from _sending_thread */
-void
-MachineControl::flush_pending ()
-{
-       MachineControlCommand c;
-       while (_pending.read (&c, 1) == 1) {
-               send_immediately (c);
-       }
-}
-
-/** Send a MMC immediately.  Must be called from _sending_thread.
- *  @param c command, which this method takes ownership of.
- */
-void
-MachineControl::send_immediately (MachineControlCommand const & c)
 {
        if (_port == 0 || !_enable_send) {
                // cerr << "Not delivering MMC " << _mmc->port() << " - " << session_send_mmc << endl;
@@ -684,13 +656,6 @@ MachineControl::send_immediately (MachineControlCommand const & c)
        }
 }
 
-/** Set the thread that we should send MMC in */
-void
-MachineControl::set_sending_thread (pthread_t t)
-{
-       _sending_thread = t;
-}
-
 void
 MachineControl::spp_start (Parser& parser, nframes_t timestamp)
 {