cwVectOps.h : All arguments to sine() and phasor() may now be of different types.

This commit is contained in:
kevin 2024-07-04 17:01:26 -04:00
parent a8210e40b8
commit 3616e82afa

View File

@ -456,8 +456,8 @@ namespace cw
template< typename T > template< typename T0, typename T1, typename T2 >
unsigned phasor( T* y, unsigned n, T srate, T hz, unsigned init_idx=0 ) unsigned phasor( T0* y, unsigned n, T1 srate, T2 hz, unsigned init_idx=0 )
{ {
for(unsigned i=init_idx; i<n; ++i) for(unsigned i=init_idx; i<n; ++i)
y[i] = (M_PI*2*hz*i) / srate; y[i] = (M_PI*2*hz*i) / srate;
@ -465,8 +465,8 @@ namespace cw
return init_idx + n; return init_idx + n;
} }
template< typename T > template< typename T0, typename T1, typename T2 >
unsigned sine( T* y, unsigned n, T srate, T hz, unsigned init_idx=0 ) unsigned sine( T0* y, unsigned n, T1 srate, T2 hz, unsigned init_idx=0 )
{ {
init_idx = phasor(y,n,srate,hz,init_idx); init_idx = phasor(y,n,srate,hz,init_idx);