src-tree cleanup: separate surfaces from libraries

libardourcp and now libardour_midisurface are not control
surfaces, but helper libraries for those.
They need to be deployed to the library folder (shared between
ctrl surfaces) and not scanned as ctrl surfaces at runtime.
This commit is contained in:
Robin Gareus 2022-11-19 00:07:22 +01:00
parent 22007bf882
commit d521c2ede6
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
20 changed files with 8 additions and 11 deletions

View file

@ -0,0 +1,78 @@
/*
* Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef midi_byte_array_h
#define midi_byte_array_h
#include <iostream>
#include <vector>
#include <boost/shared_array.hpp>
//#include <midi++/types.h>
namespace MIDI {
typedef unsigned char byte;
}
/**
To make building arrays of bytes easier. Thusly:
MidiByteArray mba;
mba << 0xf0 << 0x00 << 0xf7;
MidiByteArray buf;
buf << mba;
MidiByteArray direct( 3, 0xf0, 0x00, 0xf7 );
cout << mba << endl;
cout << buf << endl;
cout << direct << endl;
will all result in "f0 00 f7" being output to stdout
*/
class MidiByteArray : public std::vector<MIDI::byte>
{
public:
MidiByteArray() : std::vector<MIDI::byte>() {}
MidiByteArray( size_t count, MIDI::byte array[] );
bool compare_n (const MidiByteArray& other, MidiByteArray::size_type len) const;
/**
Accepts a preceding count, and then a list of bytes
*/
MidiByteArray( size_t count, MIDI::byte first, ... );
/// copy the given number of bytes from the given array
void copy( size_t count, MIDI::byte arr[] );
};
/// append the given byte to the end of the array
MidiByteArray & operator << ( MidiByteArray & mba, const MIDI::byte & b );
/// append the given string to the end of the array
MidiByteArray & operator << ( MidiByteArray & mba, const std::string & );
/// append the given array to the end of this array
MidiByteArray & operator << ( MidiByteArray & mba, const MidiByteArray & barr );
/// output the bytes as hex to the given stream
std::ostream & operator << ( std::ostream & os, const MidiByteArray & mba );
#endif

View file

@ -0,0 +1,134 @@
/*
* Copyright (C) 2022 Robin Gareus <robin@gareus.org>
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define ABSTRACT_UI_EXPORTS
#include "pbd/abstract_ui.h"
#include "control_protocol/control_protocol.h"
#include "midi++/types.h"
#include "midi_byte_array.h"
namespace MIDI {
class Parser;
class Port;
}
namespace ARDOUR {
class Bundle;
class Port;
class MidiBuffer;
}
struct MidiSurfaceRequest : public BaseUI::BaseRequestObject {
public:
MidiSurfaceRequest () {}
~MidiSurfaceRequest () {}
};
class MIDISurface : public ARDOUR::ControlProtocol
, public AbstractUI<MidiSurfaceRequest>
{
public:
MIDISurface (ARDOUR::Session&, std::string const & name, std::string const & port_name_prefix, bool use_pad_filter);
~MIDISurface ();
static void* request_factory (uint32_t num_requests);
boost::shared_ptr<ARDOUR::Port> input_port();
boost::shared_ptr<ARDOUR::Port> output_port();
// Bundle to represent our input ports
boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
// Bundle to represent our output ports
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
ARDOUR::Session & get_session() { return *session; }
virtual std::string input_port_name () const = 0;
virtual std::string output_port_name () const = 0;
void write (const MidiByteArray&);
void write (MIDI::byte const *, size_t);
XMLNode& get_state() const;
int set_state (const XMLNode & node, int version);
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
PBD::Signal0<void> ConnectionChange;
CONTROL_PROTOCOL_THREADS_NEED_TEMPO_MAP_DECL();
protected:
bool with_pad_filter;
bool _in_use;
std::string port_name_prefix;
MIDI::Port* _input_port;
MIDI::Port* _output_port;
boost::shared_ptr<ARDOUR::Port> _async_in;
boost::shared_ptr<ARDOUR::Port> _async_out;
void do_request (MidiSurfaceRequest*);
virtual void connect_to_parser ();
virtual void handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t) {}
virtual void handle_midi_polypressure_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_note_on_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_note_off_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_sysex (MIDI::Parser&, MIDI::byte *, size_t) {}
virtual bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
virtual void thread_init ();
PBD::ScopedConnectionList session_connections;
virtual void connect_session_signals ();
virtual void notify_record_state_changed () {}
virtual void notify_transport_state_changed () {}
virtual void notify_loop_state_changed () {}
virtual void notify_parameter_changed (std::string) {}
virtual void notify_solo_active_changed (bool) {}
virtual void port_registration_handler ();
virtual bool pad_filter (ARDOUR::MidiBuffer& in, ARDOUR::MidiBuffer& out) const { return false; }
enum ConnectionState {
InputConnected = 0x1,
OutputConnected = 0x2
};
int _connection_state;
virtual bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
PBD::ScopedConnectionList port_connections;
virtual int ports_acquire ();
virtual void ports_release ();
virtual int begin_using_device ();
virtual int stop_using_device ();
virtual int device_acquire () = 0;
virtual void device_release () = 0;
void drop ();
void port_setup ();
};