[Stk] problems implementing polyphony...
Gary Scavone
gary at ccrma.Stanford.EDU
Mon Sep 17 16:05:28 PDT 2012
Here is a temporary FM.h and FM.cpp that you can use to test this. Note that it only works for nOperators = 4;
Regards,
--gary
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FM.h
Type: application/octet-stream
Size: 3533 bytes
Desc: not available
Url : http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20120917/985052f4/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FM.cpp
Type: application/octet-stream
Size: 4454 bytes
Desc: not available
Url : http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20120917/985052f4/attachment-0001.obj
-------------- next part --------------
On 2012-09-17, at 3:46 PM, Patrick J. Collins <patrick at collinatorstudios.com> wrote:
>> The first think to try would be replacing the vectors of pointers with
>> a simple array of pointers (in FM.h).
>
> I am not sure if I know exactly how to do that...
>
> You are saying to change:
>
> std::vector<ADSR *> adsr_;
> std::vector<FileLoop *> waves_;
> std::vector<StkFloat> ratios_;
> std::vector<StkFloat> gains_;
>
> to arrays? But we don't know how much space to allocate for the
> arrays... So does it become something like:
>
> ADSR *adsr_;
> FileLoop *waves_;
> StkFloat ratios_;
> StkFloat gains_;
>
>
> and then in .cp:
>
> adsr_.resize( nOperators_ );
> waves_.resize( nOperators_ );
>
> becomes something like:
>
> adsr_ = (ADSR*)malloc(sizeof(ADSR) * nOperators_);
> waves_ = (FileLoop*)malloc(sizeof(FileLoop) * nOperators_);
>
> ?
>
> And then I am not sure what happens with ratios_ and gains_...
>
> ratios_ = *(StkFloat*)malloc(sizeof(StkFloat) * nOperators_);
> gains_ = *(StkFloat*)malloc(sizeof(StkFloat) * nOperators_);
>
> ?
>
> Then I am really unsure what to do with the .push_back for ratios_ and
> gains_... But doing this shows a ton of errors.. delete waves_[i]
> doesn't work either.
>
>
> Patrick J. Collins
> http://collinatorstudios.com
>
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
More information about the Stk
mailing list