Problems using audioDeviceManager!


#1

Hi,

I’m trying to build a simple project which takes an audio input stream, process it and then
play the proccessed sound. In my top-level component class I’ve added the code below and when
running i get an unhandled exception; the call stack window of visual express 2005 prompts the
following error:

[quote]juce_application.exe!_VEC_memzero(void * dst=0xcdcdcdcd, int val=0, int len=926365492) + 0x6a bytes C
juce_application.exe!VstAnalyzer::audioDeviceAboutToStart(double sampleRate=44100.000000000000, int numSamplesPerBlock=960) Line 144 + 0x18 bytes C++[/quote]

Can anyone please tell me what I’ve done wrong?

[code]public:

audioDeviceManager = new AudioDeviceManager();
audioDeviceManager->initialise(1,2,0,true);
audioDeviceManager->setAudioCallback(this);

void audioDeviceIOCallback (const float** inputChannelData,
int totalNumInputChannels,
float** outputChannelData,
int totalNumOutputChannels,
int numSamples)
{
/for (int i = 0; i < totalNumInputChannels; ++i)
{
if (inputChannelData [i] != 0)
{
for (int j = 0; j < numSamples; ++j)
outputChannelData[i][j] = inputChannelData [i][j];
break;
}
}
/
}

void audioDeviceAboutToStart (double sampleRate, int numSamplesPerBlock){
zeromem (circularBuffer, sizeof (float) * bufferSize); }

void audioDeviceStopped() {
zeromem (circularBuffer, sizeof (float) * bufferSize); }

private:
float* circularBuffer;
float currentInputLevel;
int volatile bufferPos, bufferSize, numSamplesIn;[/code]


#2

A very basic c++ mistake - you’re obviously using an uninitialised buffer, as you can see from the 0xcdcdcdcd address.

For god’s sake, will people please turn on their debuggers! I’m here to answer JUCE questions, not to help people track down bugs in their own code!

And please don’t post titles like “problem with AudioDeviceManager”, unless you’ve actually proved that it really is a problem with the AudioDeviceManager! Visitors browse this forum, and might get the wrong impression from a glance down the list of topic names.


#3

[quote=“jules”]A very basic c++ mistake - you’re obviously using an uninitialised buffer, as you can see from the 0xcdcdcdcd address.

For god’s sake, will people please turn on their debuggers! I’m here to answer JUCE questions, not to help people track down bugs in their own code!

And please don’t post titles like “problem with AudioDeviceManager”, unless you’ve actually proved that it really is a problem with the AudioDeviceManager! Visitors browse this forum, and might get the wrong impression from a glance down the list of topic names.[/quote]

Wooow, someone having a bad day?

Didn’t know that this forum was intended for skilled programmers only. Some of us are not skilled and need a little more help to get started here. An unhandled exception prompting “0xcdcdcdcd address” I’m sure is not common knowledge for all of us. Maybe it would be a good idea to create another section in your forum for no-brainers like me where questions can be answered by the ones who have that extra portion of time! As a beginner it’s difficult to figure out whether the problem is related to the JUCE library or the language!

My title was not critisising the JUCE library, instead it was critisising USAGE of it …maybe I’m completly wrong here but I don’t speak english natively…I’m sorry if my English is not qualified for this forum!


#4

i understand jules frusration here. especially going by recent posts.

but, jules, you have created a wonderfull library which is very attractive to the newcomer. you are going to get noobs here. (not calling you a noob huereka!)

juce certainly gave me a huge productivity boost cos of its JDKishness. I came from Java and I used to and still do make stupid C++ clangers. I asked some dum questions in the past. you didn’t mind then.

my boss is quite experienced and fucking HATES your singleton macros which he discovered in my code. I’ll get round to telling him that they are thread safe and a little more than a macroed 3 liner singleton.

blah


#5

Yeah, sorry, didn’t mean it to sound that snappy! I do seem to have been spending a lot of my time looking for bugs in other people’s code recently though.

If people want to post general c++ coding questions on the forum then that’s cool, but maybe try to mark it as not being a juce bug, so that I can skip it if I’m busy.

But my singletons are the finest singletons known to mankind! I’d actually have preferred to do them as templates, which is how I originally wrote them, but it involved stretching templates beyond their limits, and macros actually worked out as a much neater solution. If he’s got a better design, I’d love to hear about it!


#6

i remember my noob days, when i received those “0xbaadf00d” memory access errors, thinking my compiler needed something better to eat than a plain text file :slight_smile:


#7