I'm okay on this one now. After spending two days experimenting with
Playback, and getting nothing usable (required me having to recopy my
buffer, and sending two tracks leads to latency and pain syncing them
accurately), I thought I'd try something else.

Now I'm using an AudioUnit with a C callback, and it's actually a lot
simpler, and let's me do exactly what I wanted. If anyone else wants to do
this, it's pretty simple to adapt the "SimpleSineWavePlayer" code from the
Chris Adamson book. I ported everything to Swift except the callback, which
I know (from previous messages on the CoreAudio list) would be unwise to
write in Swift because of performance. It's working great so far. Very
happy.

I understand all my emails from yesterday morning actually were making it
through to the list. Thanks to Corey, for writing me a quick note to let me
know, and saving me further embarrassment. I'd probably still be hitting
send otherwise.

Have a great weekend!

On Wed, Jul 29, 2015 at 2:36 PM, Charles Constant <
[email protected]> wrote:

> I'm using the AVAudioEngine player in a project where I need to play a
> stereo buffer. I want the option to store my left and right buffers as two
> separate vectors of Doubles.
>
> Currently I'm handling playback by using a function from the Accelerate
> framework to convert and copy the Doubles to the player's
> AVAudioPCMBuffer... which is where I would love some sage advice from you!
> Two problems with the approach I'm using:
>
> 1) at the moment I have to write data to .floatChannelData by arranging
> samples like so: [ L0 L1 L2 L3 ... R0 R1 R2 ... ] It would be more flexible
> if I could send the vectors separately (especially since I may realloc the
> size which is annoying when they're laid out one after the other). Is using
> an AVAudioEngine *mixer* the *only* way do this?
>
> 2) (less important) it would be nice if I could send Doubles without
> converting to Float32  but I get the impression that's not supported? Maybe
> This requires the AVAudioPCMBuffer? I'm not sure I'm sticking with Doubles
> anyways so it's not a huge issue (I have code for both)
>
> The best case scenario would let me keep the buffers up to date, and when
> it comes time to play them, just assign two pointers for the buffers. That
> would be just peachy. Does anyone with more experience than me know if it's
> possible?
>
> Thanks!
>
> PS: I'm hoping I haven't triple-posted this. I keep getting messages from
> the admin group that my email was rejected. If so, apologies for that too!
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to