Skip to content

Commit

Permalink
added receiving control functions
Browse files Browse the repository at this point in the history
  • Loading branch information
danomatika committed May 18, 2011
1 parent 11cac20 commit d5d76e9
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 68 deletions.
15 changes: 15 additions & 0 deletions doc/interface_sketch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ pd << StartMsg("pd", "dsp") << 1 << Finish();

// MIDI

// midi channels should be 1-16? ... same as patching

// note
pd.sendNote(60);
pd.sendNote(60, 100);
Expand Down Expand Up @@ -136,8 +138,21 @@ public ofxPdListener {
void pitchbendReceived(int channel, int val) {}
void aftertouchReceived(int channel, int val) {}
void polyAftertouchReceived(int channel, int pitch, int val) {}

void midiByteReceived(int port, int byte) {}
void sysexReceived(int port, int byte) {}
void sysexRealtimeReceived(int port, int byte) {}
};

pd.addListener(listener); // add listener to global space
pd.subscribe("test"); // subscribe to "test"

pd.subscribeListener(listener, "test"); // bind listener to "test",
// adds both if not already added,
// takes listener out of global space

pd.unsubscribeListener(listener, "test"); // unbind listener to "test',
// puts it back in the global space
pd.removeListener(listener); // removes listener from global space
pd.unsubscribeListener(listener); // unsubscribes listener from all sources, global

6 changes: 3 additions & 3 deletions example/src/testApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ void testApp::setup() {
cout << Poco::Path::current() << endl;

// setup OF sound stream
ofSoundStreamSetup(2, 2, this, 44100, ofxPd::getBlocksize(), 4);
ofSoundStreamSetup(2, 2, this, 44100, ofxPd::getBlockSize(), 4);

pd.init(2, 2, 44100);
pd.addListener(this);
pd.addListener(*this);
pd.dspOn();
pd.openPatch("test.pd");
pd.bind("toOF");
pd.addSource("toOF");
pd.sendBang("fromOF");
pd.sendFloat("fromOF", 100);
}
Expand Down
Loading

0 comments on commit d5d76e9

Please sign in to comment.