From 0c1b9afc634d098ac6029acb3508d25823d0fc14 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 26 May 2006 22:30:54 +0000 Subject: - Documentation fixes - Fixed boolean return values in libmidi++ to return bool instead of int git-svn-id: svn://localhost/trunk/ardour2midi@538 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/midi++2/midi++/channel.h | 18 +++++++++--------- libs/midi++2/midi++/port.h | 26 +++++++++++++++----------- libs/midi++2/midichannel.cc | 6 ++++-- libs/midi++2/midiparser.cc | 19 ++++--------------- libs/midi++2/midiport.cc | 7 +++++-- 5 files changed, 37 insertions(+), 39 deletions(-) (limited to 'libs/midi++2') diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h index 1efde3cb93..f534f7e6da 100644 --- a/libs/midi++2/midi++/channel.h +++ b/libs/midi++2/midi++/channel.h @@ -73,37 +73,37 @@ class Channel : public sigc::trackable { controller_val[n%128] = val; } - int channel_msg (byte id, byte val1, byte val2); + bool channel_msg (byte id, byte val1, byte val2); - int all_notes_off () { + bool all_notes_off () { return channel_msg (MIDI::controller, 123, 0); } - int control (byte id, byte value) { + bool control (byte id, byte value) { return channel_msg (MIDI::controller, id, value); } - int note_on (byte note, byte velocity) { + bool note_on (byte note, byte velocity) { return channel_msg (MIDI::on, note, velocity); } - int note_off (byte note, byte velocity) { + bool note_off (byte note, byte velocity) { return channel_msg (MIDI::off, note, velocity); } - int aftertouch (byte value) { + bool aftertouch (byte value) { return channel_msg (MIDI::chanpress, value, 0); } - int poly_aftertouch (byte note, byte value) { + bool poly_aftertouch (byte note, byte value) { return channel_msg (MIDI::polypress, note, value); } - int program_change (byte value) { + bool program_change (byte value) { return channel_msg (MIDI::program, value, 0); } - int pitchbend (byte msb, byte lsb) { + bool pitchbend (byte msb, byte lsb) { return channel_msg (MIDI::pitchbend, lsb, msb); } diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index 81e28615d0..442cc4e5ed 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -50,17 +50,17 @@ class Port : public sigc::trackable { /* Direct I/O */ + /** \return number of bytes successfully written */ virtual int write (byte *msg, size_t msglen) = 0; + + /** \return number of bytes successfully written to \a buf */ virtual int read (byte *buf, size_t max) = 0; - /* slowdown i/o to a loop of single byte emissions + /** Slow down I/O to a loop of single byte emissions interspersed with a busy loop of 10000 * this value. - This may be ignored by a particular instance - of this virtual class. See FD_MidiPort for an - example of where it used. - */ - + This may be ignored by a particular instance of this virtual + class. See FD_MidiPort for an example of where it used. */ void set_slowdown (size_t n) { slowdown = n; } /* select(2)/poll(2)-based I/O */ @@ -99,21 +99,25 @@ class Port : public sigc::trackable { } } - int midimsg (byte *msg, size_t len) { + /** Write a message. + * \return true on success. */ + bool midimsg (byte *msg, size_t len) { return !(write (msg, len) == (int) len); } - int three_byte_msg (byte a, byte b, byte c) { + /** Write a 3-byte message. + * \return true on success. */ + bool three_byte_msg (byte a, byte b, byte c) { byte msg[3]; - - msg[0] = a; + + msg[0] = a; msg[1] = b; msg[2] = c; return !(write (msg, 3) == 3); } - int clock (); + bool clock (); const char *device () const { return _devname.c_str(); } const char *name () const { return _tagname.c_str(); } diff --git a/libs/midi++2/midichannel.cc b/libs/midi++2/midichannel.cc index a6759b7962..42949591fe 100644 --- a/libs/midi++2/midichannel.cc +++ b/libs/midi++2/midichannel.cc @@ -249,9 +249,11 @@ Channel::process_reset (Parser &parser) reset (); } -int +/** Write a message to a channel. + * \return true if success + */ +bool Channel::channel_msg (byte id, byte val1, byte val2) - { unsigned char msg[3]; int len = 0; diff --git a/libs/midi++2/midiparser.cc b/libs/midi++2/midiparser.cc index 04ac2728f1..975a77a2c5 100644 --- a/libs/midi++2/midiparser.cc +++ b/libs/midi++2/midiparser.cc @@ -523,13 +523,9 @@ Parser::scanner (unsigned char inbyte) return; } -/* - * realtime_msg(inbyte) - * - * Call the real-time function for the specified byte, immediately. +/** Call the real-time function for the specified byte, immediately. * These can occur anywhere, so they don't change the state. */ - void Parser::realtime_msg(unsigned char inbyte) @@ -565,12 +561,9 @@ Parser::realtime_msg(unsigned char inbyte) any (*this, &inbyte, 1); } -/* - * channel_msg(inbyte) - * - * Interpret a Channel (voice or mode) Message status byte. - */ +/** Interpret a Channel (voice or mode) Message status byte. + */ void Parser::channel_msg(unsigned char inbyte) { @@ -611,16 +604,12 @@ Parser::channel_msg(unsigned char inbyte) } } -/* - * system_msg(inbyte) - * - * Initialize (and possibly emit) the signals for the +/** Initialize (and possibly emit) the signals for the * specified byte. Set the state that the state-machine * should go into. If the signal is not emitted * immediately, it will be when the state machine gets to * the end of the MIDI message. */ - void Parser::system_msg (unsigned char inbyte) { diff --git a/libs/midi++2/midiport.cc b/libs/midi++2/midiport.cc index 6d374ed8c0..a7c4ba0940 100644 --- a/libs/midi++2/midiport.cc +++ b/libs/midi++2/midiport.cc @@ -83,7 +83,10 @@ Port::~Port () } } -int +/** Send a clock tick message. + * \return true on success. + */ +bool Port::clock () { @@ -93,7 +96,7 @@ Port::clock () return midimsg (&clockmsg, 1); } - return 0; + return false; } void -- cgit v1.2.3