commit 1c8705e16bb121e33e8dff18d0bf621d37a130ad
parent d2669ffc09578b6c2ad405d159dc2627f827166d
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Wed, 30 Dec 2009 14:25:48 -0500
Nio: adding debugging prints
Diffstat:
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/Nio/InMgr.cpp b/src/Nio/InMgr.cpp
@@ -12,9 +12,9 @@ InMgr::InMgr(Master *_master)
void InMgr::putEvent(MidiNote note)
{
+ cout << note << endl;
pthread_mutex_lock(&master->mutex);
{
- cout << "got a note event" << endl;
dump.dumpnote(note.channel, note.note, note.velocity);
if(note.velocity)
@@ -27,9 +27,9 @@ void InMgr::putEvent(MidiNote note)
void InMgr::putEvent(MidiCtl control)
{
+ cout << control << endl;
pthread_mutex_lock(&master->mutex);
{
- cout << "got a control event" << endl;
dump.dumpcontroller(control.channel, control.controller,
control.value);
diff --git a/src/Nio/MidiEvent.cpp b/src/Nio/MidiEvent.cpp
@@ -1,10 +1,27 @@
#include "MidiEvent.h"
+using namespace std;
+
MidiNote::MidiNote(char _note, char _channel, char _velocity)
:note(_note), channel(_channel), velocity(_velocity)
{};
+ostream &operator<<(ostream &out, const MidiNote& note)
+{
+ out << "MidiNote: note(" << (int)note.note << ")\n"
+ << " channel(" << (int)note.channel << ")\n"
+ << " velocity(" << (int)note.velocity << ")";
+ return out;
+}
+
MidiCtl::MidiCtl(char _controller, char _channel, char _value)
:controller(_controller), channel(_channel), value(_value)
{};
+ostream &operator<<(ostream &out, const MidiCtl &ctl)
+{
+ out << "MidiCtl: controller(" << (int)ctl.controller << ")\n"
+ << " channel(" << (int)ctl.channel << ")\n"
+ << " value(" << (int)ctl.value << ")";
+ return out;
+}
diff --git a/src/Nio/MidiEvent.h b/src/Nio/MidiEvent.h
@@ -2,6 +2,8 @@
#ifndef MIDI_EVENT
#define MIDI_EVENT
+#include <iostream>
+
/**A class to generalize midi events*/
struct MidiEvent
{
@@ -17,6 +19,8 @@ struct MidiNote : public MidiEvent
char velocity;
};
+std::ostream &operator<<(std::ostream &out, const MidiNote &midi);
+
struct MidiCtl : public MidiEvent
{
MidiCtl(char _controller, char _channel, char _value);
@@ -26,4 +30,5 @@ struct MidiCtl : public MidiEvent
char value;
};
+std::ostream &operator<<(std::ostream &out, const MidiCtl &ctl);
#endif