summaryrefslogtreecommitdiff
path: root/libs/midi++2
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-17 18:24:23 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-17 18:24:23 +0000
commitf6fdd8dcbf41f864e9f0cc32dabe81fe3533ddfe (patch)
tree5214c580b9e6c17a499fa587660dbf949e892bf2 /libs/midi++2
parentda762129f19c28aff64f833b6ec09fba946faef6 (diff)
switch to using boost::signals2 instead of sigc++, at least for libardour. not finished yet, but compiles, loads sessions, records and can close a session without a crash
git-svn-id: svn://localhost/ardour2/branches/3.0@6372 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2')
-rw-r--r--libs/midi++2/channel.cc64
-rw-r--r--libs/midi++2/midi++/channel.h5
-rw-r--r--libs/midi++2/midi++/manager.h2
-rw-r--r--libs/midi++2/midi++/mmc.h94
-rw-r--r--libs/midi++2/midi++/parser.h51
-rw-r--r--libs/midi++2/midi++/port.h5
-rw-r--r--libs/midi++2/mmc.cc3
-rw-r--r--libs/midi++2/parser.cc3
8 files changed, 114 insertions, 113 deletions
diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc
index f19c913644..9e339654b4 100644
--- a/libs/midi++2/channel.cc
+++ b/libs/midi++2/channel.cc
@@ -23,7 +23,6 @@
#include "midi++/port.h"
#include "midi++/channel.h"
-using namespace sigc;
using namespace MIDI;
Channel::Channel (byte channelnum, Port &p) : _port (p)
@@ -35,44 +34,45 @@ Channel::Channel (byte channelnum, Port &p) : _port (p)
void
Channel::connect_input_signals ()
-
{
- _port.input()->channel_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_chanpress));
- _port.input()->channel_note_on[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_on));
- _port.input()->channel_note_off[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_off));
- _port.input()->channel_poly_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_polypress));
- _port.input()->channel_program_change[_channel_number].connect
- (mem_fun (*this, &Channel::process_program_change));
- _port.input()->channel_controller[_channel_number].connect
- (mem_fun (*this, &Channel::process_controller));
- _port.input()->channel_pitchbend[_channel_number].connect
- (mem_fun (*this, &Channel::process_pitchbend));
- _port.input()->reset.connect (mem_fun (*this, &Channel::process_reset));
+ add_connection (_port.input()->channel_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_chanpress, this, _1, _2)));
+ add_connection (_port.input()->channel_note_on[_channel_number].connect
+ (boost::bind (&Channel::process_note_on, this, _1, _2)));
+ add_connection (_port.input()->channel_note_off[_channel_number].connect
+ (boost::bind (&Channel::process_note_off, this, _1, _2)));
+ add_connection (_port.input()->channel_poly_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_polypress, this, _1, _2)));
+ add_connection (_port.input()->channel_program_change[_channel_number].connect
+ (boost::bind (&Channel::process_program_change, this, _1, _2)));
+ add_connection (_port.input()->channel_controller[_channel_number].connect
+ (boost::bind (&Channel::process_controller, this, _1, _2)));
+ add_connection (_port.input()->channel_pitchbend[_channel_number].connect
+ (boost::bind (&Channel::process_pitchbend, this, _1, _2)));
+
+ add_connection (_port.input()->reset.connect (boost::bind (&Channel::process_reset, this, _1)));
}
void
Channel::connect_output_signals ()
{
- _port.output()->channel_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_chanpress));
- _port.output()->channel_note_on[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_on));
- _port.output()->channel_note_off[_channel_number].connect
- (mem_fun (*this, &Channel::process_note_off));
- _port.output()->channel_poly_pressure[_channel_number].connect
- (mem_fun (*this, &Channel::process_polypress));
- _port.output()->channel_program_change[_channel_number].connect
- (mem_fun (*this, &Channel::process_program_change));
- _port.output()->channel_controller[_channel_number].connect
- (mem_fun (*this, &Channel::process_controller));
- _port.output()->channel_pitchbend[_channel_number].connect
- (mem_fun (*this, &Channel::process_pitchbend));
- _port.output()->reset.connect (mem_fun (*this, &Channel::process_reset));
+ add_connection (_port.output()->channel_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_chanpress, this, _1, _2)));
+ add_connection (_port.output()->channel_note_on[_channel_number].connect
+ (boost::bind (&Channel::process_note_on, this, _1, _2)));
+ add_connection (_port.output()->channel_note_off[_channel_number].connect
+ (boost::bind (&Channel::process_note_off, this, _1, _2)));
+ add_connection (_port.output()->channel_poly_pressure[_channel_number].connect
+ (boost::bind (&Channel::process_polypress, this, _1, _2)));
+ add_connection (_port.output()->channel_program_change[_channel_number].connect
+ (boost::bind (&Channel::process_program_change, this, _1, _2)));
+ add_connection (_port.output()->channel_controller[_channel_number].connect
+ (boost::bind (&Channel::process_controller, this, _1, _2)));
+ add_connection (_port.output()->channel_pitchbend[_channel_number].connect
+ (boost::bind (&Channel::process_pitchbend, this, _1, _2)));
+
+ add_connection (_port.output()->reset.connect (boost::bind (&Channel::process_reset, this, _1)));
}
void
diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h
index 697f2a1e46..617ae14430 100644
--- a/libs/midi++2/midi++/channel.h
+++ b/libs/midi++2/midi++/channel.h
@@ -22,7 +22,8 @@
#include <queue>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
+#include "pbd/scoped_connections.h"
#include "midi++/types.h"
#include "midi++/parser.h"
@@ -36,7 +37,7 @@ class Port;
* This remembers various useful information about the current 'state' of a
* MIDI channel (eg current pitch bend value).
*/
-class Channel : public sigc::trackable {
+class Channel : public PBD::ScopedConnectionList {
public:
Channel (byte channel_number, Port &);
diff --git a/libs/midi++2/midi++/manager.h b/libs/midi++2/midi++/manager.h
index 8c665d0086..d451d234c8 100644
--- a/libs/midi++2/midi++/manager.h
+++ b/libs/midi++2/midi++/manager.h
@@ -83,7 +83,7 @@ class Manager {
int get_known_ports (std::vector<PortSet>&);
- sigc::signal<void> PortsChanged;
+ boost::signals2::signal<void()> PortsChanged;
private:
/* This is a SINGLETON pattern */
diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h
index 4506bd8a4b..0b06222438 100644
--- a/libs/midi++2/midi++/mmc.h
+++ b/libs/midi++2/midi++/mmc.h
@@ -20,7 +20,8 @@
#ifndef __midipp_mmc_h_h__
#define __midipp_mmc_h_h__
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
+
#include "midi++/types.h"
namespace MIDI {
@@ -28,10 +29,10 @@ namespace MIDI {
class Port;
class Parser;
-class MachineControl : public sigc::trackable
-
+class MachineControl
{
public:
+ typedef boost::signals2::signal<void(MachineControl&)> MMCSignal;
typedef byte CommandSignature[60];
typedef byte ResponseSignature[60];
@@ -102,63 +103,61 @@ class MachineControl : public sigc::trackable
when certain MMC commands are received.
*/
- sigc::signal<void,MachineControl &> Stop;
- sigc::signal<void,MachineControl &> Play;
- sigc::signal<void,MachineControl &> DeferredPlay;
- sigc::signal<void,MachineControl &> FastForward;
- sigc::signal<void,MachineControl &> Rewind;
- sigc::signal<void,MachineControl &> RecordStrobe;
- sigc::signal<void,MachineControl &> RecordExit;
- sigc::signal<void,MachineControl &> RecordPause;
- sigc::signal<void,MachineControl &> Pause;
- sigc::signal<void,MachineControl &> Eject;
- sigc::signal<void,MachineControl &> Chase;
- sigc::signal<void,MachineControl &> CommandErrorReset;
- sigc::signal<void,MachineControl &> MmcReset;
-
- sigc::signal<void,MachineControl &> JogStart;
- sigc::signal<void,MachineControl &> JogStop;
-
- sigc::signal<void,MachineControl &> Write;
- sigc::signal<void,MachineControl &> MaskedWrite;
- sigc::signal<void,MachineControl &> Read;
- sigc::signal<void,MachineControl &> Update;
- sigc::signal<void,MachineControl &> VariablePlay;
- sigc::signal<void,MachineControl &> Search;
- sigc::signal<void,MachineControl &> AssignSystemMaster;
- sigc::signal<void,MachineControl &> GeneratorCommand;
- sigc::signal<void,MachineControl &> MidiTimeCodeCommand;
- sigc::signal<void,MachineControl &> Move;
- sigc::signal<void,MachineControl &> Add;
- sigc::signal<void,MachineControl &> Subtract;
- sigc::signal<void,MachineControl &> DropFrameAdjust;
- sigc::signal<void,MachineControl &> Procedure;
- sigc::signal<void,MachineControl &> Event;
- sigc::signal<void,MachineControl &> Group;
- sigc::signal<void,MachineControl &> CommandSegment;
- sigc::signal<void,MachineControl &> DeferredVariablePlay;
- sigc::signal<void,MachineControl &> RecordStrobeVariable;
- sigc::signal<void,MachineControl &> Wait;
- sigc::signal<void,MachineControl &> Resume;
+ MMCSignal Stop;
+ MMCSignal Play;
+ MMCSignal DeferredPlay;
+ MMCSignal FastForward;
+ MMCSignal Rewind;
+ MMCSignal RecordStrobe;
+ MMCSignal RecordExit;
+ MMCSignal RecordPause;
+ MMCSignal Pause;
+ MMCSignal Eject;
+ MMCSignal Chase;
+ MMCSignal CommandErrorReset;
+ MMCSignal MmcReset;
+ MMCSignal JogStart;
+ MMCSignal JogStop;
+ MMCSignal Write;
+ MMCSignal MaskedWrite;
+ MMCSignal Read;
+ MMCSignal Update;
+ MMCSignal VariablePlay;
+ MMCSignal Search;
+ MMCSignal AssignSystemMaster;
+ MMCSignal GeneratorCommand;
+ MMCSignal MidiTimeCodeCommand;
+ MMCSignal Move;
+ MMCSignal Add;
+ MMCSignal Subtract;
+ MMCSignal DropFrameAdjust;
+ MMCSignal Procedure;
+ MMCSignal Event;
+ MMCSignal Group;
+ MMCSignal CommandSegment;
+ MMCSignal DeferredVariablePlay;
+ MMCSignal RecordStrobeVariable;
+ MMCSignal Wait;
+ MMCSignal Resume;
/* The second argument is the shuttle speed, the third is
true if the direction is "forwards", false for "reverse"
*/
- sigc::signal<void,MachineControl &,float,bool> Shuttle;
+ boost::signals2::signal<void(MachineControl&,float,bool)> Shuttle;
/* The second argument specifies the desired track record enabled
status.
*/
- sigc::signal<void,MachineControl &,size_t,bool>
+ boost::signals2::signal<void(MachineControl &,size_t,bool)>
TrackRecordStatusChange;
/* The second argument specifies the desired track record enabled
status.
*/
- sigc::signal<void,MachineControl &,size_t,bool>
+ boost::signals2::signal<void(MachineControl &,size_t,bool)>
TrackMuteChange;
/* The second argument points to a byte array containing
@@ -166,11 +165,11 @@ class MachineControl : public sigc::trackable
format (5 bytes, roughly: hrs/mins/secs/frames/subframes)
*/
- sigc::signal<void,MachineControl &, const byte *> Locate;
+ boost::signals2::signal<void(MachineControl &, const byte *)> Locate;
/* The second argument is the number of steps to jump */
- sigc::signal<void,MachineControl &, int> Step;
+ boost::signals2::signal<void(MachineControl &, int)> Step;
protected:
@@ -258,7 +257,8 @@ class MachineControl : public sigc::trackable
MIDI::Port &_port;
void process_mmc_message (Parser &p, byte *, size_t len);
-
+ boost::signals2::scoped_connection mmc_connection;
+
int do_masked_write (byte *, size_t len);
int do_locate (byte *, size_t len);
int do_step (byte *, size_t len);
diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h
index 365f2fb46a..497a50abe8 100644
--- a/libs/midi++2/midi++/parser.h
+++ b/libs/midi++2/midi++/parser.h
@@ -23,7 +23,7 @@
#include <string>
#include <iostream>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
#include "midi++/types.h"
@@ -32,12 +32,14 @@ namespace MIDI {
class Port;
class Parser;
-typedef sigc::signal<void, Parser &, byte> OneByteSignal;
-typedef sigc::signal<void, Parser &, EventTwoBytes *> TwoByteSignal;
-typedef sigc::signal<void, Parser &, pitchbend_t> PitchBendSignal;
-typedef sigc::signal<void, Parser &, byte *, size_t> Signal;
+typedef boost::signals2::signal<void(Parser&)> ZeroByteSignal;
+typedef boost::signals2::signal<void(Parser&,nframes_t)> TimestampedSignal;
+typedef boost::signals2::signal<void(Parser&, byte)> OneByteSignal;
+typedef boost::signals2::signal<void(Parser &, EventTwoBytes *)> TwoByteSignal;
+typedef boost::signals2::signal<void(Parser &, pitchbend_t)> PitchBendSignal;
+typedef boost::signals2::signal<void(Parser &, byte *, size_t)> Signal;
-class Parser : public sigc::trackable {
+class Parser {
public:
Parser (Port &p);
~Parser ();
@@ -69,8 +71,8 @@ class Parser : public sigc::trackable {
OneByteSignal channel_program_change[16];
PitchBendSignal channel_pitchbend[16];
TwoByteSignal channel_controller[16];
- sigc::signal<void, Parser &> channel_active_preparse[16];
- sigc::signal<void, Parser &> channel_active_postparse[16];
+ ZeroByteSignal channel_active_preparse[16];
+ ZeroByteSignal channel_active_postparse[16];
OneByteSignal mtc_quarter_frame; /* see below for more useful signals */
Signal mtc;
@@ -82,15 +84,16 @@ class Parser : public sigc::trackable {
Signal position;
Signal song;
- sigc::signal<void, Parser &> all_notes_off;
- sigc::signal<void, Parser &> tune;
- sigc::signal<void, Parser &, nframes_t> timing;
- sigc::signal<void, Parser &, nframes_t> start;
- sigc::signal<void, Parser &, nframes_t> stop;
- sigc::signal<void, Parser &, nframes_t> contineu; /* note spelling */
- sigc::signal<void, Parser &> active_sense;
- sigc::signal<void, Parser &> reset;
- sigc::signal<void, Parser &> eox;
+ ZeroByteSignal all_notes_off;
+ ZeroByteSignal tune;
+ ZeroByteSignal active_sense;
+ ZeroByteSignal reset;
+ ZeroByteSignal eox;
+
+ TimestampedSignal timing;
+ TimestampedSignal start;
+ TimestampedSignal stop;
+ TimestampedSignal contineu; /* note spelling */
/* This should really be protected, but then derivatives of Port
can't access it.
@@ -106,9 +109,9 @@ class Parser : public sigc::trackable {
void set_offline (bool);
bool offline() const { return _offline; }
- sigc::signal<void> OfflineStatusChanged;
+ boost::signals2::signal<void()> OfflineStatusChanged;
- sigc::signal<int, byte *, size_t> edit;
+ boost::signals2::signal<int(byte *, size_t)> edit;
void set_mmc_forwarding (bool yn) {
_mmc_forward = yn;
@@ -121,10 +124,10 @@ class Parser : public sigc::trackable {
const byte *mtc_current() const { return _mtc_time; }
bool mtc_locked() const { return _mtc_locked; }
- sigc::signal<void,Parser&,int,nframes_t> mtc_qtr;
- sigc::signal<void,const byte*,bool,nframes_t> mtc_time;
- sigc::signal<void,MTC_Status> mtc_status;
- sigc::signal<bool> mtc_skipped;
+ boost::signals2::signal<void(Parser&,int,nframes_t)> mtc_qtr;
+ boost::signals2::signal<void(const byte*,bool,nframes_t)> mtc_time;
+ boost::signals2::signal<void(MTC_Status)> mtc_status;
+ boost::signals2::signal<bool()> mtc_skipped;
void set_mtc_forwarding (bool yn) {
_mtc_forward = yn;
@@ -139,7 +142,7 @@ class Parser : public sigc::trackable {
std::ostream *trace_stream;
std::string trace_prefix;
void trace_event (Parser &p, byte *msg, size_t len);
- sigc::connection trace_connection;
+ boost::signals2::scoped_connection trace_connection;
size_t message_counter[256];
diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h
index 23a9a01200..0c5fe4ae37 100644
--- a/libs/midi++2/midi++/port.h
+++ b/libs/midi++2/midi++/port.h
@@ -22,7 +22,7 @@
#include <string>
#include <iostream>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
#include "pbd/xml++.h"
#include "midi++/types.h"
@@ -33,7 +33,7 @@ namespace MIDI {
class Channel;
class PortRequest;
-class Port : public sigc::trackable {
+class Port {
public:
enum Type {
Unknown,
@@ -168,7 +168,6 @@ class Port : public sigc::trackable {
int _mode;
size_t _number;
Channel *_channel[16];
- sigc::connection thru_connection;
unsigned int bytes_written;
unsigned int bytes_read;
Parser *input_parser;
diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc
index 2e42bb59fc..e496e37aa9 100644
--- a/libs/midi++2/mmc.cc
+++ b/libs/midi++2/mmc.cc
@@ -206,8 +206,7 @@ MachineControl::MachineControl (Port &p, float /*version*/,
_send_device_id = 0x7f;
if ((parser = _port.input()) != 0) {
- parser->mmc.connect
- (mem_fun (*this, &MachineControl::process_mmc_message));
+ mmc_connection = parser->mmc.connect (boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3));
} else {
warning << "MMC connected to a non-input port: useless!"
<< endmsg;
diff --git a/libs/midi++2/parser.cc b/libs/midi++2/parser.cc
index 6daed45d23..4f19c40ebe 100644
--- a/libs/midi++2/parser.cc
+++ b/libs/midi++2/parser.cc
@@ -35,7 +35,6 @@
#include "pbd/transmitter.h"
using namespace std;
-using namespace sigc;
using namespace MIDI;
const char *
@@ -317,7 +316,7 @@ Parser::trace (bool onoff, ostream *o, const string &prefix)
cerr << "enabling tracing for port " << _port.name() << endl;
trace_stream = o;
trace_prefix = prefix;
- trace_connection = any.connect (mem_fun (*this, &Parser::trace_event));
+ trace_connection = any.connect (boost::bind (&Parser::trace_event, this, _1, _2, _3));
} else {
trace_prefix = "";
trace_stream = 0;