32template <
size_t transfer_size>
80 wavheader_.
ByteRate = CalcByteRate();
85 wavheader_.
FileSize = CalcFileSize();
106 case 32: transfer_buff[wptr_ +
i] =
f2s32(
in[
i]);
break;
113 = cfg_.
bitspersample == 16 ? kTransferSamps * 2 : kTransferSamps;
148 wavheader_.
FileSize = CalcFileSize();
150 f_write(&fp_, &wavheader_,
sizeof(wavheader_), &
bw);
190 inline uint32_t CalcByteRate()
195 static constexpr int kTransferSamps = transfer_size /
sizeof(int32_t);
197 WAV_FormatTypeDef wavheader_;
198 uint32_t num_samps_, wptr_;
200 int32_t transfer_buff[kTransferSamps * 2];
Definition leddriver.h:33
Definition WavWriter.h:34
void Sample(const float *in)
Definition WavWriter.h:93
BufferState
Definition WavWriter.h:60
uint32_t GetLengthSamps()
Definition WavWriter.h:172
bool IsRecording() const
Definition WavWriter.h:169
WavWriter()
Definition WavWriter.h:36
void SaveFile()
Definition WavWriter.h:142
void OpenFile(const char *name)
Definition WavWriter.h:155
~WavWriter()
Definition WavWriter.h:37
Result
Definition WavWriter.h:41
float GetLengthSeconds()
Definition WavWriter.h:175
void Write()
Definition WavWriter.h:126
void Init(const Config &cfg)
Definition WavWriter.h:67
FORCE_INLINE int16_t f2s16(float x)
Definition daisy_core.h:128
FORCE_INLINE int32_t f2s32(float x)
Definition daisy_core.h:163
Hardware defines and helpers for daisy field platform.
Definition index.h:2
const uint32_t kWavFileChunkId
Definition wav_format.h:15
const uint32_t kWavFileSubChunk2Id
Definition wav_format.h:18
const uint32_t kWavFileWaveId
Definition wav_format.h:16
@ WAVE_FORMAT_PCM
Definition wav_format.h:30
const uint32_t kWavFileSubChunk1Id
Definition wav_format.h:17
Definition WavWriter.h:49
int32_t bitspersample
Definition WavWriter.h:52
float samplerate
Definition WavWriter.h:50
int32_t channels
Definition WavWriter.h:51