diff options
author | Robin Gareus <robin@gareus.org> | 2015-10-05 16:17:49 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-10-05 16:17:49 +0200 |
commit | 22b07e0233a29d9633ffa825a79503befaf2e16e (patch) | |
tree | 1d8b06056f8e12197158f5d906319767d3dedda5 /libs/midi++2 | |
parent | e11ba7b79d68bc1070b170236c22123966d7bcc3 (diff) |
NOOP, remove trailing tabs/whitespace.
Diffstat (limited to 'libs/midi++2')
-rw-r--r-- | libs/midi++2/channel.cc | 8 | ||||
-rw-r--r-- | libs/midi++2/ipmidi_port.cc | 20 | ||||
-rw-r--r-- | libs/midi++2/midi++/channel.h | 10 | ||||
-rw-r--r-- | libs/midi++2/midi++/ipmidi_port.h | 2 | ||||
-rw-r--r-- | libs/midi++2/midi++/midnam_patch.h | 46 | ||||
-rw-r--r-- | libs/midi++2/midi++/mmc.h | 26 | ||||
-rw-r--r-- | libs/midi++2/midi++/parser.h | 12 | ||||
-rw-r--r-- | libs/midi++2/midi++/port.h | 6 | ||||
-rw-r--r-- | libs/midi++2/miditrace.cc | 2 | ||||
-rw-r--r-- | libs/midi++2/midnam_patch.cc | 14 | ||||
-rw-r--r-- | libs/midi++2/mmc.cc | 26 | ||||
-rw-r--r-- | libs/midi++2/mmctest.cc | 2 | ||||
-rw-r--r-- | libs/midi++2/mtc.cc | 44 | ||||
-rw-r--r-- | libs/midi++2/parser.cc | 138 | ||||
-rw-r--r-- | libs/midi++2/port.cc | 8 |
15 files changed, 182 insertions, 182 deletions
diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc index 85631ecc6d..b3cb42f593 100644 --- a/libs/midi++2/channel.cc +++ b/libs/midi++2/channel.cc @@ -31,7 +31,7 @@ Channel::Channel (MIDI::byte channelnum, Port &p) _channel_number = channelnum; reset (0, 1, false); -} +} void Channel::connect_signals () @@ -137,7 +137,7 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) } else if ((tb->controller_number >= 32 && tb->controller_number <= 63)) { - + int cn = tb->controller_number - 32; cv = (unsigned short) _controller_val[cn]; @@ -153,7 +153,7 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) high 7. */ - + if (_controller_14bit[cn] == false) { _controller_14bit[cn] = true; cv = (cv << 7) | (tb->value & 0x7f); @@ -172,7 +172,7 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) } else { /* controller can only take 7 bit values */ - + _controller_val[tb->controller_number] = (controller_value_t) tb->value; } diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index 622bf76d16..ace51eae7d 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -105,7 +105,7 @@ IPMIDIPort::close_sockets () ::closesocket (sockin); sockin = -1; } - + if (sockout >= 0) { ::closesocket (sockout); sockout = -1; @@ -171,12 +171,12 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) addrin.sin_family = AF_INET; addrin.sin_addr.s_addr = htonl(INADDR_ANY); addrin.sin_port = htons(base_port); - + if (::bind(sockin, (struct sockaddr *) (&addrin), sizeof(addrin)) < 0) { ::perror("bind"); return false; } - + // Will Hall, 2007 // INADDR_ANY will bind to default interface, // specify alternate interface nameon which to bind... @@ -194,7 +194,7 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) } else { if_addr_in.s_addr = htonl (INADDR_ANY); } - + struct ip_mreq mreq; mreq.imr_multiaddr.s_addr = ::inet_addr("225.0.0.37"); mreq.imr_interface.s_addr = if_addr_in.s_addr; @@ -212,7 +212,7 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) ::perror("socket(out)"); return false; } - + // Will Hall, Oct 2007 if (!ifname.empty()) { struct in_addr if_addr_out; @@ -225,12 +225,12 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) return false; } } - + ::memset(&addrout, 0, sizeof(struct sockaddr_in)); addrout.sin_family = AF_INET; addrout.sin_addr.s_addr = ::inet_addr("225.0.0.37"); addrout.sin_port = htons (base_port); - + // Turn off loopback... int loop = 0; if (::setsockopt(sockout, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &loop, sizeof (loop)) < 0) { @@ -247,7 +247,7 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) error << "cannot set non-blocking mode for IP MIDI output socket (" << ::strerror (errno) << ')' << endmsg; return false; } - + return true; #else return false; @@ -282,7 +282,7 @@ IPMIDIPort::parse (framecnt_t timestamp) * parser. This will emit appropriate signals that will be handled * by anyone who cares. */ - + unsigned char buf[1024]; struct sockaddr_in sender; socklen_t slen = sizeof(sender); @@ -291,7 +291,7 @@ IPMIDIPort::parse (framecnt_t timestamp) if (r >= 0) { _parser->set_timestamp (timestamp); - + for (int i = 0; i < r; ++i) { _parser->scanner (buf[i]); } diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h index d397c99ea0..6f4928209a 100644 --- a/libs/midi++2/midi++/channel.h +++ b/libs/midi++2/midi++/channel.h @@ -79,19 +79,19 @@ class LIBMIDIPP_API Channel : public PBD::ScopedConnectionList { bool all_notes_off (timestamp_t timestamp) { return channel_msg (MIDI::controller, 123, 0, timestamp); } - + bool control (byte id, byte value, timestamp_t timestamp) { return channel_msg (MIDI::controller, id, value, timestamp); } - + bool note_on (byte note, byte velocity, timestamp_t timestamp) { return channel_msg (MIDI::on, note, velocity, timestamp); } - + bool note_off (byte note, byte velocity, timestamp_t timestamp) { return channel_msg (MIDI::off, note, velocity, timestamp); } - + bool aftertouch (byte value, timestamp_t timestamp) { return channel_msg (MIDI::chanpress, value, 0, timestamp); } @@ -140,7 +140,7 @@ class LIBMIDIPP_API Channel : public PBD::ScopedConnectionList { size_t _notes_on; void reset (timestamp_t timestamp, framecnt_t nframes, bool notes_off = true); - + void process_note_off (Parser &, EventTwoBytes *); void process_note_on (Parser &, EventTwoBytes *); void process_controller (Parser &, EventTwoBytes *); diff --git a/libs/midi++2/midi++/ipmidi_port.h b/libs/midi++2/midi++/ipmidi_port.h index 9e37253e52..313208892f 100644 --- a/libs/midi++2/midi++/ipmidi_port.h +++ b/libs/midi++2/midi++/ipmidi_port.h @@ -69,7 +69,7 @@ class LIBMIDIPP_API IPMIDIPort : public Port { static const int lowest_ipmidi_port_default = 21928; -private: +private: int sockin; int sockout; struct sockaddr_in addrout; diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index 45a251457e..e252e76fe1 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -48,18 +48,18 @@ public: : _bank(std::max(0, std::min(bank_num, 16383))) , _program(std::max(0, std::min(program_num, 127))) {} - + inline PatchPrimaryKey& operator=(const PatchPrimaryKey& id) { _bank = id._bank; _program = id._program; return *this; } - + inline bool operator==(const PatchPrimaryKey& id) const { return (_bank == id._bank && _program == id._program); } - + /** Strict weak ordering. */ inline bool operator<(const PatchPrimaryKey& id) const { if (_bank < id._bank) { @@ -82,7 +82,7 @@ private: }; class PatchBank; - + class LIBMIDIPP_API Patch { public: @@ -92,7 +92,7 @@ public: const std::string& name() const { return _name; } void set_name(const std::string& name) { _name = name; } - + const std::string& note_list_name() const { return _note_list_name; } uint8_t program_number() const { return _id.program(); } @@ -154,17 +154,17 @@ public: const std::string& name() const { return _name; } void set_name(const std::string& name) { _name = name; } - + const PatchBanks& patch_banks() const { return _patch_banks; } bool available_for_channel(uint8_t channel) const { return _available_for_channels.find(channel) != _available_for_channels.end(); } - + boost::shared_ptr<Patch> find_patch(const PatchPrimaryKey& key) { return _patch_map[key]; } - + boost::shared_ptr<Patch> previous_patch(const PatchPrimaryKey& key) { for (PatchList::const_iterator i = _patch_list.begin(); i != _patch_list.end(); @@ -176,10 +176,10 @@ public: } } } - + return boost::shared_ptr<Patch>(); } - + boost::shared_ptr<Patch> next_patch(const PatchPrimaryKey& key) { for (PatchList::const_iterator i = _patch_list.begin(); i != _patch_list.end(); @@ -192,7 +192,7 @@ public: } } } - + return boost::shared_ptr<Patch>(); } @@ -378,16 +378,16 @@ public: const std::string& name() const { return _name; } void set_name(const std::string& name) { _name = name; } - + XMLNode& get_state (void); int set_state (const XMLTree&, const XMLNode&); - + /// Note: channel here is 0-based while in the MIDNAM-file it's 1-based const std::string& channel_name_set_name_by_channel(uint8_t channel) { assert(channel <= 15); return _channel_name_set_assignments[channel]; } - + private: /// array index = channel number /// string contents = name of channel name set @@ -408,13 +408,13 @@ public: typedef std::map<std::string, boost::shared_ptr<ControlNameList> > ControlNameLists; typedef std::map<std::string, boost::shared_ptr<ValueNameList> > ValueNameLists; typedef std::map<std::string, PatchNameList> PatchNameLists; - + MasterDeviceNames() {}; virtual ~MasterDeviceNames() {}; - + const std::string& manufacturer() const { return _manufacturer; } void set_manufacturer(const std::string& manufacturer) { _manufacturer = manufacturer; } - + const Models& models() const { return _models; } void set_models(const Models some_models) { _models = some_models; } @@ -427,7 +427,7 @@ public: uint8_t number); const CustomDeviceModeNames& custom_device_mode_names() const { return _custom_device_mode_names; } - + boost::shared_ptr<CustomDeviceMode> custom_device_mode_by_name(const std::string& mode_name); boost::shared_ptr<ChannelNameSet> channel_name_set_by_channel(const std::string& mode, uint8_t channel); boost::shared_ptr<Patch> find_patch(const std::string& mode, uint8_t channel, const PatchPrimaryKey& key); @@ -445,7 +445,7 @@ public: XMLNode& get_state (void); int set_state (const XMLTree&, const XMLNode&); - + private: std::string _manufacturer; Models _models; @@ -463,20 +463,20 @@ class LIBMIDIPP_API MIDINameDocument public: // Maps Model names to MasterDeviceNames typedef std::map<std::string, boost::shared_ptr<MasterDeviceNames> > MasterDeviceNamesList; - + MIDINameDocument() {} MIDINameDocument(const std::string& filename); virtual ~MIDINameDocument() {}; const std::string& author() const { return _author; } void set_author(const std::string& author) { _author = author; } - + boost::shared_ptr<MasterDeviceNames> master_device_names(const std::string& model); const MasterDeviceNamesList& master_device_names_by_model() const { return _master_device_names_list; } - + const MasterDeviceNames::Models& all_models() const { return _all_models; } - + XMLNode& get_state (void); int set_state (const XMLTree&, const XMLNode&); diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h index 3529031caf..caf1605c29 100644 --- a/libs/midi++2/midi++/mmc.h +++ b/libs/midi++2/midi++/mmc.h @@ -60,10 +60,10 @@ class LIBMIDIPP_API MachineControl cmdChase = 0xB, cmdCommandErrorReset = 0xC, cmdMmcReset = 0xD, - + cmdIllegalMackieJogStart = 0x20, cmdIllegalMackieJogStop = 0x21, - + cmdWrite = 0x40, cmdMaskedWrite = 0x41, cmdRead = 0x42, @@ -93,14 +93,14 @@ class LIBMIDIPP_API MachineControl cmdWait = 0x7C, cmdResume = 0x7F }; - + MachineControl (); void set_ports (MIDI::Port* input, MIDI::Port* output); Port* input_port() { return _input_port; } Port* output_port() { return _output_port; } - + void set_receive_device_id (byte id); void set_send_device_id (byte id); byte receive_device_id () const { return _receive_device_id; } @@ -114,7 +114,7 @@ class LIBMIDIPP_API MachineControl /* Signals to connect to if you want to run "callbacks" when certain MMC commands are received. */ - + MMCSignal Stop; MMCSignal Play; MMCSignal DeferredPlay; @@ -159,7 +159,7 @@ class LIBMIDIPP_API MachineControl /* The second argument is the shuttle speed, the third is true if the direction is "forwards", false for "reverse" */ - + PBD::Signal3<void,MachineControl&,float,bool> Shuttle; /* The second argument specifies the desired track record enabled @@ -168,14 +168,14 @@ class LIBMIDIPP_API MachineControl PBD::Signal3<void,MachineControl &,size_t,bool> TrackRecordStatusChange; - + /* The second argument specifies the desired track record enabled status. */ PBD::Signal3<void,MachineControl &,size_t,bool> TrackMuteChange; - + /* The second argument points to a byte array containing the locate target value in MMC Standard Time Code format (5 bytes, roughly: hrs/mins/secs/frames/subframes) @@ -184,13 +184,13 @@ class LIBMIDIPP_API MachineControl PBD::Signal2<void,MachineControl &, const byte *> Locate; /* The second argument is the number of steps to jump */ - + PBD::Signal2<void,MachineControl &, int> Step; #define MMC_NTRACKS 48 /* note: these are not currently in use */ - + byte updateRate; byte responseError; byte commandError; @@ -261,7 +261,7 @@ class LIBMIDIPP_API MachineControl byte responseSegment; byte wait; byte resume; - + private: byte _receive_device_id; byte _send_device_id; @@ -276,7 +276,7 @@ class LIBMIDIPP_API MachineControl int do_locate (byte *, size_t len); int do_step (byte *, size_t len); int do_shuttle (byte *, size_t len); - + void write_track_status (byte *, size_t len, byte reg); void spp_start (); void spp_continue (); @@ -293,7 +293,7 @@ public: MachineControlCommand () : _command (MachineControl::Command (0)) {} MachineControlCommand (MachineControl::Command); MachineControlCommand (Timecode::Time); - + MIDI::byte* fill_buffer (MachineControl *mmc, MIDI::byte *) const; private: diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h index 05d674375c..0f2ecf49fd 100644 --- a/libs/midi++2/midi++/parser.h +++ b/libs/midi++2/midi++/parser.h @@ -50,12 +50,12 @@ class LIBMIDIPP_API Parser { message the next time ::scanner() parses such a message. It should therefore be set before every byte passed into ::scanner(). */ - + framecnt_t get_timestamp() const { return _timestamp; } void set_timestamp (const framecnt_t timestamp) { _timestamp = timestamp; } /* signals that anyone can connect to */ - + BankSignal bank_change; TwoByteSignal note_on; TwoByteSignal note_off; @@ -124,7 +124,7 @@ class LIBMIDIPP_API Parser { MTC_Status mtc_running() const { return _mtc_running; } const byte *mtc_current() const { return _mtc_time; } bool mtc_locked() const { return _mtc_locked; } - + 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; @@ -135,10 +135,10 @@ class LIBMIDIPP_API Parser { } void reset_mtc_state (); - + private: /* tracing */ - + std::ostream *trace_stream; std::string trace_prefix; void trace_event (Parser &p, byte *msg, size_t len); @@ -171,7 +171,7 @@ class LIBMIDIPP_API Parser { MTC_Status _mtc_running; bool _mtc_locked; byte last_qtr_frame; - + framecnt_t _timestamp; ParseState pre_variable_state; diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index 1f85b53cd4..6d933f6a6d 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -46,7 +46,7 @@ class LIBMIDIPP_API Port { IsInput = 0x1, /* MUST MATCH JACK's JackPortIsInput */ IsOutput = 0x2, /* MUST MATCH JACK's JackPortIsOutput */ }; - + Port (std::string const &, Flags); Port (const XMLNode&); virtual ~Port (); @@ -99,11 +99,11 @@ class LIBMIDIPP_API Port { Channel *channel (channel_t chn) { return _channel[chn&0x7F]; } - + Parser* parser () { return _parser; } - + const char *name () const { return _tagname.c_str(); } bool ok () const { return _ok; } diff --git a/libs/midi++2/miditrace.cc b/libs/midi++2/miditrace.cc index 21cd3ba457..1b8c107b87 100644 --- a/libs/midi++2/miditrace.cc +++ b/libs/midi++2/miditrace.cc @@ -58,7 +58,7 @@ main (int argc, char *argv[]) { byte buf[1]; - + text_receiver.listen_to (error); text_receiver.listen_to (info); text_receiver.listen_to (fatal); diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index 9f62c12dfe..2205e5e2a0 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -35,7 +35,7 @@ namespace MIDI namespace Name { - + Patch::Patch (std::string name, uint8_t p_number, uint16_t b_number) : _name (name) , _id (p_number, b_number) @@ -138,7 +138,7 @@ Patch::set_state (const XMLTree& tree, const XMLNode& node) return -1; // Failed to find a program number anywhere } } - + XMLNode* use_note_name_list = node.child("UsesNoteNameList"); if (use_note_name_list) { _note_list_name = use_note_name_list->property ("Name")->value(); @@ -478,7 +478,7 @@ operator<< (std::ostream& os, const ChannelNameSet& cns) os << (int) (*x) << ' '; } os << endl; - + for (ChannelNameSet::PatchBanks::const_iterator pbi = cns._patch_banks.begin(); pbi != cns._patch_banks.end(); ++pbi) { os << "\tPatch Bank " << (*pbi)->name() << " with " << (*pbi)->patch_name_list().size() << " patches\n"; for (PatchNameList::const_iterator pni = (*pbi)->patch_name_list().begin(); pni != (*pbi)->patch_name_list().end(); ++pni) { @@ -493,12 +493,12 @@ void ChannelNameSet::set_patch_banks (const ChannelNameSet::PatchBanks& pb) { _patch_banks = pb; - + _patch_map.clear (); _patch_list.clear (); _patch_list_name = ""; _available_for_channels.clear (); - + for (PatchBanks::const_iterator pbi = _patch_banks.begin(); pbi != _patch_banks.end(); ++pbi) { for (PatchNameList::const_iterator pni = (*pbi)->patch_name_list().begin(); pni != (*pbi)->patch_name_list().end(); ++pni) { _patch_map[(*pni)->patch_primary_key()] = (*pni); @@ -898,7 +898,7 @@ MIDINameDocument::set_state (const XMLTree& tree, const XMLNode&) error << "No author information in MIDNAM file" << endmsg; return -1; } - + if (author->front()->children().size() > 0) { _author = author->front()->children().front()->content(); } @@ -922,7 +922,7 @@ MIDINameDocument::set_state (const XMLTree& tree, const XMLNode&) _master_device_names_list.insert( std::pair<std::string, boost::shared_ptr<MasterDeviceNames> > (*model, master_device_names)); - + _all_models.insert(*model); } } diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc index 074064f7bd..d9ad077865 100644 --- a/libs/midi++2/mmc.cc +++ b/libs/midi++2/mmc.cc @@ -256,7 +256,7 @@ MachineControl::is_mmc (MIDI::byte *sysex_buf, size_t len) sysex_buf[3] != 0x7) { /* MMC Response */ return false; } - + return true; } @@ -465,7 +465,7 @@ MachineControl::process_mmc_message (Parser &, MIDI::byte *msg, size_t len) len -= skiplen; } while (len > 1); /* skip terminating EOX byte */ -} +} int MachineControl::do_masked_write (MIDI::byte *msg, size_t len) @@ -473,7 +473,7 @@ MachineControl::do_masked_write (MIDI::byte *msg, size_t len) /* return the number of bytes "consumed" */ int retval = msg[1] + 2; /* bytes following + 2 */ - + switch (msg[2]) { case 0x4f: /* Track Record Ready Status */ write_track_status (&msg[3], len - 3, msg[2]); @@ -508,7 +508,7 @@ MachineControl::write_track_status (MIDI::byte *msg, size_t /*len*/, MIDI::byte bit 4: aux track b the format of the message (its an MMC Masked Write) is: - + 0x41 Command Code <count> byte count of following data <name> byte value of the field being written @@ -516,7 +516,7 @@ MachineControl::write_track_status (MIDI::byte *msg, size_t /*len*/, MIDI::byte bitmap being written to <mask> ones in the mask indicate which bits will be changed <data> new data for the byte being written - + by the time this code is executing, msg[0] is the byte number of the target byte. if its zero, we are writing to a special byte in the standard @@ -524,20 +524,20 @@ MachineControl::write_track_status (MIDI::byte *msg, size_t /*len*/, MIDI::byte special. hence the bits for tracks 1 + 2 are bits 5 and 6 of the first byte of the track bitmap. so: - + change track 1: msg[0] = 0; << first byte of track bitmap msg[1] = 0100000; << binary: bit 5 set - + change track 2: msg[0] = 0; << first byte of track bitmap msg[1] = 1000000; << binary: bit 6 set - + change track 3: msg[0] = 1; << second byte of track bitmap msg[1] = 0000001; << binary: bit 0 set - + the (msg[0] * 8) - 6 computation is an attempt to extract the value of the first track: ie. the one that would be indicated by bit 0 being set. - + so, if msg[0] = 0, msg[1] = 0100000 (binary), what happens is that base_track = -5, but by the time we check the correct bit, n = 5, and so the @@ -565,13 +565,13 @@ MachineControl::write_track_status (MIDI::byte *msg, size_t /*len*/, MIDI::byte */ bool val = (msg[2] & (1<<n)); - + switch (reg) { case 0x4f: trackRecordStatus[base_track+n] = val; TrackRecordStatusChange (*this, base_track+n, val); break; - + case 0x62: trackMute[base_track+n] = val; TrackMuteChange (*this, base_track+n, val); @@ -627,7 +627,7 @@ MachineControl::do_shuttle (MIDI::byte *msg, size_t /*msglen*/) } else { forward = true; } - + left_shift = (sh & 0x38); integral = ((sh & 0x7) << left_shift) | (sm >> (7 - left_shift)); diff --git a/libs/midi++2/mmctest.cc b/libs/midi++2/mmctest.cc index 9259e3ad2b..e81126cba7 100644 --- a/libs/midi++2/mmctest.cc +++ b/libs/midi++2/mmctest.cc @@ -102,7 +102,7 @@ main (int argc, char *argv[]) { byte buf[1]; - + text_receiver.listen_to (error); text_receiver.listen_to (info); text_receiver.listen_to (fatal); diff --git a/libs/midi++2/mtc.cc b/libs/midi++2/mtc.cc index f23c6d832c..7f7506c344 100644 --- a/libs/midi++2/mtc.cc +++ b/libs/midi++2/mtc.cc @@ -45,12 +45,12 @@ Parser::possible_mtc (MIDI::byte *sysex_buf, size_t msglen) } /* full MTC */ - + fake_mtc_time[0] = sysex_buf[8]; // frames fake_mtc_time[1] = sysex_buf[7]; // minutes fake_mtc_time[2] = sysex_buf[6]; // seconds fake_mtc_time[3] = (sysex_buf[5] & 0x1f); // hours - + _mtc_fps = MTC_FPS ((sysex_buf[5] & 0x60) >> 5); // fps fake_mtc_time[4] = (byte) _mtc_fps; @@ -108,7 +108,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) #endif if (_mtc_running == MTC_Stopped) { - + /* we are stopped but are seeing qtr frame messages */ if (consecutive_qtr_frame_cnt == 0) { @@ -116,11 +116,11 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) /* first quarter frame */ if (which_quarter_frame != 0 && which_quarter_frame != 7) { - + last_qtr_frame = which_quarter_frame; consecutive_qtr_frame_cnt++; } - + // cerr << "first seen qframe = " << (int) last_qtr_frame << endl; return; @@ -128,7 +128,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) } else if (consecutive_qtr_frame_cnt == 1) { /* third quarter frame */ - + #ifdef DEBUG_MTC cerr << "second seen qframe = " << (int) which_quarter_frame << endl; #endif @@ -155,7 +155,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) case MTC_Backward: if (which_quarter_frame == 0) { expected_mtc_quarter_frame_code = 7; - + } else { expected_mtc_quarter_frame_code = which_quarter_frame - 1; } @@ -164,9 +164,9 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) case MTC_Stopped: break; } - + } else { - + /* already running */ // for testing bad MIDI connections etc. @@ -186,7 +186,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) */ boost::optional<bool> res = mtc_skipped (); - + if (res.get_value_or (false)) { /* no error, reset next expected frame */ @@ -203,7 +203,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) case MTC_Backward: if (which_quarter_frame == 0) { expected_mtc_quarter_frame_code = 7; - + } else { expected_mtc_quarter_frame_code = which_quarter_frame - 1; } @@ -215,7 +215,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) #ifdef DEBUG_MTC cerr << "SKIPPED, next expected = " << expected_mtc_quarter_frame_code << endl; -#endif +#endif return; } @@ -226,7 +226,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) #endif reset_mtc_state (); mtc_status (MTC_Stopped); - + return; } else { @@ -267,18 +267,18 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) case 5: // minutes MS nibble _qtr_mtc_time[2] |= (msg[1] & 0xf)<<4; break; - + case 6: // hours LS nibble _qtr_mtc_time[3] |= msg[1] & 0xf; break; case 7: - + /* last quarter frame msg has the MS bit of the hour in bit 0, and the SMPTE FPS type in bits 5 and 6 */ - + _qtr_mtc_time[3] |= ((msg[1] & 0x1) << 4); _mtc_fps = MTC_FPS ((msg[1] & 0x6) >> 1); _qtr_mtc_time[4] = _mtc_fps; @@ -289,7 +289,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) break; } - + #ifdef DEBUG_MTC cerr << "Emit MTC Qtr\n"; #endif @@ -301,12 +301,12 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) switch (_mtc_running) { case MTC_Forward: if (which_quarter_frame == 7) { - + /* we've reached the final of 8 quarter frame messages. store the time, reset the pending time holder, and signal anyone who wants to know the time. */ - + if (consecutive_qtr_frame_cnt >= 8) { memcpy (_mtc_time, _qtr_mtc_time, sizeof (_mtc_time)); memset (_qtr_mtc_time, 0, sizeof (_qtr_mtc_time)); @@ -317,15 +317,15 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) mtc_time (_mtc_time, false, _timestamp); } expected_mtc_quarter_frame_code = 0; - + } else { expected_mtc_quarter_frame_code = which_quarter_frame + 1; } break; - + case MTC_Backward: if (which_quarter_frame == 0) { - + /* we've reached the final of 8 quarter frame messages. store the time, reset the pending time holder, and signal anyone who wants to know the time. diff --git a/libs/midi++2/parser.cc b/libs/midi++2/parser.cc index f324047713..e11094d26f 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -50,55 +50,55 @@ Parser::midi_event_type_name (eventType t) case MIDI::any: return "any midi message"; - + case off: return "note off"; - + case on: return "note on"; - + case polypress: return "aftertouch"; - + case MIDI::controller: return "controller"; - + case program: return "program change"; - + case chanpress: return "channel pressure"; - + case MIDI::pitchbend: return "pitch bend"; - + case MIDI::sysex: return "system exclusive"; - + case MIDI::song: return "song position"; - + case MIDI::tune: return "tune"; - + case MIDI::eox: return "end of sysex"; - + case MIDI::timing: return "timing"; - + case MIDI::start: return "start"; - + case MIDI::stop: return "continue"; - + case MIDI::contineu: return "stop"; - + case active: return "active sense"; - + default: return "unknow MIDI event type"; } @@ -144,7 +144,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) if ((o = trace_stream) == NULL) { /* can be asynchronously removed */ return; } - + type = (eventType) (msg[0]&0xF0); switch (type) { @@ -158,7 +158,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << (int) msg[2] << endmsg; break; - + case on: *o << trace_prefix << "Channel " @@ -169,7 +169,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << (int) msg[2] << endmsg; break; - + case polypress: *o << trace_prefix << "Channel " @@ -178,7 +178,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << (int) msg[1] << endmsg; break; - + case MIDI::controller: *o << trace_prefix << "Channel " @@ -189,7 +189,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << (int) msg[2] << endmsg; break; - + case program: *o << trace_prefix << "Channel " @@ -198,7 +198,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << (int) msg[1] << endmsg; break; - + case chanpress: *o << trace_prefix << "Channel " @@ -207,7 +207,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << (int) msg[1] << endmsg; break; - + case MIDI::pitchbend: *o << trace_prefix << "Channel " @@ -216,7 +216,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << ((msg[2]<<7)|msg[1]) << endmsg; break; - + case MIDI::sysex: if (len == 1) { switch (msg[0]) { @@ -253,7 +253,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) default: *o << trace_prefix << "System Exclusive (1 byte : " << hex << (int) *msg << dec << ')' - << endmsg; + << endmsg; break; } } else { @@ -263,42 +263,42 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) *o << (int) msgbuf[i] << ' '; } *o << dec << ']' << endmsg; - + } break; - + case MIDI::song: *o << trace_prefix << "Song" << endmsg; break; - + case MIDI::tune: *o << trace_prefix << "Tune" << endmsg; break; - + case MIDI::eox: *o << trace_prefix << "End-of-System Exclusive" << endmsg; break; - + case MIDI::timing: *o << trace_prefix << "Timing" << endmsg; break; - + case MIDI::start: *o << trace_prefix << "Start" << endmsg; break; - + case MIDI::stop: *o << trace_prefix << "Stop" << endmsg; break; - + case MIDI::contineu: *o << trace_prefix << "Continue" << endmsg; break; - + case active: *o << trace_prefix << "Active Sense" << endmsg; break; - + default: *o << trace_prefix << "Unrecognized MIDI message" << endmsg; break; @@ -327,9 +327,9 @@ Parser::scanner (unsigned char inbyte) boost::optional<int> edit_result; // cerr << "parse: " << hex << (int) inbyte << dec << " state = " << state << " msgindex = " << msgindex << " runnable = " << runnable << endl; - + /* Check active sensing early, so it doesn't interrupt sysex. - + NOTE: active sense messages are not considered to fit under "any" for the purposes of callbacks. If a caller wants active sense messages handled, which is unlikely, then @@ -337,7 +337,7 @@ Parser::scanner (unsigned char inbyte) every other MIDI message in terms of semantics that its counter-productive to treat them similarly. */ - + if (inbyte == 0xfe) { message_counter[inbyte]++; if (!_offline) { @@ -345,21 +345,21 @@ Parser::scanner (unsigned char inbyte) } return; } - + /* If necessary, allocate larger message buffer. */ - + if (msgindex >= msglen) { msglen *= 2; msgbuf = (unsigned char *) realloc (msgbuf, msglen); } - + /* Real time messages can occur ANYPLACE, but do not interrupt running status. */ bool rtmsg = false; - + switch (inbyte) { case 0xf8: rtmsg = true; @@ -386,11 +386,11 @@ Parser::scanner (unsigned char inbyte) if (rtmsg) { boost::optional<int> res = edit (&inbyte, 1); - + if (res.get_value_or (1) >= 0 && !_offline) { realtime_msg (inbyte); } - + return; } @@ -438,11 +438,11 @@ Parser::scanner (unsigned char inbyte) } } } - + /* * Status bytes always start a new message, except EOX */ - + if (statusbit) { msgindex = 0; @@ -469,11 +469,11 @@ Parser::scanner (unsigned char inbyte) return; } - + /* * We've got a Data byte. */ - + msgbuf[msgindex++] = inbyte; switch (state) { @@ -487,29 +487,29 @@ Parser::scanner (unsigned char inbyte) * messages, so just handle it silently. */ break; - + case NEEDTWOBYTES: /* wait for the second byte */ if (msgindex < 3) return; /*FALLTHRU*/ - + case NEEDONEBYTE: /* We've completed a 1 or 2 byte message. */ edit_result = edit (msgbuf, msgindex); if (edit_result.get_value_or (1)) { - + /* message not cancelled by an editor */ - + message_counter[msgbuf[0] & 0xF0]++; if (!_offline) { signal (msgbuf, msgindex); } } - + if (runnable) { /* In Runnable mode, we reset the message index, but keep the callbacks_pending and state the @@ -522,7 +522,7 @@ Parser::scanner (unsigned char inbyte) state = NEEDSTATUS; } break; - + case VARIABLELENGTH: /* nothing to do */ break; @@ -666,7 +666,7 @@ Parser::signal (MIDI::byte *msg, size_t len) switch (msgtype) { case none: break; - + case off: channel_active_preparse[chan_i] (*this); note_off (*this, (EventTwoBytes *) &msg[1]); @@ -674,7 +674,7 @@ Parser::signal (MIDI::byte *msg, size_t len) (*this, (EventTwoBytes *) &msg[1]); channel_active_postparse[chan_i] (*this); break; - + case on: channel_active_preparse[chan_i] (*this); @@ -694,7 +694,7 @@ Parser::signal (MIDI::byte *msg, size_t len) channel_active_postparse[chan_i] (*this); break; - + case MIDI::controller: channel_active_preparse[chan_i] (*this); controller (*this, (EventTwoBytes *) &msg[1]); @@ -702,21 +702,21 @@ Parser::signal (MIDI::byte *msg, size_t len) (*this, (EventTwoBytes *) &msg[1]); channel_active_postparse[chan_i] (*this); break; - + case program: channel_active_preparse[chan_i] (*this); program_change (*this, msg[1]); channel_program_change[chan_i] (*this, msg[1]); channel_active_postparse[chan_i] (*this); break; - + case chanpress: channel_active_preparse[chan_i] (*this); pressure (*this, msg[1]); channel_pressure[chan_i] (*this, msg[1]); channel_active_postparse[chan_i] (*this); break; - + case polypress: channel_active_preparse[chan_i] (*this); poly_pressure (*this, (EventTwoBytes *) &msg[1]); @@ -724,14 +724,14 @@ Parser::signal (MIDI::byte *msg, size_t len) (*this, (EventTwoBytes *) &msg[1]); channel_active_postparse[chan_i] (*this); break; - + case MIDI::pitchbend: channel_active_preparse[chan_i] (*this); pitchbend (*this, (msg[2]<<7)|msg[1]); channel_pitchbend[chan_i] (*this, (msg[2]<<7)|msg[1]); channel_active_postparse[chan_i] (*this); break; - + case MIDI::sysex: sysex (*this, msg, len); break; @@ -740,23 +740,23 @@ Parser::signal (MIDI::byte *msg, size_t len) process_mtc_quarter_frame (msg); mtc_quarter_frame (*this, *msg); break; - + case MIDI::position: position (*this, msg, len); break; - + case MIDI::song: song (*this, msg, len); break; - + case MIDI::tune: tune (*this); - + default: /* XXX some kind of warning ? */ break; } - + any (*this, msg, len); } @@ -788,7 +788,7 @@ Parser::set_offline (bool yn) /* this hack deals with the possibility of our first MIDI bytes being running status messages. */ - + channel_msg (0x90); state = NEEDSTATUS; } diff --git a/libs/midi++2/port.cc b/libs/midi++2/port.cc index d214755248..629dff0796 100644 --- a/libs/midi++2/port.cc +++ b/libs/midi++2/port.cc @@ -92,11 +92,11 @@ bool Port::clock (timestamp_t timestamp) { static byte clockmsg = 0xf8; - + if (sends_output()) { return midimsg (&clockmsg, 1, timestamp); } - + return false; } @@ -150,7 +150,7 @@ Port::get_state () const } else { root->add_property ("mode", "output"); } - + #if 0 byte device_inquiry[6]; @@ -160,7 +160,7 @@ Port::get_state () const device_inquiry[0] = 0x06; device_inquiry[0] = 0x02; device_inquiry[0] = 0xf7; - + write (device_inquiry, sizeof (device_inquiry), 0); #endif |