Last active
March 6, 2017 06:43
-
-
Save 2bbb/38dcb04f99aef24a241276293f89924e to your computer and use it in GitHub Desktop.
ableton link test on Linux with node-abletonlink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| g++ -Inode_modules/abletonlink/libs/link/include -Inode_modules/abletonlink/libs/link/modules/asio-standalone/asio/include -std=c++11 -DLINK_PLATFORM_LINUX=1 -pthread link.cpp -o link.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <thread> | |
| #include <chrono> | |
| #include <limits> | |
| #include <ableton/Link.hpp> | |
| int main() { | |
| ableton::Link link(120.0); | |
| link.enable(true); | |
| double quantum = 4.0; | |
| double last_beat = 0.0; | |
| while(true) { | |
| const auto time = link.clock().micros(); | |
| auto timeline = link.captureAppTimeline(); | |
| double beat = timeline.beatAtTime(time, quantum); | |
| std::cout.precision(std::numeric_limits<double>::max_digits10); | |
| std::cout << beat << std::endl; | |
| if(last_beat == beat) { | |
| std::cout << "WTF" << std::endl; | |
| return -1; | |
| } | |
| last_beat = beat; | |
| std::this_thread::sleep_for(std::chrono::milliseconds(10)); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment