No callback in ALSAAudioIODevice::start()?

was toying around with linux and found a bug (I think?) in juce_linux_Audio.cpp :
the ALSAAudioIODevice::start() function does not perform a callback to the audiodevicemanager, updating it with the real samplerate. Which later on causes an assert in MidiMessageCollector::addMessageToQueue, because it detects the dummy default samplerate has never been reset to the right one. For some reason this problem does not occur in the juce demo, but it did in my own app.

The fix that seems to work for me is:

[code] void start (AudioIODeviceCallback* callback)
if (! isOpen_)
callback = 0;

    internal->setCallback (callback);
    if (callback)
      callback->audioDeviceAboutToStart(sampleRate, bufferSizeSamples);
    isStarted = (callback != 0);

note: for this fix you also need to add sampleRate and BufferSizeSamples as private members to the class and initialize them in the open() method.

Yes, I’m glad you noticed that, it was quite an oversight! I’ve checked in a fixed version now, and it was missing the audioDeviceStopped() callback too, which I’ve also added. No idea how I managed to miss anything so obvious!

glad to be of help!

And a little linux question : do you have any plans for Jack device support in a future version? That would be really nice, too, if possible.

Yeah, I definitely want to add jack support; I’ve been saying I’d do it for ages, but haven’t found time to get stuck in and have a go yet…