syedhali / EZAudio

An iOS and macOS audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
Other
4.94k stars 822 forks source link

External Audio hardware? #261

Closed sarrass closed 8 years ago

sarrass commented 8 years ago

Hey Everyone,

EZAudioDevice *currentInputDevice = [EZAudioDevice currentInputDevice]; NSLog(@"currentInputDevice: %@", currentInputDevice);

and

NSArray *inputDevices = [EZAudioDevice inputDevices]; NSLog(@"inputDevices: %@", inputDevices);

work as expected WITHOUT connecting my RME babyface USB or MotU 828mk2 Firewire hardware, BUT if I do so, I get the following error (on exit):

Error: Failed to get frame size ('!siz')

Thanks alot!

feralresearch commented 8 years ago

Any luck figuring this out? I'm having the same problem with MOTU Ultralite via Firewire. In my case my application just crashes on startup with that message, but runs fine when it's unplugged. Doesn't seem to matter if the MOTU is selected as a source or not, only if it's present on the bus.

thermogl commented 8 years ago

Not exactly the same error, but I'm getting a crash when trying to use a FireFace 802 over Firewire. No crash when it's not plugged in.

feralresearch commented 8 years ago

I get this crash with any >2 channel external sound device (I've tried two MOTUs and a different brand). I think it is a bug in how the channels are iterated, but I haven't had a chance to investigate further (I ended up reworking the soundboard so I could make it work with the built-in stereo jack :P )

It doesn't matter if you're trying to use it, only if it's plugged in.

thermogl commented 8 years ago

Yeah I can confirm the > 2 channels - I just created an aggregate device (built-in output and cinema display) with 4 channels and that crashes.

thermogl commented 8 years ago

In + channelCountForScope:forDeviceID:

Replace: UInt32 propSize = sizeof(streamConfiguration);

With:

UInt32 propSize;
AudioObjectGetPropertyDataSize(deviceID, &address, 0, NULL, &propSize);
sarrass commented 8 years ago

still no luck with

NSArray *inputDevices = [EZAudioDevice inputDevices];

after changing +channelCountForScope:forDeviceID as you suggested...

thermogl commented 8 years ago

with the same error?

sarrass commented 8 years ago

When I turn off all compiler optimizations, using the -O0 flag, it works as it should, displaying all (external+internal) devices connected and working properly, sorry for the confusing message.

I am further investigating whether it crashes somewhere in the strlen method when using any other optimization flag... maybe someone has an idea?

thermogl commented 8 years ago

I just had to make some further changes to stop it crashing with high channel counts, but optimisation doesn't make a difference over here.

https://github.com/thermogl/EZAudio/commit/aed381d2085e285be8019dedf58ef36fa412a23f

sarrass commented 8 years ago

updated all files, everything works, all optimizations work :-)

thanks alot!

feralresearch commented 8 years ago

Just to say thank you - I finally got to test today and patch works great with my MOTU as well. Cheers.