I tried using tusb midi and found that it works fine to sending MIDI message . But when I want to receive the data it doesn't work
till I try to print out the status It's not show anything. While I can still send MIDI message normally.
Code: Select all
static void midi_task_read_example(void *arg)
{
// The MIDI interface always creates input and output port/jack descriptors
// regardless of these being used or not. Therefore incoming traffic should be read
// (possibly just discarded) to avoid the sender blocking in IO
uint8_t packet[4];
bool read = false;
for (;;)
{
vTaskDelay(1);
while (tud_midi_available())
{
printf("tud_midi_available\n");
read = tud_midi_packet_read(packet);
if (read)
{
printf(" Data: %02hhX %02hhX %02hhX %02hhX\n", packet[0], packet[1], packet[2], packet[3]);
// ESP_LOGI(TAG, "Read - Time (ms since boot): %lld, Data: %02hhX %02hhX %02hhX %02hhX",
// esp_timer_get_time(), packet[0], packet[1], packet[2], packet[3]);
}
}
}
}