Changeset 5186:9667c5a66a36 in roaraudio
- Timestamp:
- 10/22/11 20:06:20 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarsin.c
r4885 r5186 80 80 float freq = 523.2; /* middle C */ 81 81 float t = 0; /* current time */ 82 float tcalc = 0; /* current time for calculation */ 82 83 float length = 5; /* 5 sec */ 83 84 float step; /* how much time per sample we have to encode ... */ … … 117 118 while (t < 2*M_PI*freq*length) { 118 119 for (i = 0; i < 1024; i++) { 119 out[i] = 32767*func(t); 120 t += step; 120 out[i] = 32767*func(tcalc); 121 t += step; 122 tcalc += step; 121 123 } 122 124 roar_vs_write(vss, out, 2048, NULL); 125 126 // this code enables us to generate the same signal for a long periode of time 127 // without loosing accuracy of the float type. 128 while (tcalc > 2*M_PI) 129 tcalc -= 2*M_PI; 123 130 } 124 131
Note: See TracChangeset
for help on using the changeset viewer.