/note now all floats.
This commit is contained in:
parent
c1a471b6bb
commit
3ab0e825eb
5 changed files with 1726 additions and 22 deletions
|
|
@ -44,24 +44,24 @@ void route_note(OSCMessage& msg, int offset) {
|
|||
//
|
||||
note.clear();
|
||||
//
|
||||
note.onoff = msg.getInt(0);
|
||||
note.onoff = msg.getFloat(0);
|
||||
if (note.onoff != 0) note.onoff = 1;
|
||||
}
|
||||
// (2) --> /velocity
|
||||
if (msg.fullMatch("/velocity", offset)) {
|
||||
note.velocity = msg.getInt(0);
|
||||
note.velocity = msg.getFloat(0);
|
||||
}
|
||||
// (3) --> /pitch
|
||||
if (msg.fullMatch("/pitch", offset)) {
|
||||
note.pitch = msg.getInt(0);
|
||||
note.pitch = msg.getFloat(0);
|
||||
}
|
||||
// (4) --> /x
|
||||
if (msg.fullMatch("/x", offset)) {
|
||||
note.x1 = msg.getInt(0);
|
||||
note.x2 = msg.getInt(1);
|
||||
note.x3 = msg.getInt(2);
|
||||
note.x4 = msg.getInt(3);
|
||||
note.ps = msg.getInt(4);
|
||||
note.x1 = msg.getFloat(0);
|
||||
note.x2 = msg.getFloat(1);
|
||||
note.x3 = msg.getFloat(2);
|
||||
note.x4 = msg.getFloat(3);
|
||||
note.ps = msg.getFloat(4);
|
||||
//
|
||||
POSTMAN_SERIAL.write('['); // start byte of 'Note'
|
||||
POSTMAN_SERIAL.write((uint8_t *) ¬e, sizeof(Note));
|
||||
|
|
|
|||
24
post.h
24
post.h
|
|
@ -66,14 +66,14 @@ private:
|
|||
|
||||
//message type Note : '[' + Note + ']'
|
||||
struct Note {
|
||||
int32_t pitch;
|
||||
int32_t velocity;
|
||||
int32_t onoff;
|
||||
int32_t x1;
|
||||
int32_t x2;
|
||||
int32_t x3;
|
||||
int32_t x4;
|
||||
int32_t ps;
|
||||
float pitch;
|
||||
float velocity;
|
||||
float onoff;
|
||||
float x1;
|
||||
float x2;
|
||||
float x3;
|
||||
float x4;
|
||||
float ps;
|
||||
//
|
||||
void clear() {
|
||||
pitch = 0;
|
||||
|
|
@ -104,10 +104,10 @@ struct Note {
|
|||
//message type Hello : '{' + Hello + '}'
|
||||
struct Hello {
|
||||
int32_t id;
|
||||
int32_t h1;
|
||||
int32_t h2;
|
||||
int32_t h3;
|
||||
int32_t h4;
|
||||
float h1;
|
||||
float h2;
|
||||
float h3;
|
||||
float h4;
|
||||
//
|
||||
void clear() {
|
||||
id = 0;
|
||||
|
|
|
|||
1701
puredata/piano_access_mesh_x_2.pd
Normal file
1701
puredata/piano_access_mesh_x_2.pd
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -238,11 +238,12 @@ void onNoteHandler(Note & n) {
|
|||
//is it for me?
|
||||
if (n.pitch == ID_KEY) {
|
||||
//
|
||||
step_target = n.x1 * n.x3;
|
||||
step_target = n.x1;
|
||||
step_duration = n.x2;
|
||||
if (step_duration < 1000) step_duration = 1000;
|
||||
//
|
||||
hello_delay = n.ps;
|
||||
if (hello_delay != 0 && hello_task.isEnabled() == false) {
|
||||
if (hello_delay > 0 && hello_task.isEnabled() == false) {
|
||||
hello_task.restart();
|
||||
}
|
||||
//
|
||||
|
|
|
|||
|
|
@ -235,6 +235,8 @@ Task collect_post_task(1, TASK_FOREVER, &collect_post, &runner, true); // by def
|
|||
void onNoteHandler(Note & n) {
|
||||
//is it for me?
|
||||
if (n.pitch == ID_KEY) {
|
||||
//
|
||||
if (n.velocity < 0) n.velocity = 0;
|
||||
//taak_on && taak_off
|
||||
if (n.velocity == 0) {
|
||||
if (n.onoff == 1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue