How to get t (time) to calculate output = sin ( 2 * PI * freq * t )?

Dear Sir,

I am building a custom block.
How to know the time t, in seconds, of how long the flow graph has
started?

Says, I build a block of analog_sig_source_f.
Its work() function may involve a variable t (time) as below:

 for ( int i=0; i < noutput_items; i++ )  {
    out[i] = ampl * sin( 2 * PI * wave_freq * t )
 }

I know we there is a built-in Signal Source block, but I write this to
illustrate what I need to do.

Regards,
activecat

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs