31 virtual void keyOn(
int nte,
float tgt) = 0;
111 LOGE(
"p_adsr is null")
119 for (
int j=0; j<size; j++){
120 sample =
effects[j]->process(sample);
176 for (
int j=0;j<
channels.size();j++){
182 delete p_synth_action;
196 LOGI(
"keyOn: %d", note);
198 if (channel!=
nullptr){
199 channel->
keyOn(note, tgt);
201 LOGW(
"No channel available for %d",note);
206 LOGI(
"keyOff: %d", note);
208 if (channel!=
nullptr){
218 for (
int j=0;j<
channels.size();j++){
227 result = NumberConverter::clipT<int16_t>(total / count);
234 while (p_keys->
note > 0){
263 class SynthAction :
public MidiAction {
270 void onNoteOn(uint8_t channel, uint8_t note, uint8_t velocity) {
271 int frq = MidiCommon::noteToFrequency(note);
272 float vel = 1.0/127.0 * velocity;
273 synth->
keyOn(frq, vel);
275 void onNoteOff(uint8_t channel, uint8_t note, uint8_t velocity) {
276 int frq = MidiCommon::noteToFrequency(note);
279 void onControlChange(uint8_t channel, uint8_t controller, uint8_t value) {}
280 void onPitchBend(uint8_t channel, uint8_t value) {}
283 SynthAction *p_synth_action =
new SynthAction(
this);
285 MidiBleServer ble = MidiBleServer(
midi_name, p_synth_action);
291 LOGI(
"getNoteChannel: %d", note);
292 for (
int j=0;j<
channels.size();j++){
302 LOGI(
"getFreeChannel");
303 for (
int j=0;j<
channels.size();j++){
308 LOGI(
"No free channel found: Adding new channel");
320 LOGE(
"callbackKeyOn: unexpected null")
331 LOGE(
"callbackKeyOff: p_synthesizer is null");
334 LOGE(
"callbackKeyOff: ref is null");
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACEI()
Definition AudioLoggerIDF.h:32
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGE(...)
Definition AudioLoggerIDF.h:30