Re: [LAD] jack ringbuffer question

From: lieven moors <lievenmoors@email-addr-hidden>
Date: Wed Dec 02 2009 - 04:51:28 EET

Paul Davis wrote:
> On Tue, Dec 1, 2009 at 9:22 PM, lieven moors <lievenmoors@email-addr-hidden> wrote:
>
>
>> if( (jack_ringbuffer_read_space( (*arps_jack)[i].rb ) ) ==
>> (sizeof( Arp ) * 2) )
>> {
>> jack_ringbuffer_read_advance( (*arps_jack)[i].rb, sizeof(Arp) ) ;
>> }
>>
>
> You've just moved the read ptrs, before reading any data. Why did you
> check to see if there were 2 Arp structures available, and then skip
> one of them?
>
>
>> if( (jack_ringbuffer_read_space( (*arps_jack)[i].rb ) ) ==
>> sizeof( Arp ) )
>>
>
> this won't return true unless there ONLY one Arp struct to read.
>
>
>> {
>> jack_ringbuffer_data_t data[2] ;
>> jack_ringbuffer_get_read_vector( (*arps_jack)[i].rb, data ) ;
>>
>
> now you've got a read vector, but *after* you advanced the read ptr.
>
>
>> if ( data[0].len > 0 )
>> {
>> arp = reinterpret_cast<Arp*>( data[0].buf ) ;
>> steps = &arp->steps ;
>> scale = &arp->scale ;
>> }
>> else if( data[1].len > 0)
>> {
>> cout << "data in second part of ringbuffer, this should not
>> happen!" << endl ;
>> }
>>
>
> now you've used the data from the ringbuffer, but not advanced the read ptr.
> if you're going to use get_read_vector() you want to do that first,
> then explicitly advanced the read ptr.
>
> not sure if this is all that is going wrong, but this looks odd/wrong
> to me as a starting point.
>
>
I want to repeat the same Arp, until there is an update to the text
file. One arp is allready
loaded in each ringbuffer in main(). When the file is modified, a second
one is added, and
process skips to the second one. Since I have only space for two arps in
the buffer, there
should always be exactly one which is readable. I know it is a bit
weird, but it seems to
work, apart from the problem I described.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Wed Dec 2 08:15:02 2009

This archive was generated by hypermail 2.1.8 : Wed Dec 02 2009 - 08:15:02 EET