| 40 | } |
| 41 | |
| 42 | void tickTask(void* userParam) |
| 43 | { |
| 44 | ableton::Link link(120.0f); |
| 45 | link.enable(true); |
| 46 | |
| 47 | if (PRINT_LINK_STATE) |
| 48 | { |
| 49 | xTaskCreate(printTask, "print", 8192, &link, 1, nullptr); |
| 50 | } |
| 51 | |
| 52 | gpio_set_direction(LED, GPIO_MODE_OUTPUT); |
| 53 | |
| 54 | while (true) |
| 55 | { |
| 56 | const auto state = link.captureAudioSessionState(); |
| 57 | const auto phase = state.phaseAtTime(link.clock().micros(), 1.); |
| 58 | gpio_set_level(LED, fmodf(phase, 1.) < 0.1); |
| 59 | vTaskDelay(1); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | extern "C" void app_main() |
| 64 | { |