summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-05-26 22:30:54 +0000
committerDavid Robillard <d@drobilla.net>2006-05-26 22:30:54 +0000
commit0c1b9afc634d098ac6029acb3508d25823d0fc14 (patch)
tree0e09b9b277b0e8c62a24e57de2039119586343bf /libs
parent5bc0351635d49a5e7d7fdf129df842a247ffad99 (diff)
- 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
Diffstat (limited to 'libs')
-rw-r--r--libs/midi++2/midi++/channel.h18
-rw-r--r--libs/midi++2/midi++/port.h26
-rw-r--r--libs/midi++2/midichannel.cc6
-rw-r--r--libs/midi++2/midiparser.cc19
-rw-r--r--libs/midi++2/midiport.cc7
-rw-r--r--libs/pbd3/pbd/ringbufferNPT.h5
6 files changed, 40 insertions, 41 deletions
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
diff --git a/libs/pbd3/pbd/ringbufferNPT.h b/libs/pbd3/pbd/ringbufferNPT.h
index d559a53d94..2ff469dc12 100644
--- a/libs/pbd3/pbd/ringbufferNPT.h
+++ b/libs/pbd3/pbd/ringbufferNPT.h
@@ -24,8 +24,9 @@
#include <sys/mman.h>
#include <pbd/atomic.h>
-/* ringbuffer class where the element size is not required to be a power of two */
-
+/** Ringbuffer class where the element size is not required to be a
+ * power of two.
+ */
template<class T>
class RingBufferNPT
{