|
|
ingo <ing### [at] tagpovrayorg> wrote:
> in news:606753c7$1@news.povray.org William F Pokorny wrote:
>
> > I'm not aware of any such feature
>
> Bill, Tor Olav,
>
> Usefull suggestions, as allways. Thanks! But I'm just not sure either one
> of the ways is what I'm thinkin' of. I.i.r.c It was something Thorsten
> mentioned / showed when functions where introduced.
> Anyway I'll study your suggestions. For now I "fixed" it by calling
> another function. Works fine, no hurries.
>
> /*:Ramp Oscilator, goes from 0 to 1 over 1 Frequency period
>
> Not for direct sound use because of DC.
> */
>...
Ingo
I'm sorry, but I have no recollection of such a feature.
In your TriangleOsc function the same Ramp value is calculated 5 times.
If you want more efficient functions then I suggest something like this:
#declare TempFn =
function(Ramp) {
select(
Ramp - 0.25,
Ramp,
select(
Ramp - 0.75,
0.5 - Ramp,
Ramp - 1
)
)
}
;
#declare TriangleOscFn =
function(Freq, Amp, Tick, SRate) {
4*Amp*TempFn(Freq/SRate*mod(Tick, SRate/Freq))
}
;
--
Tor Olav
http://subcube.com
https://github.com/t-o-k
Post a reply to this message
|
|