Fix copy/paste typo in e0a83a7
[ardour.git] / libs / midi++2 / midi++ / parser.h
index b8364cc02525b850c9972f7325960300a902f5dc..7040e9b522a6c613350d27c31f1ca12759117dec 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 1998 Paul Barton-Davis
-    
+
     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
@@ -23,8 +23,9 @@
 #include <string>
 #include <iostream>
 
-#include <sigc++/sigc++.h>
+#include "pbd/signals.h"
 
+#include "midi++/libmidi_visibility.h"
 #include "midi++/types.h"
 
 namespace MIDI {
@@ -32,27 +33,32 @@ 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;
-
-class Parser : public sigc::trackable {
+typedef PBD::Signal1<void,Parser&>                   ZeroByteSignal;
+typedef PBD::Signal2<void,Parser&,unsigned short>    BankSignal;
+typedef PBD::Signal2<void,Parser&,framecnt_t>        TimestampedSignal;
+typedef PBD::Signal2<void,Parser&, byte>             OneByteSignal;
+typedef PBD::Signal2<void,Parser &, EventTwoBytes *> TwoByteSignal;
+typedef PBD::Signal2<void,Parser &, pitchbend_t>     PitchBendSignal;
+typedef PBD::Signal3<void,Parser &, uint16_t, int>   RPNSignal;
+typedef PBD::Signal3<void,Parser &, uint16_t, float> RPNValueSignal;
+typedef PBD::Signal3<void,Parser &, byte *, size_t>  Signal;
+
+class LIBMIDIPP_API Parser {
  public:
-       Parser (Port &p);
+       Parser ();
        ~Parser ();
 
        /* sets the time that will be reported for any MTC or MIDI Clock
           message the next time ::scanner() parses such a message. It should
           therefore be set before every byte passed into ::scanner().
        */
-       
-       nframes_t get_timestamp() const { return _timestamp; }
-       void set_timestamp (const nframes_t timestamp) { _timestamp = timestamp; } 
+
+       framecnt_t get_timestamp() const { return _timestamp; }
+       void set_timestamp (const framecnt_t timestamp) { _timestamp = timestamp; }
 
        /* signals that anyone can connect to */
-       
-       OneByteSignal         bank_change;
+
+       BankSignal            bank_change;
        TwoByteSignal         note_on;
        TwoByteSignal         note_off;
        TwoByteSignal         poly_pressure;
@@ -61,7 +67,7 @@ class Parser : public sigc::trackable {
        PitchBendSignal       pitchbend;
        TwoByteSignal         controller;
 
-       OneByteSignal         channel_bank_change[16];
+       BankSignal            channel_bank_change[16];
        TwoByteSignal         channel_note_on[16];
        TwoByteSignal         channel_note_off[16];
        TwoByteSignal         channel_poly_pressure[16];
@@ -69,8 +75,12 @@ 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];
+       RPNValueSignal        channel_rpn[16];
+       RPNValueSignal        channel_nrpn[16];
+       RPNSignal             channel_rpn_change[16];
+       RPNSignal             channel_nrpn_change[16];
 
        OneByteSignal         mtc_quarter_frame; /* see below for more useful signals */
        Signal                mtc;
@@ -82,15 +92,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.
@@ -102,13 +113,12 @@ class Parser : public sigc::trackable {
        const char *midi_event_type_name (MIDI::eventType);
        void trace (bool onoff, std::ostream *o, const std::string &prefix = "");
        bool tracing() { return trace_stream != 0; }
-       Port &port() { return _port; }
 
        void set_offline (bool);
        bool offline() const { return _offline; }
-       sigc::signal<void> OfflineStatusChanged;
+       PBD::Signal0<void> OfflineStatusChanged;
 
-       sigc::signal<int, byte *, size_t> edit;
+       PBD::Signal2<int,byte *, size_t> edit;
 
        void set_mmc_forwarding (bool yn) {
                _mmc_forward = yn;
@@ -116,40 +126,33 @@ class Parser : public sigc::trackable {
 
        /* MTC */
 
-       enum MTC_Status {
-               MTC_Stopped = 0,
-               MTC_Forward,
-               MTC_Backward
-       };
-
        MTC_FPS mtc_fps() const { return _mtc_fps; }
        MTC_Status  mtc_running() const { return _mtc_running; }
        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;
+
+       PBD::Signal3<void, Parser &, int, framecnt_t>      mtc_qtr;
+       PBD::Signal3<void, const byte *, bool, framecnt_t> mtc_time;
+       PBD::Signal1<void, MTC_Status>                     mtc_status;
+       PBD::Signal0<bool>                                 mtc_skipped;
 
        void set_mtc_forwarding (bool yn) {
                _mtc_forward = yn;
        }
 
        void reset_mtc_state ();
-       
+
   private:
-       Port &_port;
        /* tracing */
 
        std::ostream *trace_stream;
        std::string trace_prefix;
        void trace_event (Parser &p, byte *msg, size_t len);
-       sigc::connection trace_connection;
+       PBD::ScopedConnection trace_connection;
 
        size_t message_counter[256];
 
-       enum ParseState { 
+       enum ParseState {
                NEEDSTATUS,
                NEEDONEBYTE,
                NEEDTWOBYTES,
@@ -174,8 +177,8 @@ class Parser : public sigc::trackable {
        MTC_Status _mtc_running;
        bool       _mtc_locked;
        byte last_qtr_frame;
-       
-       nframes_t _timestamp;
+
+       framecnt_t _timestamp;
 
        ParseState pre_variable_state;
        MIDI::eventType pre_variable_msgtype;