question: does Juce support multichannel audio?
I’m on OSX and need to have some multichannel support.
In the end I need to have 6 channels of audio via the 7.1 hdmi output.
I’d like to have the 6 channels of audio in a multichannel (8 channel, with 2 channels silent) wav file.
Is this somehow possible?
I also tried using the audio thumbnail functions, but it crashes on opening a multichannel file.
WhatVIncentSaid++; Just make a little test application and try it out![/quote]
well thats what i did. but i can only test it at the moment using an aggregate device, and it doesn’t work.
It only plays on first 2 channels of aggregate device.
And like i said, audiothumbnail on a wavfile with >2 channels just crashes
In what app? More likely to be the code that uses the thumbnail which is at fault, rather than the thumbnail code, but if you can show me some code that should work but crashes, then I’d obviously want to see that!
:shock: Woops! After reading the posts, I see that I’ve been missing out… I realized that I had to update my driver to get control over my speaker configuration (7.1 maximum - which all channels are available to me in JUCE)! Sorry! :?
In what app? More likely to be the code that uses the thumbnail which is at fault, rather than the thumbnail code, but if you can show me some code that should work but crashes, then I’d obviously want to see that![/quote]
void AudioClip::openFile() {
label = new Label (T("File: "), currentFile->getFileName());
label->setBounds (1, 1, 280, 20);
addAndMakeVisible(label);
audiosystem->reader = audiosystem->formatManager->createReaderFor(*currentFile);
if (audiosystem->reader != 0)
{
audiosystem->readerSource = new AudioFormatReaderSource(audiosystem->reader,true);
audiosystem->audiotransportsource->setSource(audiosystem->readerSource, 32768,audiosystem->reader->sampleRate);
audiosystem->audiosourceplayer->setSource(audiosystem->audiotransportsource);
hasFile=true;
thumbnail = new AudioThumbnail(128, *audiosystem->formatManager, *audiosystem->thumbnailcache);
FIS = new FileInputSource(*currentFile);
thumbnail->setSource(FIS);
thumbnail->addChangeListener(this);
}
else
{
DBG("Could not create reader");
}
}
this is my code that opens fine.
Works with mono and stereo wav files, but crashes on multichannel files.
it crashes in the juce::findMinAndMax(int const*, int int& int&) function in juce_MathsFunctions.h on line 168:
Type mn (*values++);
Thanks Patrick, but before I spend time investigating, are you definitely using the very latest version (modules branch)?
(And when reporting crashes, please always give a stack trace. There’s really no point that findMinAndMax crashes, because obviously the important thing to know would be why that function is getting called with a duff parameter).
So, after a lot of fiddling i’m now using the latest Juce version (JUCE v2.0.16).
My application runs, and reads stereo files, but it still crashes on the multichannel wav file.
One thing i noticed is the function AudioFormatReader::readMaxLevels.
It takes reference parameters for lowestLeft, lowestRight etc.
How is this supposed to work with multichannel files, where there is no “left” or “right” ?
int k;
for (k = 1; k <= numChannels; k++)
tempBuffer[k] = tempSpace.getData() + bufferSize;
tempBuffer[k] = 0;[/code]
This will compile okay in XCode… however may not compile in Windows (I haven’t checked)… in which case you’ll have to allocate tempBuffer on the heap.
This will only draw the first 2 channels in the thumbnail - Ultimately AudioFormatReader::readMaxLevels & AudioThumbnail::getLevels() need to be rewritten to pass a pointer to an array of values instead of the four floats for the left & right channels’ mins & maxes.