Hi all,
I'm using the lastest JUCE on OSX 10.9, and Xcode 5.1.1.
I have been having some trouble allocating a HeapBlock<float> in prepareToPlay() and accessing it in processBlock().
And the HeapBlock<float> variable is declared in the header file.
I have gone though other posts but they didn't work for me because whenever I try to access any element in the HeapBlock<float> variable I always get an error as below:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000001eab6000
This is what I'm doing:
1. After allocating the memory and inspect the memory address in prepareToPlay(), it looks like this:
TempmemoryForBuffs.allocate(numChannels * 10, true);
char address[50];
sprintf(address, "%p", (void*)TempmemoryForBuffs);
String memoryAddress = String(address); // --> This shows 0x1223f2000
2. If I inspect the same variable in processBlock(), it looks like this:
char address[50];
sprintf(address, "%p", (void*)TempmemoryForBuffs);
String memoryAddress = String(address); // --> This shows 0x223f2000
As you can see the memory address of the same variable in both places are different.
It seems to be that the memory address used in prepareToPlay() is using 64 bits, where as processBlock() is using 32 bits cutting off the upper 32 bits.
I am wondering how this could happen. Is this a problem with the JUCE version ?
Is it a case that processBlock() always uses 32 bit wide memory block somehow?
What could be a fix or workaround for situation like this?
Thank you,