diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-04 14:51:05 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-04 14:51:05 -0400 |
commit | 4dc63966f0872efe768dad61eb9b8785d06b92d1 (patch) | |
tree | e54104d57d6c2da7840979181368151fd0819c96 /libs/midi++2 | |
parent | 297e80e020da94a56984b20782584bb1dd96ea34 (diff) |
globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
Diffstat (limited to 'libs/midi++2')
-rw-r--r-- | libs/midi++2/channel.cc | 36 | ||||
-rw-r--r-- | libs/midi++2/ipmidi_port.cc | 8 | ||||
-rw-r--r-- | libs/midi++2/midi++/channel.h | 14 | ||||
-rw-r--r-- | libs/midi++2/midi++/event.h | 4 | ||||
-rw-r--r-- | libs/midi++2/midi++/ipmidi_port.h | 8 | ||||
-rw-r--r-- | libs/midi++2/midi++/libmidi_visibility.h | 2 | ||||
-rw-r--r-- | libs/midi++2/midi++/midnam_patch.h | 18 | ||||
-rw-r--r-- | libs/midi++2/midi++/mmc.h | 10 | ||||
-rw-r--r-- | libs/midi++2/midi++/parser.h | 6 | ||||
-rw-r--r-- | libs/midi++2/midi++/port.h | 12 | ||||
-rw-r--r-- | libs/midi++2/midi++/types.h | 2 | ||||
-rw-r--r-- | libs/midi++2/midi.cc | 4 | ||||
-rw-r--r-- | libs/midi++2/miditrace.cc | 10 | ||||
-rw-r--r-- | libs/midi++2/midnam_patch.cc | 8 | ||||
-rw-r--r-- | libs/midi++2/mmc.cc | 22 | ||||
-rw-r--r-- | libs/midi++2/mmctest.cc | 8 | ||||
-rw-r--r-- | libs/midi++2/mtc.cc | 16 | ||||
-rw-r--r-- | libs/midi++2/parser.cc | 114 | ||||
-rw-r--r-- | libs/midi++2/port.cc | 4 |
19 files changed, 153 insertions, 153 deletions
diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc index 67d6f5fb11..85631ecc6d 100644 --- a/libs/midi++2/channel.cc +++ b/libs/midi++2/channel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1998-99 Paul Barton-Davis + Copyright (C) 1998-99 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 @@ -25,7 +25,7 @@ using namespace MIDI; -Channel::Channel (MIDI::byte channelnum, Port &p) +Channel::Channel (MIDI::byte channelnum, Port &p) : _port (p) { _channel_number = channelnum; @@ -66,7 +66,7 @@ Channel::reset (timestamp_t timestamp, framecnt_t /*nframes*/, bool notes_off) memset (_polypress, 0, sizeof (_polypress)); memset (_controller_msb, 0, sizeof (_controller_msb)); memset (_controller_lsb, 0, sizeof (_controller_lsb)); - + /* zero all controllers XXX not necessarily the right thing */ memset (_controller_val, 0, sizeof (_controller_val)); @@ -87,7 +87,7 @@ Channel::reset (timestamp_t timestamp, framecnt_t /*nframes*/, bool notes_off) } void -Channel::process_note_off (Parser & /*parser*/, EventTwoBytes *tb) +Channel::process_note_off (Parser & /*parser*/, EventTwoBytes *tb) { _last_note_off = tb->note_number; _last_off_velocity = tb->velocity; @@ -98,7 +98,7 @@ Channel::process_note_off (Parser & /*parser*/, EventTwoBytes *tb) } void -Channel::process_note_on (Parser & /*parser*/, EventTwoBytes *tb) +Channel::process_note_on (Parser & /*parser*/, EventTwoBytes *tb) { _last_note_on = tb->note_number; _last_on_velocity = tb->velocity; @@ -106,7 +106,7 @@ Channel::process_note_on (Parser & /*parser*/, EventTwoBytes *tb) } void -Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) +Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) { unsigned short cv; @@ -118,7 +118,7 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) if (tb->controller_number < 32) { /* unsigned: no test for >= 0 */ /* if this controller is already known to use 14 bits, - then treat this value as the MSB, and combine it + then treat this value as the MSB, and combine it with the existing LSB. otherwise, just treat it as a 7 bit value, and set @@ -135,25 +135,25 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) _controller_val[tb->controller_number] = (controller_value_t)cv; - } else if ((tb->controller_number >= 32 && + } else if ((tb->controller_number >= 32 && tb->controller_number <= 63)) { - + int cn = tb->controller_number - 32; cv = (unsigned short) _controller_val[cn]; - /* LSB for CC 0-31 arrived. + /* LSB for CC 0-31 arrived. If this is the first time (i.e. its currently flagged as a 7 bit controller), mark the controller as 14 bit, adjust the existing value - to be the MSB, and OR-in the new LSB value. + to be the MSB, and OR-in the new LSB value. otherwise, OR-in the new low 7bits with the old high 7. */ - + if (_controller_14bit[cn] == false) { _controller_14bit[cn] = true; cv = (cv << 7) | (tb->value & 0x7f); @@ -173,7 +173,7 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) /* controller can only take 7 bit values */ - _controller_val[tb->controller_number] = + _controller_val[tb->controller_number] = (controller_value_t) tb->value; } @@ -188,31 +188,31 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) } void -Channel::process_program_change (Parser & /*parser*/, MIDI::byte val) +Channel::process_program_change (Parser & /*parser*/, MIDI::byte val) { _program_number = val; } void -Channel::process_chanpress (Parser & /*parser*/, MIDI::byte val) +Channel::process_chanpress (Parser & /*parser*/, MIDI::byte val) { _chanpress = val; } void -Channel::process_polypress (Parser & /*parser*/, EventTwoBytes *tb) +Channel::process_polypress (Parser & /*parser*/, EventTwoBytes *tb) { _polypress[tb->note_number] = tb->value; } void -Channel::process_pitchbend (Parser & /*parser*/, pitchbend_t val) +Channel::process_pitchbend (Parser & /*parser*/, pitchbend_t val) { _pitch_bend = val; } void -Channel::process_reset (Parser & /*parser*/) +Channel::process_reset (Parser & /*parser*/) { reset (0, 1); } diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index 567df99335..622bf76d16 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -2,7 +2,7 @@ Copyright (C) 2012 Paul Davis Using code from Rui Nuno Capela's qmidinet as inspiration. - + 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 @@ -82,8 +82,8 @@ IPMIDIPort::~IPMIDIPort () int IPMIDIPort::selectable () const -{ - return sockin; +{ + return sockin; } XMLNode& @@ -112,7 +112,7 @@ IPMIDIPort::close_sockets () } } -static bool +static bool get_address (int sock, struct in_addr *inaddr, const string& ifname ) { // Get interface address from supplied name. diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h index f3ec434ca5..d397c99ea0 100644 --- a/libs/midi++2/midi++/channel.h +++ b/libs/midi++2/midi++/channel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1998-99 Paul Barton-Davis + Copyright (C) 1998-99 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 @@ -46,24 +46,24 @@ class LIBMIDIPP_API Channel : public PBD::ScopedConnectionList { byte pressure () { return _chanpress; } byte poly_pressure (byte n) { return _polypress[n]; } - byte last_note_on () { + byte last_note_on () { return _last_note_on; } - byte last_on_velocity () { + byte last_on_velocity () { return _last_on_velocity; } - byte last_note_off () { + byte last_note_off () { return _last_note_off; } - byte last_off_velocity () { + byte last_off_velocity () { return _last_off_velocity; } - pitchbend_t pitchbend () { + pitchbend_t pitchbend () { return _pitch_bend; } - controller_value_t controller_value (byte n) { + controller_value_t controller_value (byte n) { return _controller_val[n%128]; } diff --git a/libs/midi++2/midi++/event.h b/libs/midi++2/midi++/event.h index 6620010071..a75f4006f2 100644 --- a/libs/midi++2/midi++/event.h +++ b/libs/midi++2/midi++/event.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul 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 @@ -33,7 +33,7 @@ /** If this is not defined, all methods of MidiEvent are RT safe * but MidiEvent will never deep copy and (depending on the scenario) - * may not be usable in STL containers, signals, etc. + * may not be usable in STL containers, signals, etc. */ #define EVORAL_EVENT_ALLOC 1 diff --git a/libs/midi++2/midi++/ipmidi_port.h b/libs/midi++2/midi++/ipmidi_port.h index a056612514..9e37253e52 100644 --- a/libs/midi++2/midi++/ipmidi_port.h +++ b/libs/midi++2/midi++/ipmidi_port.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1998-2010 Paul Barton-Davis + Copyright (C) 1998-2010 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 @@ -58,10 +58,10 @@ class LIBMIDIPP_API IPMIDIPort : public Port { IPMIDIPort (int base_port = lowest_ipmidi_port_default, const std::string& ifname = std::string()); IPMIDIPort (const XMLNode&); ~IPMIDIPort (); - + XMLNode& get_state () const; void set_state (const XMLNode&); - + int write (const byte *msg, size_t msglen, timestamp_t timestamp); int read (byte *buf, size_t bufsize); void parse (framecnt_t timestamp); @@ -73,7 +73,7 @@ private: int sockin; int sockout; struct sockaddr_in addrout; - Glib::Threads::Mutex write_lock; + Glib::Threads::Mutex write_lock; bool open_sockets (int base_port, const std::string& ifname); void close_sockets (); diff --git a/libs/midi++2/midi++/libmidi_visibility.h b/libs/midi++2/midi++/libmidi_visibility.h index 17b57045cf..5c64196e1a 100644 --- a/libs/midi++2/midi++/libmidi_visibility.h +++ b/libs/midi++2/midi++/libmidi_visibility.h @@ -38,7 +38,7 @@ #define LIBMIDIPP_API LIBMIDIPP_DLL_EXPORT #else #define LIBMIDIPP_API LIBMIDIPP_DLL_IMPORT - #endif + #endif #define LIBMIDIPP_LOCAL LIBMIDIPP_DLL_LOCAL #endif diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index 5902bd5c05..45a251457e 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -83,7 +83,7 @@ private: class PatchBank; -class LIBMIDIPP_API Patch +class LIBMIDIPP_API Patch { public: @@ -114,7 +114,7 @@ private: typedef std::list<boost::shared_ptr<Patch> > PatchNameList; -class LIBMIDIPP_API PatchBank +class LIBMIDIPP_API PatchBank { public: PatchBank (uint16_t n = 0, std::string a_name = std::string()) : _name(a_name), _number (n) {}; @@ -157,8 +157,8 @@ public: 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(); + 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) { @@ -173,7 +173,7 @@ public: if (i != _patch_list.begin()) { --i; return _patch_map[*i]; - } + } } } @@ -240,7 +240,7 @@ private: std::string _name; }; -class LIBMIDIPP_API NoteNameList +class LIBMIDIPP_API NoteNameList { public: typedef std::vector< boost::shared_ptr<Note> > Notes; @@ -345,7 +345,7 @@ private: boost::shared_ptr<ValueNameList> _value_name_list; ///< Local, ValueNameList }; -class LIBMIDIPP_API ControlNameList +class LIBMIDIPP_API ControlNameList { public: typedef std::map<uint16_t, boost::shared_ptr<Control> > Controls; @@ -385,12 +385,12 @@ public: /// 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]; + return _channel_name_set_assignments[channel]; } private: /// array index = channel number - /// string contents = name of channel name set + /// string contents = name of channel name set std::string _name; std::string _channel_name_set_assignments[16]; }; diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h index b52f4bded8..3529031caf 100644 --- a/libs/midi++2/midi++/mmc.h +++ b/libs/midi++2/midi++/mmc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Barton-Davis + Copyright (C) 2000 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 @@ -40,7 +40,7 @@ class Parser; class MachineControlCommand; /** Class to handle incoming and outgoing MIDI machine control messages */ -class LIBMIDIPP_API MachineControl +class LIBMIDIPP_API MachineControl { public: typedef PBD::Signal1<void,MachineControl&> MMCSignal; @@ -95,7 +95,7 @@ class LIBMIDIPP_API MachineControl }; MachineControl (); - + void set_ports (MIDI::Port* input, MIDI::Port* output); Port* input_port() { return _input_port; } @@ -166,14 +166,14 @@ class LIBMIDIPP_API MachineControl status. */ - PBD::Signal3<void,MachineControl &,size_t,bool> + 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> + PBD::Signal3<void,MachineControl &,size_t,bool> TrackMuteChange; /* The second argument points to a byte array containing diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h index 420e7fcb7b..05d674375c 100644 --- a/libs/midi++2/midi++/parser.h +++ b/libs/midi++2/midi++/parser.h @@ -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 @@ -52,7 +52,7 @@ class LIBMIDIPP_API Parser { */ framecnt_t get_timestamp() const { return _timestamp; } - void set_timestamp (const framecnt_t timestamp) { _timestamp = timestamp; } + void set_timestamp (const framecnt_t timestamp) { _timestamp = timestamp; } /* signals that anyone can connect to */ @@ -146,7 +146,7 @@ class LIBMIDIPP_API Parser { size_t message_counter[256]; - enum ParseState { + enum ParseState { NEEDSTATUS, NEEDONEBYTE, NEEDTWOBYTES, diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index 5a52cfe898..1f85b53cd4 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1998-2010 Paul Barton-Davis + Copyright (C) 1998-2010 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 @@ -72,7 +72,7 @@ class LIBMIDIPP_API Port { /** block until the output FIFO used by non-process threads * is empty, checking every @a check_interval_usecs usecs * for current status. Not to be called by a thread that - * executes any part of a JACK process callback (will + * executes any part of a JACK process callback (will * simply return immediately in that situation). */ virtual void drain (int /* check_interval_usecs */) {} @@ -83,7 +83,7 @@ class LIBMIDIPP_API Port { */ int midimsg (byte *msg, size_t len, timestamp_t timestamp) { return !(write (msg, len, timestamp) == (int) len); - } + } virtual void parse (framecnt_t timestamp) = 0; @@ -92,11 +92,11 @@ class LIBMIDIPP_API Port { /* select(2)/poll(2)-based I/O */ /** Get the file descriptor for port. - * @return File descriptor, or -1 if not selectable. + * @return File descriptor, or -1 if not selectable. */ virtual int selectable () const = 0; - Channel *channel (channel_t chn) { + Channel *channel (channel_t chn) { return _channel[chn&0x7F]; } @@ -141,7 +141,7 @@ class LIBMIDIPP_API Port { struct LIBMIDIPP_API PortSet { PortSet (std::string str) : owner (str) { } - + std::string owner; std::list<XMLNode> ports; }; diff --git a/libs/midi++2/midi++/types.h b/libs/midi++2/midi++/types.h index 92858eaa60..c29ce1c767 100644 --- a/libs/midi++2/midi++/types.h +++ b/libs/midi++2/midi++/types.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul 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 diff --git a/libs/midi++2/midi.cc b/libs/midi++2/midi.cc index 6b5bca8a98..7ce7ab7db3 100644 --- a/libs/midi++2/midi.cc +++ b/libs/midi++2/midi.cc @@ -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 @@ -154,7 +154,7 @@ const char *MIDI::controller_names[] = { 0 }; -MIDI::byte +MIDI::byte MIDI::decode_controller_name (const char *name) { diff --git a/libs/midi++2/miditrace.cc b/libs/midi++2/miditrace.cc index d2c693d051..21cd3ba457 100644 --- a/libs/midi++2/miditrace.cc +++ b/libs/midi++2/miditrace.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Paul Davis + Copyright (C) 2012 Paul 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 @@ -37,7 +37,7 @@ using namespace MIDI; Port *port; PortRequest midi_device; -int +int setup_midi () { @@ -49,12 +49,12 @@ setup_midi () if ((port = MIDI::Manager::instance()->add_port (midi_device)) == 0) { info << "MIDI port is not valid" << endmsg; return -1; - } + } return 0; } -main (int argc, char *argv[]) +main (int argc, char *argv[]) { byte buf[1]; @@ -75,7 +75,7 @@ main (int argc, char *argv[]) error << "cannot read byte" << endmsg; break; - } + } } } diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index e1b3007bd3..9f62c12dfe 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -653,13 +653,13 @@ MasterDeviceNames::value_name_list_by_control(const std::string& mode, uint8_t c } } -boost::shared_ptr<CustomDeviceMode> +boost::shared_ptr<CustomDeviceMode> MasterDeviceNames::custom_device_mode_by_name(const std::string& mode_name) { return _custom_device_modes[mode_name]; } -boost::shared_ptr<ChannelNameSet> +boost::shared_ptr<ChannelNameSet> MasterDeviceNames::channel_name_set_by_channel(const std::string& mode, uint8_t channel) { boost::shared_ptr<CustomDeviceMode> cdm = custom_device_mode_by_name(mode); @@ -667,8 +667,8 @@ MasterDeviceNames::channel_name_set_by_channel(const std::string& mode, uint8_t return cns; } -boost::shared_ptr<Patch> -MasterDeviceNames::find_patch(const std::string& mode, uint8_t channel, const PatchPrimaryKey& key) +boost::shared_ptr<Patch> +MasterDeviceNames::find_patch(const std::string& mode, uint8_t channel, const PatchPrimaryKey& key) { boost::shared_ptr<ChannelNameSet> cns = channel_name_set_by_channel(mode, channel); if (!cns) return boost::shared_ptr<Patch>(); diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc index d722a816ee..074064f7bd 100644 --- a/libs/midi++2/mmc.cc +++ b/libs/midi++2/mmc.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Barton-Davis + Copyright (C) 2000 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 @@ -307,7 +307,7 @@ MachineControl::process_mmc_message (Parser &, MIDI::byte *msg, size_t len) } #if 0 - cerr << "+++ MMC type " + cerr << "+++ MMC type " << hex << ((int) *mmc_msg) << dec @@ -447,7 +447,7 @@ MachineControl::process_mmc_message (Parser &, MIDI::byte *msg, size_t len) break; } - /* increase skiplen to cover the command byte and + /* increase skiplen to cover the command byte and count byte (if it existed). */ @@ -508,15 +508,15 @@ 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 - <byte #> byte number of target byte in the + <byte #> byte number of target byte in the 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,8 +524,8 @@ 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 + + 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 @@ -577,7 +577,7 @@ MachineControl::write_track_status (MIDI::byte *msg, size_t /*len*/, MIDI::byte TrackMuteChange (*this, base_track+n, val); break; } - } + } } } @@ -633,7 +633,7 @@ MachineControl::do_shuttle (MIDI::byte *msg, size_t /*msglen*/) integral = ((sh & 0x7) << left_shift) | (sm >> (7 - left_shift)); fractional = ((sm << left_shift) << 7) | sl; - shuttle_speed = integral + + shuttle_speed = integral + ((float)fractional / (1 << (14 - left_shift))); Shuttle (*this, shuttle_speed, forward); @@ -697,7 +697,7 @@ MachineControlCommand::MachineControlCommand (Timecode::Time t) } -MIDI::byte * +MIDI::byte * MachineControlCommand::fill_buffer (MachineControl* mmc, MIDI::byte* b) const { *b++ = 0xf0; // SysEx diff --git a/libs/midi++2/mmctest.cc b/libs/midi++2/mmctest.cc index 69155ba553..9259e3ad2b 100644 --- a/libs/midi++2/mmctest.cc +++ b/libs/midi++2/mmctest.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Paul Davis + Copyright (C) 2012 Paul 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 @@ -43,7 +43,7 @@ MachineControl *mmc; MachineControl::CommandSignature cs; MachineControl::ResponseSignature rs; -int +int setup_midi () { @@ -55,7 +55,7 @@ setup_midi () if ((port = MIDI::Manager::instance()->add_port (midi_device)) == 0) { info << "MIDI port is not valid" << endmsg; return -1; - } + } mmc = new MachineControl (*port, 0.0, cs, rs); @@ -124,7 +124,7 @@ main (int argc, char *argv[]) error << "cannot read byte" << endmsg; break; - } + } } } diff --git a/libs/midi++2/mtc.cc b/libs/midi++2/mtc.cc index e2a018ca51..f23c6d832c 100644 --- a/libs/midi++2/mtc.cc +++ b/libs/midi++2/mtc.cc @@ -95,13 +95,13 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) { int which_quarter_frame = (msg[1] & 0xf0) >> 4; - /* Is it an expected frame? - Remember, the first can be frame 7 or frame 0, + /* Is it an expected frame? + Remember, the first can be frame 7 or frame 0, depending on the direction of the MTC generator ... */ #ifdef DEBUG_MTC - cerr << "MTC: (state = " << _mtc_running << ") " + cerr << "MTC: (state = " << _mtc_running << ") " << which_quarter_frame << " vs. " << expected_mtc_quarter_frame_code << " consecutive ? " << consecutive_qtr_frame_cnt << endl; @@ -141,7 +141,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) cerr << "Send MTC status as " << _mtc_running << endl; #endif mtc_status (_mtc_running); - } + } switch (_mtc_running) { case MTC_Forward: @@ -177,7 +177,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) consecutive_qtr_frame_cnt = 0; #ifdef DEBUG_MTC - cerr << "MTC: (state = " << _mtc_running << ") " + cerr << "MTC: (state = " << _mtc_running << ") " << which_quarter_frame << " vs. " << expected_mtc_quarter_frame_code << endl; #endif @@ -272,11 +272,11 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) _qtr_mtc_time[3] |= msg[1] & 0xf; break; - case 7: + 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 + in bits 5 and 6 */ _qtr_mtc_time[3] |= ((msg[1] & 0x1) << 4); @@ -288,7 +288,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg) abort(); /*NOTREACHED*/ break; - } + } #ifdef DEBUG_MTC cerr << "Emit MTC Qtr\n"; diff --git a/libs/midi++2/parser.cc b/libs/midi++2/parser.cc index 453fede251..f324047713 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -1,9 +1,9 @@ /* Copyright (C) 1998 Paul Barton-Davis - This file was inspired by the MIDI parser for KeyKit by - Tim Thompson. - + This file was inspired by the MIDI parser for KeyKit by + Tim Thompson. + 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 @@ -50,61 +50,61 @@ 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"; } } -Parser::Parser () +Parser::Parser () { trace_stream = 0; trace_prefix = ""; @@ -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 " @@ -191,7 +191,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) break; case program: - *o << trace_prefix + *o << trace_prefix << "Channel " << (msg[0]&0xF)+1 << " Program Change ProgNum " @@ -200,14 +200,14 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) break; case chanpress: - *o << trace_prefix + *o << trace_prefix << "Channel " << (msg[0]&0xF)+1 << " Channel Pressure " << (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]) { @@ -255,7 +255,7 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) << "System Exclusive (1 byte : " << hex << (int) *msg << dec << ')' << endmsg; break; - } + } } else { *o << trace_prefix << "System Exclusive (" << len << ") = [ " << hex; @@ -266,39 +266,39 @@ Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) } 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; @@ -328,8 +328,8 @@ Parser::scanner (unsigned char inbyte) // cerr << "parse: " << hex << (int) inbyte << dec << " state = " << state << " msgindex = " << msgindex << " runnable = " << runnable << endl; - /* Check active sensing early, so it doesn't interrupt sysex. - + /* 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 @@ -355,7 +355,7 @@ Parser::scanner (unsigned char inbyte) /* Real time messages can occur ANYPLACE, - but do not interrupt running status. + but do not interrupt running status. */ bool rtmsg = false; @@ -389,10 +389,10 @@ Parser::scanner (unsigned char inbyte) if (res.get_value_or (1) >= 0 && !_offline) { realtime_msg (inbyte); - } + } return; - } + } statusbit = (inbyte & 0x80); @@ -434,7 +434,7 @@ Parser::scanner (unsigned char inbyte) } if (!_offline) { any (*this, msgbuf, msgindex); - } + } } } } @@ -498,7 +498,7 @@ Parser::scanner (unsigned char inbyte) /* 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 */ @@ -511,9 +511,9 @@ Parser::scanner (unsigned char inbyte) } if (runnable) { - /* In Runnable mode, we reset the message - index, but keep the callbacks_pending and state the - same. This provides the "running status + /* In Runnable mode, we reset the message + index, but keep the callbacks_pending and state the + same. This provides the "running status byte" feature. */ msgindex = 1; @@ -558,7 +558,7 @@ Parser::realtime_msg(unsigned char inbyte) break; case 0xfe: /* !!! active sense message in realtime_msg: should not reach here - */ + */ break; case 0xff: reset (*this); @@ -576,9 +576,9 @@ Parser::channel_msg(unsigned char inbyte) { last_status_byte = inbyte; runnable = true; /* Channel messages can use running status */ - + /* The high 4 bits, which determine the type of channel message. */ - + switch (inbyte&0xF0) { case 0x80: msgtype = off; @@ -652,12 +652,12 @@ Parser::system_msg (unsigned char inbyte) break; } - // all these messages will be sent via any() + // all these messages will be sent via any() // when they are complete. // any (*this, &inbyte, 1); } -void +void Parser::signal (MIDI::byte *msg, size_t len) { channel_t chan = msg[0]&0xF; @@ -670,7 +670,7 @@ Parser::signal (MIDI::byte *msg, size_t len) case off: channel_active_preparse[chan_i] (*this); note_off (*this, (EventTwoBytes *) &msg[1]); - channel_note_off[chan_i] + channel_note_off[chan_i] (*this, (EventTwoBytes *) &msg[1]); channel_active_postparse[chan_i] (*this); break; @@ -684,11 +684,11 @@ Parser::signal (MIDI::byte *msg, size_t len) if (msg[2] == 0) { note_off (*this, (EventTwoBytes *) &msg[1]); - channel_note_off[chan_i] + channel_note_off[chan_i] (*this, (EventTwoBytes *) &msg[1]); } else { note_on (*this, (EventTwoBytes *) &msg[1]); - channel_note_on[chan_i] + channel_note_on[chan_i] (*this, (EventTwoBytes *) &msg[1]); } @@ -698,7 +698,7 @@ Parser::signal (MIDI::byte *msg, size_t len) case MIDI::controller: channel_active_preparse[chan_i] (*this); controller (*this, (EventTwoBytes *) &msg[1]); - channel_controller[chan_i] + channel_controller[chan_i] (*this, (EventTwoBytes *) &msg[1]); channel_active_postparse[chan_i] (*this); break; @@ -720,7 +720,7 @@ Parser::signal (MIDI::byte *msg, size_t len) case polypress: channel_active_preparse[chan_i] (*this); poly_pressure (*this, (EventTwoBytes *) &msg[1]); - channel_poly_pressure[chan_i] + channel_poly_pressure[chan_i] (*this, (EventTwoBytes *) &msg[1]); channel_active_postparse[chan_i] (*this); break; diff --git a/libs/midi++2/port.cc b/libs/midi++2/port.cc index b7d12872e8..d214755248 100644 --- a/libs/midi++2/port.cc +++ b/libs/midi++2/port.cc @@ -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 @@ -139,7 +139,7 @@ Port::Descriptor::Descriptor (const XMLNode& node) } } -XMLNode& +XMLNode& Port::get_state () const { XMLNode* root = new XMLNode (state_node_name); |