221{
222
223 return GuardedCall< FLAC__StreamDecoderWriteStatus > ( [&] {
225
226 unsigned chn = 0;
228 {
229 if (frame->header.bits_per_sample <= 16) {
230 if (frame->header.bits_per_sample == 8) {
231 for (unsigned int s = 0; s < frame->header.blocksize; s++) {
232 tmp[s] = buffer[chn][s] << 8;
233 }
234 } else {
235 for (unsigned int s = 0; s < frame->header.blocksize; s++) {
236 tmp[s] = buffer[chn][s];
237 }
238 }
239
240 channel.AppendBuffer((samplePtr)tmp.get(),
241 int16Sample,
242 frame->header.blocksize, 1,
243 int16Sample);
244 }
245 else {
246 channel.AppendBuffer((samplePtr)buffer[chn],
247 int24Sample,
248 frame->header.blocksize, 1,
249 int24Sample);
250 }
251 ++chn;
252 });
253
255
259
261 {
262 return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
263 }
264
265 return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
267}
SimpleGuard< R > MakeSimpleGuard(R value) noexcept(noexcept(SimpleGuard< R >{ value }))
Convert a value to a handler function returning that value, suitable for GuardedCall<R>
This simplifies arrays of arrays, each array separately allocated with NEW[] But it might be better t...
FLAC__uint64 mSamplesDone
bool IsStopped() const noexcept
bool IsCancelled() const noexcept
virtual void OnImportProgress(double progress)=0
static void ForEachChannel(TrackList &trackList, const std::function< void(WaveChannel &)> &op)
Iterates over channels in each wave track from the list.
ImportProgressListener * mImportProgressListener