[Stk] crtsine example fixed for linux, can we update the docs?

Iain Duncan iainduncanlists at gmail.com
Sun Sep 11 13:48:49 PDT 2011


Hi Gary, by making a hybrid of playsaw.cpp and crtsine.cpp I was able to
figure out why the crtsine example doesn't work on my system, which is
64-bit Ubuntu Studio. The fix held true for both Alsa and jack.

In playsaw.cpp the following is included:

RtAudio::StreamOptions options;
options.flags |= RTAUDIO_HOG_DEVICE;
options.flags |= RTAUDIO_SCHEDULE_REALTIME;
#if !defined( USE_INTERLEAVED )
options.flags |= RTAUDIO_NONINTERLEAVED;
#endif

and the options object is passed to dac.openStream.  It turns out that the
RTAUDIO_NONINTERLEAVED option is critical on my box at least.

In crtsine, no options object is made or passed. Adding the following to
crtsine fixed everything and I can play back fine with any buffer size:

RtAudio::StreamOptions options;
// these two options are optional on linux
options.flags |= RTAUDIO_HOG_DEVICE;
options.flags |= RTAUDIO_SCHEDULE_REALTIME;
// the below is required to get clean output on my 64-bit linux, with either
jack or alsa
#if !defined( USE_INTERLEAVED )
options.flags |= RTAUDIO_NONINTERLEAVED;
#endif

...
dac.openStream( &oParams, NULL, format, sampleRate, &bufferFrames, &tick,
(void *)&sine, &options );
...


Not sure what you would like to do about the docs, but I can attest that
people checking out RtAudio would love to have that note there. I'm happy to
update them if it meets your approval. I'm just not sure how a user would
know whether they should be using non-interleaved or not.

thanks
Iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20110911/9ca48414/attachment.html 


More information about the Stk mailing list