MCPcopy Create free account
hub / github.com/LabSound/LabSound / flushDebugBuffer

Method flushDebugBuffer

src/core/AudioContext.cpp:102–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 }
101
102 void flushDebugBuffer(char const* const wavFilePath)
103 {
104 if (!debugBufferIndex || !wavFilePath)
105 return;
106
107 nqr::AudioData fileData;
108 fileData.samples.resize(debugBufferIndex + 32);
109 fileData.channelCount = 1;
110 float* dst = fileData.samples.data();
111 memcpy(dst, debugBuffer.data(), sizeof(float) * debugBufferIndex);
112 fileData.sampleRate = static_cast<int>(44100);
113 fileData.sourceFormat = nqr::PCM_FLT;
114 nqr::EncoderParams params = { 1, nqr::PCM_FLT, nqr::DITHER_NONE };
115 int err = nqr::encode_wav_to_disk(params, &fileData, wavFilePath);
116 debugBufferIndex = 0;
117 }
118};
119
120void AudioContext::appendDebugBuffer(AudioBus* bus, int channel, int count)

Callers

nothing calls this directly

Calls 2

resizeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected