[Stk] unhandled exception when using BlitSaw with std::vector

Nick Dika nhdika at gmail.com
Wed Jun 19 06:09:17 PDT 2013


Thanks Stephen. Here's a simplified version of what I'm doing.

This works:

stk::BlitSaw oscArray[10];

for( int i=0; i < 10; i++ )
{
stk::BlitSaw saw;
saw.setHarmonics(0);
saw.setFrequency(220);
oscArray[i] = saw;
}

This breaks:

std::vector<stk::BlitSaw> oscs;

for( int i=0; i < 10; i++ )
{
stk::BlitSaw saw;
saw.setHarmonics(0);
saw.setFrequency(220);
oscs.push_back(saw);
}

the second example causes an unhandled exception/access violation reading
from a location. As mentioned this appears to happen after
StkFrames::resize() is called (I don't fully understand why this would be
called).

thanks, n



On Wed, Jun 19, 2013 at 8:41 AM, Stephen Sinclair
<sinclair at music.mcgill.ca>wrote:

> On Wed, Jun 19, 2013 at 2:36 PM, Nick Dika <nhdika at gmail.com> wrote:
> > Hi All,
> >
> > Advance apologies for amateurish questions, I'm new to all of this :)
> >
> > I am attempting to use STK's BlitSaw oscillator within a Juce project. I
> am
> > currently not using any of STK's frames functionality, I'm just filling
> > Juce's own audio buffer with ticks from the BlitSaw. It's my
> understanding
> > that using StkFrames would be redundant here, so i've just not used it.
> >
> > I am working with some stacked oscillators that I'm summing together,
> pretty
> > basic stuff. Currently if I create an array of BlitSaws, that appears to
> > work just fine. It would be more convenient to use a std::vector.
> > Unfortunately trying to use the vector container causes unhandled
> exceptions
> > for me. From looking back through the call stack, it looks like at some
> > point STKFrames::resize() gets called then things blow up.
> >
> > Can anyone suggest what I might do to fix this? Must I (or should I) be
> > using StkFrames somehow in this scenario? Thanks!
>
> There is little reason why an std::vector would behave differently
> than a regular C++ array.  Can you post some minimal example code that
> causes the exception?  What's the exception, anyway?
>
> Steve
>
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20130619/895b4298/attachment.html 


More information about the Stk mailing list