MCPcopy Create free account
hub / github.com/LMMS/lmms / flacStreamDecoderWriteCallback

Function flacStreamDecoderWriteCallback

src/core/SampleBuffer.cpp:1277–1311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1275
1276
1277FLAC__StreamDecoderWriteStatus flacStreamDecoderWriteCallback(
1278 const FLAC__StreamDecoder *
1279 /*_decoder*/,
1280 const FLAC__Frame * _frame,
1281 const FLAC__int32 * const _buffer[],
1282 void * _client_data )
1283{
1284 if( _frame->header.channels != 2 )
1285 {
1286 printf( "channels != 2 in "
1287 "flacStreamDecoderWriteCallback()\n" );
1288 return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
1289 }
1290
1291 if( _frame->header.bits_per_sample != 16 )
1292 {
1293 printf( "bits_per_sample != 16 in "
1294 "flacStreamDecoderWriteCallback()\n" );
1295 return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
1296 }
1297
1298 const f_cnt_t frames = _frame->header.blocksize;
1299 for( f_cnt_t frame = 0; frame < frames; ++frame )
1300 {
1301 sampleFrame sframe = { _buffer[0][frame] /
1302 OUTPUT_SAMPLE_MULTIPLIER,
1303 _buffer[1][frame] /
1304 OUTPUT_SAMPLE_MULTIPLIER
1305 } ;
1306 static_cast<flacStreamDecoderClientData *>(
1307 _client_data )->write_buffer->write(
1308 (const char *) sframe, sizeof( sframe ) );
1309 }
1310 return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
1311}
1312
1313
1314void flacStreamDecoderMetadataCallback( const FLAC__StreamDecoder *,

Callers

nothing calls this directly

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected