Xojo Conferences
XDCMay2019MiamiUSA

[MBS] PortAudio fun followup 2 (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Next thread: [MBS] PortAudio fun followup


[MBS] PortAudio fun followup   -   Garth Hjelte
  [MBS] PortAudio fun followup 2   -   Garth Hjelte
   Re: [MBS] PortAudio fun followup 2   -   Christian Schmitz
    Re: [MBS] PortAudio fun followup 2   -   Christian Schmitz
    Re: [MBS] PortAudio fun followup 2   -   Garth Hjelte
     [MBS] [ANN] 12.3pr2   -   Christian Schmitz

[MBS] PortAudio fun followup 2
Date: 30.04.12 05:23 (Sun, 29 Apr 2012 23:23:06 -0500)
From: Garth Hjelte

>You'll like this one...
>
>So your fix/suggestion on PortAudio, to set the OutputParameters.SampleFormat to paFloat32 and SuggestedLatency = .2 worked to cure the dropout. Yea!
>
>But after that, and what I thought was unrelated, was that my display cursor for my waveform picture all of a sudden got jumpy, like the resolution for the graphics got all weird. I checked lots of things regarding graphics but couldn't find the answer.
>
>Finally I found that Stream.SamplePosition was giving me the same values over say 8512 samples worth, like the resolution went way down. That was causing the jumpy cursor. BUT...
>
>So I went back to the stream and I commented out the SuggestedLatency = .2 line, and now the cursor is smooth again but the dropout is back. I thought the problem was related to the SampleFormat parameter, but no, it looks like the suggested latency is what cured it, but then the resolution of SamplePosition is unacceptable.
>
>Any ideas?

To be more clear, .2 Latency means 200ms, which is 8820 samples on a 44.1k sample. In other words, when SuggestedLatancy is set to .2, then OutputPosition is updated every 200ms. I'm not sure if that has to be, does it?

But anyway, more importantly, I think I have it solved - .2 was way too big a number. I just take the number given by PortAudioDeviceInfoMBS.DefaultHighOutputLatency, which is more like .01 (10ms) and hand it to SuggestedLatency. I guess they have to match or SL needs to be that or over now; in the past they didn't have to.

But should OutputPosition lose resolution like that anyway?

Garth Hjelte
Sampler User

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] PortAudio fun followup 2
Date: 30.04.12 09:05 (Mon, 30 Apr 2012 10:05:58 +0200)
From: Christian Schmitz

Am 30.04.2012 um 06:23 schrieb Garth Hjelte:

> But should OutputPosition lose resolution like that anyway?

Well, OutputPosition goes up by frameCount in the internal callback.
So it should go up by some fixed value with every callback.

Greetings
Christian

Re: [MBS] PortAudio fun followup 2
Date: 30.04.12 20:34 (Mon, 30 Apr 2012 21:34:08 +0200)
From: Christian Schmitz

Am 30.04.2012 um 16:25 schrieb Garth Hjelte:

> It's not; it's tied into SuggestedLatency in some way and you can tell this at higher values.

Well, SuggestedLatency defines what block size used for the audio buffers.

And when the sound library calls the plugin to get new frames, the plugin counts up the OutputPosition for every float value it delivers.

That may make the OutputPosition jump up by 512 frames for each call or 10000 if the library needs that.

Greetings
Christian

Re: [MBS] PortAudio fun followup 2
Date: 30.04.12 15:25 (Mon, 30 Apr 2012 09:25:23 -0500)
From: Garth Hjelte
At 03:05 AM 4/30/2012, you wrote:

>> But should OutputPosition lose resolution like that anyway?
>
>Well, OutputPosition goes up by frameCount in the internal callback.
>So it should go up by some fixed value with every callback.

It's not; it's tied into SuggestedLatency in some way and you can tell this at higher values. I'm pinging it pretty heavily; for example if SuggestedLatency is .2 (200ms), OutputPosiiton only changes every 200ms. I ping it many times within 200ms and OutputPosition gives me the same value. That's why my wavehead cursor looked jumpy, because my app was drawing it in the same position because OutputPosition was giving it the same values until the next 200ms.

This means less to me now, since I know now to set SuggestedLatency closer (or equal to) to what PortAudioDeviceInfoMBS.DefaultHighOutputLatencygives me. But I'm saying more for you in case it is a bug. It may not be, perhaps that what SuggestedLatency means by definition.

Since not setting SuggestedLatency is now a no-no, I'd update the examples if you haven't already. I like setting it in respect to PortAudioDeviceInfoMBS.DefaultHighOutputLatency, like this:

OutputParameters.SampleFormat = paFloat32
DeviceInfo = MyPortAudio.DeviceInfo(MyIndex)
OutputParameters.SuggestedLatency = DeviceInfo.DefaultHighOutputLatency // CoreAudio on my computer seems around .01; that is 10ms
ErrCode = MyStream.OpenStream(OutputParameters, MySampleRate, paFramesPerBufferUnspecified, paNoFlag)

Garth Hjelte
Sampler User

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info