Guest User

rtaudio with asio/wasapi in of0.9x

a guest
Mar 17th, 2016
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. /** quick hack to pick asio/wasapi in OF0.9x  this won't be necessary in of1.0 **/
  2.  
  3.  
  4. /** step 1: open libs/openFrameworks/sound/ofRtAudioSoundStream.cpp **/
  5.  
  6. #include <wchar.h>
  7.  
  8. bool checkForAsioArgs() {
  9.     LPWSTR *szArgList;
  10.     int argCount;
  11.  
  12.     szArgList = CommandLineToArgvW(GetCommandLine(), &argCount);
  13.     if (szArgList != NULL) {
  14.         for (int i = 0; i < argCount; i++) {
  15.             if (wcscmp(szArgList[i], L"asio")==0) {
  16.                 return true;
  17.             }
  18.         }
  19.         LocalFree(szArgList);
  20.     }
  21.     return false;
  22. }
  23.  
  24. bool of_rtaudiostream_use_asio = checkForAsioArgs();
  25. #define OF_RTAUDIO_API (of_rtaudiostream_use_asio?RtAudio::Api::WINDOWS_ASIO:RtAudio::Api::WINDOWS_WASAPI)
  26.  
  27.  
  28. /** step 2: there are two occurences of new RtAudio() in that same file. use instead: **/
  29. new RtAudio(OF_RTAUDIO_API)
  30.  
  31.  
  32. /** step 3: now build the solution (don't run it!).  **/
  33.  
  34. /** step 4: create a shortcut
  35. In windows explorer right click on myApp/bin/myApp.exe and create a new shortcut.
  36. rename it to "myApp.exe - Asio" so it's easy to find.
  37.  
  38. edit the shortcut. at the end of shortcut target add an 'asio' argument.
  39. for me the target is now:
  40.     C:\Users\be\Desktop\of_v0.9.3_vs_release\apps\myApps\sketchyscope\bin\sketchyscope.exe asio
  41.  
  42. don't worry about the absolute path. windows knows how to fix things if it gets moved around.
  43.  
  44. **/
  45.  
  46. /** step 5: double click your shortcut. **/
Add Comment
Please, Sign In to add comment