[Stk] Realtime Effect Processing Using Callback

BEN SHEPHERD benshep at roadrunner.com
Mon Jan 5 09:09:13 PST 2009


I've added breakpoints inside the tick (and computesample) functions,  
but it doesn't make it that far. I'll look at the pointer creation,  
but I'm using code from the tutorials, as I attached previously. In  
main() I'm doing the typical:
Delay * delay = new Delay();
Followed by 2 setDelay functions. I then pass &delay via the  
openstream function.

-Ben

On Jan 5, 2009, at 11:52 AM, "Stephen Sinclair" <sinclair at music.mcgill.ca 
 > wrote:

> If the debugger finds that it is crashing when delay->tick() is
> called, there may be a problem with your "delay" pointer I would
> guess, but if it manages to step into the Delay::tick() function, and
> then crashes inside it, let us know what line it is crashing on.
>
> Steve
>
> On Mon, Jan 5, 2009 at 11:18 AM, BEN SHEPHERD  
> <benshep at roadrunner.com> wrote:
>> Thanks for the quick response. I have tried and am able to run the  
>> duplex
>> and sine programs. I don't believe either of them call the tick  
>> method
>> though. I have used the debugger to show that the tick call (tested  
>> on both
>> chorus and delay) is where the program generates the error. I don't
>> currently have access to my code, but I'll send more later.
>>
>> -Ben
>>
>> On Jan 5, 2009, at 10:13 AM, "Stephen Sinclair" <sinclair at music.mcgill.ca 
>> >
>> wrote:
>>
>>> Hi,
>>>
>>> 2009/1/5 BEN SHEPHERD <benshep at roadrunner.com>:
>>>>
>>>> I'm attempting to read from an input, process with a delay, and  
>>>> output in
>>>> realtime and my program stops when delay->tick is called with an  
>>>> "access
>>>> segmentation" or memory error.  I'm on Windows XP, using ASIO  
>>>> only.  I
>>>> have
>>>> been able to successfully use the Duplex program which uses  
>>>> memcpy to
>>>> copy
>>>> the inputBuffer to outputBuffer.  I've tried different classes  
>>>> including
>>>> Chorus but with the same result.  I apologize in advance if I'm  
>>>> missing
>>>> something simple, but I've poured through all the documentation and
>>>> examples
>>>> I could find.
>>>
>>> "memory error" sounds like something not initialized or out of  
>>> bounds.
>>> I would try stepping through it with a debugger to see if anything  
>>> is
>>> strange.  Your callback looks okay to me but I can't tell more  
>>> without
>>> seeing the whole program.
>>>
>>> You say you're able to run the examples without problems?
>>>
>>> Steve
>>>
>>>
>>>> int tick( void *outputBuffer, void *inputBuffer, unsigned int
>>>> nBufferFrames,
>>>>      double streamTime, RtAudioStreamStatus status, void  
>>>> *dataPointer )
>>>> {
>>>> Delay *delay = (Delay *) dataPointer;
>>>> StkFloat *oSamples = (StkFloat *) outputBuffer;
>>>> StkFloat *iSamples = (StkFloat *) inputBuffer;
>>>>
>>>> for ( int i=0; i<nBufferFrames; i++ )
>>>>    *oSamples++ = delay->tick(*iSamples++);
>>>>
>>>> return 0;
>>>> }
>>>>
>>
>>
>>
>>
>
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk



More information about the Stk mailing list