« Return to Thread: EnvGen gotcha - fix or document?

Re: ?spam? Re: EnvGen gotcha - fix or document?

by Julian Rohrhuber :: Rate this Message:

Reply to Author | View in Thread

>
>So in the interest of supporting future arguments, should we have
>
>enum {
> kEnvGen_gate,
> kEnvGen_levelScale,
> kEnvGen_levelBias,
> kEnvGen_timeScale,
> kEnvGen_doneAction,
> kEnvGen_initLevel,
> kEnvGen_numStages,
> kEnvGen_releaseNode,
> kEnvGen_loopNode,
> kEnvGen_nodeOffset
>
>};
>
>And then...
>
> int stageOffset = (unit->m_stage << 2) + kEnvGen_nodeOffset


it would read much better like this.



>?
>
>hjh
>
>
>On Jun 26, 2008, at 1:28 AM, Julian Rohrhuber wrote:
>
>>I think you shouldn't write
>>ZIN0(unit->mNumInputs - 4)
>>this would break if someone was to add an argument. Better use the
>>index defined in:
>>
>>enum {
>> kEnvGen_gate,
>> kEnvGen_levelScale,
>> kEnvGen_levelBias,
>> kEnvGen_timeScale,
>> kEnvGen_doneAction,
>> kEnvGen_initLevel,
>> kEnvGen_numStages,
>> kEnvGen_releaseNode,
>> kEnvGen_loopNode
>>};
>>
>>
>>
>>
>>>This patch passes my test case from before, and others to make
>>>sure levelScale and levelBias are properly applied.
>>>
>>>Last chance to object... I'll commit tomorrow AM.
>>>hjh
>>>
>>>Index: LFUGens.cpp
>>>===================================================================
>>>--- LFUGens.cpp (revision 7637)
>>>+++ LFUGens.cpp (working copy)
>>>@@ -1988,8 +1988,13 @@
>>>                 counter  = sc_max(1, counter);
>>>                 unit->m_stage = numstages;
>>>                 unit->m_shape = shape_Linear;
>>>-               unit->m_grow = -level / counter;
>>>-               unit->m_endLevel = 0.;
>>>+               unit->m_endLevel = ZIN0(unit->mNumInputs - 4) *
>>>ZIN0(kEnvGen_levelScale) + ZIN0(kEnvGen_levelBias);
>>>+               unit->m_grow = (unit->m_endLevel - level) / counter;
>>>         } else if (unit->m_prevGate > 0.f && gate <= 0.f
>>>                         && unit->m_releaseNode >= 0 && !unit->m_released) {
>>>                 counter = 0;
>>>@@ -2205,8 +2210,13 @@
>>>                 counter  = sc_max(1, counter);
>>>                 unit->m_stage = numstages;
>>>                 unit->m_shape = shape_Linear;
>>>-               unit->m_grow = -level / counter;
>>>-               unit->m_endLevel = 0.;
>>>+               unit->m_endLevel = ZIN0(unit->mNumInputs - 4) *
>>>ZIN0(kEnvGen_levelScale) + ZIN0(kEnvGen_levelBias);
>>>+               unit->m_grow = (unit->m_endLevel - level) / counter;
>>>         } else if (unit->m_prevGate > 0.f && gate <= 0.f
>>>                         && unit->m_releaseNode >= 0 && !unit->m_released) {
>>>                 counter = 0;
>>>@@ -2439,8 +2449,8 @@
>>>                  counter  = sc_max(1, counter) + i; \
>>>                  unit->m_stage = numstages; \
>>>                  unit->m_shape = shape_Linear; \
>>>-                unit->m_grow = -level / counter; \
>>>-                unit->m_endLevel = 0.; \
>>>+                               unit->m_endLevel =
>>>ZIN0(unit->mNumInputs - 4) * ZIN0(kEnvGen_levelScale) +
>>>ZIN0(kEnvGen_levelBias); \
>>>+                               unit->m_grow = (unit->m_endLevel -
>>>level) / counter; \
>>>                  nsmps = i; \
>>>                  break; \
>>>          } else if (prevGate > 0.f && gate <= 0.f \
>>>
>>>
>>>: H. James Harkins
>>>
>>>:
>>><<mailto:jamshark70@...>mailto:jamshark70@...><mailto:jamshark70@...>jamshark70@...
>>>
>>>:
>>><<http://www.dewdrop-world.net>http://www.dewdrop-world.net><http://www.dewdrop-world.net>http://www.dewdrop-world.net
>>>
>>>.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
>>>
>>>
>>>"Come said the Muse,
>>>
>>>Sing me a song no poet has yet chanted,
>>>
>>>Sing me the universal."  -- Whitman
>>>
>>
>>
>>--
>>
>>
>>
>>
>>
>>.
>>
>>_______________________________________________
>>sc-dev mailing list
>>
>>
>>info (subscribe and unsubscribe):
>><http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880>http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
>>archive:
>><http://www.listarc.bham.ac.uk/marchives/sc-dev/>http://www.listarc.bham.ac.uk/marchives/sc-dev/
>>search:
>><http://www.listarc.bham.ac.uk/lists/sc-dev/search/>http://www.listarc.bham.ac.uk/lists/sc-dev/search/
>>
>
>
>: H. James Harkins
>
>: <mailto:jamshark70@...>jamshark70@...
>
>: <http://www.dewdrop-world.net>http://www.dewdrop-world.net
>
>.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
>
>
>"Come said the Muse,
>
>Sing me a song no poet has yet chanted,
>
>Sing me the universal."  -- Whitman


--





.

_______________________________________________
sc-dev mailing list


info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/

 « Return to Thread: EnvGen gotcha - fix or document?

LightInTheBox - Buy quality products at wholesale price!