Skip to content

Commit

Permalink
Added tests to try to reproduce #20
Browse files Browse the repository at this point in the history
  • Loading branch information
wesen committed Jun 17, 2012
1 parent 8ddaf8e commit 766007b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
11 changes: 11 additions & 0 deletions host-apps/tests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MIDICTRL_LIBS = GUI Elektron MidiTools

include ../../makefiles/Host.mk

all: SendProgramChange

SendProgramChange: SendProgramChange.host.o $(OBJS)
$(CLDCXX) $(CLDFLAGS) -o $@ $^

clean:
- rm -f *.o SendProgramChange
21 changes: 21 additions & 0 deletions host-apps/tests/SendProgramChange.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "Platform.h"
#include "Midi.h"
#include "MidiUartHost.h"

int main(void) {
MidiUart.init(1, 1);

for (int i = 0; i < 20; i++) {
MidiUart.sendProgramChange(i);
MidiUart.runLoop();
delay(100);
}

for (int i = 0; i < 20; i++) {
MidiUart.runLoop();
delay(200);
}


return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "Midi.h"

class ForwardPrgChangeSketch : public Sketch, public MidiCallback {
CCEncoder encs[4];
EncoderPage page;

public:
ForwardPrgChangeSketch() :
page(&encs[0], &encs[1], &encs[2], &encs[3]) {

}

void setup() {
Midi.addOnProgramChangeCallback(this, (MidiCallback::callback_ptr_t)&ForwardPrgChangeSketch::onProgramChange);
setPage(&page);
}

void onProgramChange(uint8_t *msg) {
MidiUart.sendProgramChange(MIDI_VOICE_CHANNEL(msg[0]), msg[1]);
}
};


ForwardPrgChangeSketch sketch;

void setup() {
sketch.setup();
GUI.setSketch(&sketch);
}

0 comments on commit 766007b

Please sign in to comment.