2008-06-02 17:41:35 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2006,2007 John Anderson
|
|
|
|
|
|
|
|
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 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.
|
|
|
|
*/
|
|
|
|
#ifndef route_signal_h
|
|
|
|
#define route_signal_h
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
#include <vector>
|
2009-04-15 14:04:23 -04:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2008-12-12 17:55:03 -05:00
|
|
|
|
|
|
|
#include "midi_byte_array.h"
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
class MackieControlProtocol;
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Route;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Mackie
|
|
|
|
{
|
|
|
|
|
|
|
|
class Strip;
|
2008-12-12 17:55:03 -05:00
|
|
|
class SurfacePort;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
This class is intended to easily create and destroy the set of
|
|
|
|
connections from a route to a control surface strip. Instantiating
|
|
|
|
it will connect the signals, and destructing it will disconnect
|
|
|
|
the signals.
|
|
|
|
*/
|
|
|
|
class RouteSignal
|
|
|
|
{
|
|
|
|
public:
|
2009-04-15 14:04:23 -04:00
|
|
|
RouteSignal(boost::shared_ptr<ARDOUR::Route> route, MackieControlProtocol & mcp, Strip & strip, SurfacePort & port )
|
2008-12-12 17:55:03 -05:00
|
|
|
: _route( route ), _mcp( mcp ), _strip( strip ), _port( port ), _last_gain_written(0.0)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
~RouteSignal()
|
|
|
|
{
|
|
|
|
disconnect();
|
|
|
|
}
|
|
|
|
|
|
|
|
void connect();
|
|
|
|
void disconnect();
|
|
|
|
|
|
|
|
// call all signal handlers manually
|
|
|
|
void notify_all();
|
|
|
|
|
2009-04-15 14:04:23 -04:00
|
|
|
boost::shared_ptr<const ARDOUR::Route> route() const { return _route; }
|
2008-06-02 17:41:35 -04:00
|
|
|
Strip & strip() { return _strip; }
|
2008-12-12 17:55:03 -05:00
|
|
|
SurfacePort & port() { return _port; }
|
|
|
|
|
|
|
|
float last_gain_written() const { return _last_gain_written; }
|
|
|
|
void last_gain_written( float other ) { _last_gain_written = other; }
|
|
|
|
|
|
|
|
const MidiByteArray & last_pan_written() const { return _last_pan_written; }
|
|
|
|
void last_pan_written( const MidiByteArray & other ) { _last_pan_written = other; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
private:
|
2009-04-15 14:04:23 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Route> _route;
|
2008-06-02 17:41:35 -04:00
|
|
|
MackieControlProtocol & _mcp;
|
|
|
|
Strip & _strip;
|
2008-12-12 17:55:03 -05:00
|
|
|
SurfacePort & _port;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
PBD::ScopedConnectionList connections;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2008-12-12 17:55:03 -05:00
|
|
|
// Last written values for the gain and pan, to avoid overloading
|
|
|
|
// the midi connection to the surface
|
|
|
|
float _last_gain_written;
|
|
|
|
MidiByteArray _last_pan_written;
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|