The problem is that the ogg file gets played back but sounds all clipped.
I should note the floating point vales come out at 0.f to around 10.f
[code]void JlethalAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
static unsigned int ti = 0;
// This is the place where you'd normally do the guts of your plugin's
// audio processing...
const int numsamples = buffer.getNumSamples();
const int maxchannels = getNumInputChannels() >= 2 ? 2 : 1;
for(int channel = 0; channel < maxchannels; ++channel)
{
float* channelData = buffer.getSampleData(channel);
if(channelData != NULL)
{
for(int i = 0; i < numsamples; ++i)
{
if(ti >= m_soundbank.GetSampleSet()->sample->len-1)
ti = 0;
channelData[i] = m_soundbank.GetSampleSet()->sample[55].fsample[channel][ti];
ti++;
}
}
// ..do something to the data...
}
// In case we have more outputs than inputs, we'll clear any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
{
buffer.clear (i, 0, buffer.getNumSamples());
}
}
[/code]
Here’s the loader code
[code]bool SoundBank::LoadOgg(const char* filename, stereosample &sample)
{
juce::File SrcFile = juce::File(filename);
juce::FileInputStream* InputStream = SrcFile.createInputStream();
if(InputStream == NULL)
return false;
juce::OggVorbisAudioFormat FlacFormat;
juce::AudioFormatReader *FlacFormatReader = FlacFormat.createReaderFor(InputStream, true);
sample.len = FlacFormatReader->lengthInSamples;
if(FlacFormatReader == NULL)
{
delete InputStream;
return false;
}
sample.fsample[0] = new float[sample.len];
if(sample.fsample[0] == NULL)
{
delete InputStream;
return false;
}
sample.fsample[1] = new float[sample.len];
if(sample.fsample[1] == NULL)
{
delete [] sample.fsample[0];
delete InputStream;
return false;
}
AudioSampleBuffer* buff = new AudioSampleBuffer(2, sample.len+1);
FlacFormatReader->read(buff, 0, sample.len, 0, true, true);
if(buff == NULL)
{
delete [] sample.fsample[0];
delete [] sample.fsample[1];
delete InputStream;
return false;
}
for(juce::int64 i = 0; i < sample.len; ++i)
{
sample.fsample[0][i] = *buff->getSampleData(0, i);
sample.fsample[1][i] = *buff->getSampleData(1, i);
}
delete buff;
delete InputStream;
return true;
}[/code]