diff --git a/@postman/src/main.cpp b/@postman/src/main.cpp index 5e59424..8bd29ff 100644 --- a/@postman/src/main.cpp +++ b/@postman/src/main.cpp @@ -22,7 +22,7 @@ //======================== // -#define MY_GROUP_ID (5000) +#define MY_GROUP_ID (10000) #define MY_ID (MY_GROUP_ID + 1) #define MY_SIGN ("@POSTMAN|@SAMPLER") // diff --git a/@sampler/src/main.cpp b/@sampler/src/main.cpp index 21255a9..1506d8a 100644 --- a/@sampler/src/main.cpp +++ b/@sampler/src/main.cpp @@ -12,14 +12,6 @@ // (part-3) teensy35 : 'client:sampler' (mesh post --> play sounds) // -//======================== -//optionally pin3 will go HIGH/LOW in sync w/ sound PLAY/STOP -#define MOTOR_PIN 3 -// #define FAN_ACTION // this is noisy.... ==> not so recommendable.. -#define NOTE_MIN 24 -#define NOTE_MAX 84 -//======================= - //HACK: let auto-poweroff speakers stay turned ON! - (creative muvo mini) #define IDLE_FREQ 22000 #define IDLE_AMP 0 // --> creative muvo 2 doesn't need this. they just stay on! @@ -32,11 +24,6 @@ SdFatSdioEX SD; #include -//teensy 3.5 with SD card -#define SDCARD_CS_PIN BUILTIN_SDCARD -#define SDCARD_MOSI_PIN 11 // not actually used -#define SDCARD_SCK_PIN 13 // not actually used - // GUItool: begin automatically generated code AudioPlaySdWav playSdWav1; //xy=224,265 AudioSynthWaveformSine sine1; //xy=236,361 @@ -81,14 +68,7 @@ void sample_player_start() return; } //start the player! - //NOTE: block out 're-triggering' - // if (playSdWav1.isPlaying() == false) { playSdWav1.play(filename); - // } -#if defined(FAN_ACTION) - //fan action - digitalWrite(MOTOR_PIN, HIGH); -#endif //mark the indicator : HIGH: ON digitalWrite(13, HIGH); //to wait a bit for updating isPlaying() @@ -116,10 +96,6 @@ void sample_player_stop() { //stop the player. if (playSdWav1.isPlaying() == true) { playSdWav1.stop(); -#if defined(FAN_ACTION) - //fan stop - digitalWrite(MOTOR_PIN, LOW); -#endif } } void sample_player_check() { @@ -135,8 +111,8 @@ void sample_player_check() { } } // -Task sample_player_start_task(0, TASK_ONCE, sample_player_start); -Task sample_player_stop_task(0, TASK_ONCE, sample_player_stop); +Task sample_player_start_task(0, TASK_ONCE, sample_player_start, &runner, false); +Task sample_player_stop_task(0, TASK_ONCE, sample_player_stop, &runner, false); Task sample_player_check_task(0, TASK_FOREVER, sample_player_check, &runner, true); //i2c @@ -183,22 +159,23 @@ void receiveEvent(int numBytes) { // int key = str_key.toInt(); - if (key >= NOTE_MIN && key <= NOTE_MAX) { - sample_now = key; - // - int velocity = str_velocity.toInt(); // 0 ~ 127 - float amp_gain = (float)velocity / 127.0; - amp1.gain(amp_gain); - amp2.gain(amp_gain); - // - int gate = str_gate.toInt(); - if (gate == 0) { - sample_player_stop_task.restart(); - Serial.println("sample_player_stop_task"); - } else { - sample_player_start_task.restart(); - Serial.println("sample_player_start_task"); - } + sample_now = key; + // + int velocity = str_velocity.toInt(); // 0 ~ 127 + float amp_gain = (float)velocity / 127.0; + // + amp_gain = amp_gain * 0.7; // additional amp down. * 70% + // + amp1.gain(amp_gain); + amp2.gain(amp_gain); + // + int gate = str_gate.toInt(); + if (gate == 0) { + sample_player_stop_task.restart(); + Serial.println("sample_player_stop_task"); + } else { + sample_player_start_task.restart(); + Serial.println("sample_player_start_task"); } } } @@ -242,13 +219,7 @@ void setup() { // w/o ==> get killed by watchdog.. :( // // while (!Serial) {} - // --> use this.. to capture start-up messages, properly. very handy. - - //motor -#if defined(FAN_ACTION) - pinMode(MOTOR_PIN, OUTPUT); - digitalWrite(MOTOR_PIN, LOW); -#endif + // --> enable this.. to use Serial. otherwise, very jerky/unstable.. //i2c Wire.begin(I2C_ADDR); @@ -269,10 +240,13 @@ void setup() { //audio AudioMemory(20); -#if !defined(TEENSY36) - //NOTE!! teensy36 board.. output broken? .. so disable this for teensy36.. this is the cause?? - dacs1.analogReference(EXTERNAL); -#endif + + // dacs1.analogReference(EXTERNAL); + // <-- this was used probably to make output swing greater Vpp == 3.3v + // but, with this + small headphones, i cannot hear anything. + // and, this might be dangerous in some case -> this is suspicous of 1 broken teensy 3.6 + // so, unless you are so sure, don't enable this. + mixer1.gain(0,1.0); mixer1.gain(1,1.0); mixer1.gain(2,0); @@ -291,10 +265,6 @@ void setup() { pinMode(13, OUTPUT); digitalWrite(13, LOW); // LOW: OFF - //player task - runner.addTask(sample_player_start_task); - runner.addTask(sample_player_stop_task); - // Serial.println("[setup] done."); } diff --git a/post.h b/post.h index 726a413..e65dceb 100644 --- a/post.h +++ b/post.h @@ -117,6 +117,8 @@ struct AddressLibrary { book.add(Address(0xAC, 0x67, 0xB2, 0x0B, 0xAD, 0xB0, "audioooo #2")); //WROOM book.add(Address(0xA8, 0x03, 0x2A, 0x6C, 0x88, 0x78, "audioooo #3")); //WROVER // + book.add(Address(0x98, 0xF4, 0xAB, 0xB3, 0xB4, 0xDD, "sampler #1")); //TEENSY+ESP8266 + // lib.push_back(book); } }