[Stk] rtaudio - priority and keyboard events

TJF tjfoerster at web.de
Wed Aug 22 07:44:21 PDT 2012


Hi Gary,

I did this:

//------------------------------------------------

RtAudio::StreamOptions options;
   options.flags = RTAUDIO_MINIMIZE_LATENCY;
   options.flags = RTAUDIO_SCHEDULE_REALTIME;
   options.flags = RTAUDIO_HOG_DEVICE;
   options.flags = RTAUDIO_ALSA_USE_DEFAULT;
   options.numberOfBuffers = 2;
   options.priority = max;


std::cout << "\nPriority min: " << min << std::endl;
std::cout << "\nPriority max: " << max << std::endl;

// min and max are 1 and 99 ...

struct sched_param sched_p;
   //std::cout << "\nPriority IST: " << sched_getparam(getpid(), 
&sched_p) << std::endl;
   std::cout << "\nPriority IST: " << sched_getparam(0, &sched_p) << 
std::endl;

//------------------------------------------------

For the last line I get always "0". I is in an Linux environment with 
RT-Kernel (only command-line OS). The same with another "normal" Kernel 
and XFCE... The task manager also shows "0".

Do you have any idea?

Regards
Thomas


Am 16.08.2012 06:57, schrieb Gary Scavone:
> Hi Tomas,
>
> The "priority" option is only used if you also set the RTAUDIO_SCHEDULE_REALTIME flag.  The priority value (a number) corresponds to the linux realtime scheduling system … I can't remember the valid range of values, though whatever you provide is checked against:
>
>        int min = sched_get_priority_min( SCHED_RR );
>        int max = sched_get_priority_max( SCHED_RR );
>
> Regards,
>
> --gary
>
> On 2012-08-13, at 9:41 AM, TJF <tjfoerster at web.de> wrote:
>
>> Hi everybody,
>>
>> I am changing some things to bring my Windows application to Linux. I want to use the StreamOption "priority".
>>
>> Am I right to to use it this way (the second line)? May be also a second process -  the process name of my application?
>>
>> RtAudio::StreamOptions options;
>> options.priority =  ALSA;
>>
>> My other question: In Windows I used system keyboard events like this to control the command-line app from outside:
>>
>> (Ctrl+o)
>> if(GetAsyncKeyState(VK_CONTROL)&&GetAsyncKeyState(0x4F))
>>              {
>>                 ...
>>              }
>>
>> For Linux I couln't find something similar. What would be a "light-weight" solution: Using SDL (only keyboard-events)?
>>
>> Thanks a lot!
>> Regards
>> Thomas
>> _______________________________________________
>> Stk mailing list
>> Stk at ccrma.stanford.edu
>> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20120822/c15b66e4/attachment.html 


More information about the Stk mailing list