MCPcopy Create free account
hub / github.com/SmingHub/Sming / writeSine

Function writeSine

samples/Basic_Audio/app/application.cpp:108–125  ·  view source on GitHub ↗

* Outputs a 172.266Hz sine wave (256 samples at 44100 samples/sec) */

Source from the content-addressed store, hash-verified

106 * Outputs a 172.266Hz sine wave (256 samples at 44100 samples/sec)
107 */
108void writeSine()
109{
110 unsigned frames_written = 0;
111 i2s_buffer_info_t info;
112 while(i2s_dma_write(&info, UINT_MAX)) {
113 unsigned frame_count = info.size / sizeof(i2s_sample_t);
114 for(unsigned i = 0; i < frame_count; ++i) {
115 uint32_t sample = sineWaveTable.read();
116#ifdef ENABLE_DELTA_SIGMA
117 static DeltaSigma mod;
118 sample = mod.update(sample);
119#endif
120 info.samples[i].u32 = sample;
121 }
122
123 frames_written += frame_count;
124 }
125}
126
127#endif // GENERATE_FIXED_VALUES
128

Callers 1

fillBuffersFunction · 0.85

Calls 3

i2s_dma_writeFunction · 0.50
readMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected