update 109(beakgu) 5percent exhibition
This commit is contained in:
parent
d4a217df11
commit
b219e19eb4
2 changed files with 39 additions and 32 deletions
|
|
@ -57,8 +57,9 @@
|
||||||
//
|
//
|
||||||
#define HAVE_CLIENT_I2C
|
#define HAVE_CLIENT_I2C
|
||||||
#define DISABLE_AP
|
#define DISABLE_AP
|
||||||
#define REPLICATE_NOTE_REQ
|
// #define SERIAL_SWAP
|
||||||
#define USE_ALTERNATIVE_ADDRESSES
|
// #define REPLICATE_NOTE_REQ
|
||||||
|
// #define USE_ALTERNATIVE_ADDRESSES
|
||||||
|
|
||||||
//============<parameters>============
|
//============<parameters>============
|
||||||
//
|
//
|
||||||
|
|
@ -344,33 +345,37 @@ void setup() {
|
||||||
esp_now_register_send_cb(onDataSent);
|
esp_now_register_send_cb(onDataSent);
|
||||||
esp_now_register_recv_cb(onDataReceive);
|
esp_now_register_recv_cb(onDataReceive);
|
||||||
//
|
//
|
||||||
// Serial.println("- ! (esp_now_add_peer) ==> add a 'broadcast peer' (FF:FF:FF:FF:FF:FF).");
|
Serial.println("- ! (esp_now_add_peer) ==> add a 'broadcast peer' (FF:FF:FF:FF:FF:FF).");
|
||||||
// uint8_t broadcastmac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
uint8_t broadcastmac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
//
|
|
||||||
// //
|
// option 1-1)) broadcast to all. for ESP8266
|
||||||
|
esp_now_add_peer(broadcastmac, ESP_NOW_ROLE_COMBO, 1, NULL, 0);
|
||||||
|
|
||||||
|
// // option 1-2)) broadcast to all. for ESP32
|
||||||
// esp_now_peer_info_t peerInfo;
|
// esp_now_peer_info_t peerInfo;
|
||||||
// memcpy(peerInfo.peer_addr, broadcastmac, 6);
|
// memcpy(peerInfo.peer_addr, broadcastmac, 6);
|
||||||
// peerInfo.channel = 0;
|
// peerInfo.channel = 0;
|
||||||
// peerInfo.encrypt = false;
|
// peerInfo.encrypt = false;
|
||||||
// esp_now_add_peer(&peerInfo);
|
// esp_now_add_peer(&peerInfo);
|
||||||
|
|
||||||
#if defined(USE_ALTERNATIVE_ADDRESSES)
|
// // option 2)) according to the addressbook.
|
||||||
AddressBook * book = lib.getBookByTitle("audioooo alt");
|
// #if defined(USE_ALTERNATIVE_ADDRESSES)
|
||||||
#else
|
// AddressBook * book = lib.getBookByTitle("audioooo alt");
|
||||||
AddressBook * book = lib.getBookByTitle("audioooo");
|
// #else
|
||||||
#endif
|
// AddressBook * book = lib.getBookByTitle("audioooo");
|
||||||
for (int idx = 0; idx < book->list.size(); idx++) {
|
// #endif
|
||||||
Serial.println("- ! (esp_now_add_peer) ==> add a '" + book->list[idx].name + "'.");
|
// for (int idx = 0; idx < book->list.size(); idx++) {
|
||||||
#if defined(ESP32)
|
// Serial.println("- ! (esp_now_add_peer) ==> add a '" + book->list[idx].name + "'.");
|
||||||
esp_now_peer_info_t peerInfo;
|
// #if defined(ESP32)
|
||||||
memcpy(peerInfo.peer_addr, book->list[idx].mac, 6);
|
// esp_now_peer_info_t peerInfo;
|
||||||
peerInfo.channel = 0;
|
// memcpy(peerInfo.peer_addr, book->list[idx].mac, 6);
|
||||||
peerInfo.encrypt = false;
|
// peerInfo.channel = 0;
|
||||||
esp_now_add_peer(&peerInfo);
|
// peerInfo.encrypt = false;
|
||||||
#else
|
// esp_now_add_peer(&peerInfo);
|
||||||
esp_now_add_peer(book->list[idx].mac, ESP_NOW_ROLE_COMBO, 1, NULL, 0);
|
// #else
|
||||||
#endif
|
// esp_now_add_peer(book->list[idx].mac, ESP_NOW_ROLE_COMBO, 1, NULL, 0);
|
||||||
}
|
// #endif
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
Serial.println("-");
|
Serial.println("-");
|
||||||
Serial.println("\".-.-.-. :)\"");
|
Serial.println("\".-.-.-. :)\"");
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
#define IDLE_FREQ 22000
|
#define IDLE_FREQ 22000
|
||||||
#define IDLE_AMP 0 // --> creative muvo 2 doesn't need this. they just stay on!
|
#define IDLE_AMP 0 // --> creative muvo 2 doesn't need this. they just stay on!
|
||||||
|
|
||||||
|
#define GAIN_MAX 1.0 // if 1.0 is too loud, give max. limit here.
|
||||||
|
|
||||||
//teensy audio
|
//teensy audio
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
// #include <SPI.h>
|
// #include <SPI.h>
|
||||||
|
|
@ -163,19 +165,19 @@ void receiveEvent(int numBytes) {
|
||||||
int velocity = str_velocity.toInt(); // 0 ~ 127
|
int velocity = str_velocity.toInt(); // 0 ~ 127
|
||||||
float amp_gain = (float)velocity / 127.0;
|
float amp_gain = (float)velocity / 127.0;
|
||||||
//
|
//
|
||||||
amp_gain = amp_gain * 0.3; // 1.0 was too loud. => 0.3 max.
|
amp_gain = amp_gain * GAIN_MAX;
|
||||||
//
|
//
|
||||||
amp1.gain(amp_gain);
|
amp1.gain(amp_gain);
|
||||||
amp2.gain(amp_gain);
|
amp2.gain(amp_gain);
|
||||||
//
|
//
|
||||||
int gate = str_gate.toInt();
|
int gate = str_gate.toInt();
|
||||||
if (gate == 0) {
|
if (gate == 0) {
|
||||||
// filter out re-triggering same note while it is playing.
|
// filter out re-triggering same note while it is playing. <== ???? WORKS????
|
||||||
if (!playSdWav1.isPlaying() || sample_now != key) {
|
// if (!playSdWav1.isPlaying() || sample_now != key) { <== ???? WORKS????
|
||||||
sample_now = key;
|
sample_now = key;
|
||||||
sample_player_stop_task.restart();
|
sample_player_stop_task.restart();
|
||||||
Serial.println("sample_player_stop_task");
|
Serial.println("sample_player_stop_task");
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
sample_now = key;
|
sample_now = key;
|
||||||
sample_player_start_task.restart();
|
sample_player_start_task.restart();
|
||||||
|
|
@ -259,8 +261,8 @@ void setup() {
|
||||||
mixer2.gain(1,1.0);
|
mixer2.gain(1,1.0);
|
||||||
mixer2.gain(2,0);
|
mixer2.gain(2,0);
|
||||||
mixer2.gain(3,0);
|
mixer2.gain(3,0);
|
||||||
amp1.gain(0.3); // 1.0 was too loud. => 0.3
|
amp1.gain(GAIN_MAX);
|
||||||
amp2.gain(0.3);
|
amp2.gain(GAIN_MAX);
|
||||||
|
|
||||||
//let auto-poweroff speakers stay turned ON!
|
//let auto-poweroff speakers stay turned ON!
|
||||||
sine1.frequency(IDLE_FREQ);
|
sine1.frequency(IDLE_FREQ);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue