tag:blogger.com,1999:blog-6426055874900292298.post5310681899141623040..comments2022-05-31T05:22:08.884-07:00Comments on harryhaaren: Tutorial: JACK RingbuffersHarry van Haarenhttp://www.blogger.com/profile/07224643902643484992noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-6426055874900292298.post-23407747161930988412012-02-28T18:36:17.888-08:002012-02-28T18:36:17.888-08:00You don't need to sleep 1 second. It is easy t...You don't need to sleep 1 second. It is easy to take the samplerate (48khz, for instance) and the block size (512 frames). So you can calculate how long it will take to process block. In this example, 10,666666667 milliseconds. So you will not need to wait this 0.99 seconds to close the program.Schiavonihttps://www.blogger.com/profile/14823921615000313126noreply@blogger.comtag:blogger.com,1999:blog-6426055874900292298.post-4132039895156422492012-01-01T03:17:09.998-08:002012-01-01T03:17:09.998-08:00Hi Tristan.
Essentially yes, you could do that. I...Hi Tristan.<br /><br />Essentially yes, you could do that. I presume you're goal is to have the JACK thread read all the events before the program quits?<br /><br />Then your on the right track yup! -HarryHarry van Haarenhttps://www.blogger.com/profile/07224643902643484992noreply@blogger.comtag:blogger.com,1999:blog-6426055874900292298.post-27452442254119972772011-12-29T11:01:17.238-08:002011-12-29T11:01:17.238-08:00Great example! How can you ensure that the main th...Great example! How can you ensure that the main thread doesn't exit while the process callback is happening? Would it be safe to add something like:<br /><br />while (jack_ringbuffer_read_space(buffer))<br /> usleep(1000);<br /><br />after the for loop in the main thread?Tristan Matthewshttps://www.blogger.com/profile/00636142362637536578noreply@blogger.comtag:blogger.com,1999:blog-6426055874900292298.post-47306143163745006202011-11-17T04:56:47.165-08:002011-11-17T04:56:47.165-08:00Same goes for this test:
if (written != sizeof(in...Same goes for this test:<br /><br />if (written != sizeof(int) ) {<br /><br />(see the source code of jack/ringbuffer.c. Your test can never succeed.)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6426055874900292298.post-48034359949707593322011-11-17T04:51:35.591-08:002011-11-17T04:51:35.591-08:00Nice code. Here's a couple of comments:
1. Th...Nice code. Here's a couple of comments:<br /><br />1. This test is not necessary:<br /><br />if ( result != sizeof(int) ) {<br /><br />There must be some weird<br />bug in jack_ringbuffer_read for this to fail.<br /><br /><br />2. There should probably be a comment that<br />doing "std::cout <<" is not real-time safe.<br />Doing so should only be done for debugging or<br />educational purposes.Anonymousnoreply@blogger.com