Page 1 of 1

shutup audsrv

Posted: Wed Nov 09, 2005 1:46 pm
by radad
How do you get the audsrv to shut up? It seems to stutter the last thing it was sent.

Posted: Wed Nov 09, 2005 3:40 pm
by radad
Looking over the audsrv source I can see a few potential problems.

First the main thread doesn't check there is enough in the buffer to attempt to do an upsample of it. So it will just continue to plow through what is in the buffer. I think this is why I am getting the stuttering, it repeats over and over what is left in the buffer.

Secondly the upsamplers do not take into account that they are using a ring buffer and will happily wander off the end of it.

Thirdly the stepping over the read portion after the upsampling always assumes it will return to the beginning of the buffer if it has passed the end. This is related to the second problem listed above.

If nobody else is fixing these issues I will have a go soon.

Posted: Wed Nov 09, 2005 4:59 pm
by gawd
Hey.

I'm in a bit of a hurry, so I'll just bullet my way:

1. if you get stutters, then it means audsrv doesnt have enough audio. You are right that it will play the old buffer again, I thought I took care of that but I dont see the code here. Maybe I did offline and forgot to commit :) Either way, you will get sutters, whether if with old sample, or with silence (block-silence-block.) You can always stop audsrv with audsrv_stop and then play a sample to continue. The check is rather simple to add, just to check if the readpos crosses over the write position. If so, then playing = 0.

2. Upsamples work one block. 512 samples to be exact. The ringbuffer's size is 10 such blocks. Both main thread and upsamplers use the same size per block, so upsamplers never cross between blocks, or read non-audsrv memory.

3. Why should it return? It's a ringbuffer! :)

Reach me over MSN, that'd be much easier to discuss.
-- gawd.

Posted: Sat Nov 12, 2005 5:38 pm
by radad
Youre right, it should be easy to implement. BTW There is no audsrv_stop.

Not all upsamplers work in blocks of 512:
up_11025_8_stereo works in blocks of 234,
up_11025_16_stereo works in blocks of 470,
up_22050_16_stereo in blocks of 940,
up_44100_16_stereo works in blocks of 1880.
Or am I missing something?

I was refering to the read pointer returning to the begining of the ringbuffer. Which would be fine if all upsamplers work in blocks of 512.

Posted: Sun Nov 13, 2005 2:02 pm
by radad
I found audsrv_stop_audio on the iop side but it wasn't implemented on the ee side. I shall check that in soon.

As for the block sizes, I see that the size of the ringbuffer is set to an exact multiple of the block size so it shouldn't be an issue.

I tried putting in a check to make sure there isn't something to send to the sound driver but it crashed whenever I tried. Dont know what is up there.