[Stk] voicer.tick() eventually causes EXC_BAD_ACCESS
Patrick J. Collins
patrick at collinatorstudios.com
Thu Aug 20 13:28:07 PDT 2015
Hi everyone,
I am filling a buffer with samples from a voicer object:
short *buffer;
NSUInteger size = BUFFER_SIZE * 2;
buffer = (short *)malloc(size);
for (int i = 0; i < BUFFER_SIZE; i++) {
float sample = voicer->tick();
buffer[i] = sample * (1 << 15);
}
It seems after a while of my app running it will crash... When attempting to debug, I am seeing:
voices_[i].instrument->tick();
which calls:
stk::Rhodey::tick():
temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
which calls:
stk::FileLoop::tick():
lastFrame_[i] = data_.interpolate( tyme, i );
which crashes on this line:
StkFloat output, alpha = frame - (StkFloat) iIndex; // fractional part of index
...
Some debugger output:
(lldb) expr frame
(stk::StkFloat) $13 = 668.52794056178266
(lldb) expr channel
(unsigned int) $14 = 0
(lldb) expr nFrames_ - 1
(unsigned long) $16 = 1024
(lldb) expr (StkFloat) nFrames_ - 1
error: Trying to put the stack in unreadable memory at: 0x61aaff0.
... Any idea what would cause this to happen?
Patrick J. Collins
http://collinatorstudios.com
More information about the Stk
mailing list