MCPcopy Create free account
hub / github.com/axmolengine/axmol / read

Method read

core/audio/AudioDecoderMp3.cpp:270–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270uint32_t AudioDecoderMp3::read(uint32_t framesToRead, char* pcmBuf)
271{
272#if !AX_USE_MPG123
273 auto sampelsToRead = framesToRead * _channelCount;
274 auto samplesRead = mp3dec_ex_read(&_handle->_dec, (mp3d_sample_t*)pcmBuf, sampelsToRead);
275 return static_cast<uint32_t>(samplesRead / _channelCount);
276#else
277 int bytesToRead = framesToBytes(framesToRead);
278 size_t bytesRead = 0;
279 int err = mpg123_read(_handle, (unsigned char*)pcmBuf, bytesToRead, &bytesRead);
280 if (err == MPG123_ERR)
281 {
282 AXLOGE("Trouble with mpg123: {}\n", mpg123_strerror(_handle));
283 return 0;
284 }
285
286 return bytesToFrames(bytesRead);
287#endif
288}
289
290bool AudioDecoderMp3::seek(uint32_t frameOffset)
291{

Callers 4

minimp3_read_rFunction · 0.45
mpg123_read_rFunction · 0.45
createDecoderMethod · 0.45
readDataTaskMethod · 0.45

Calls 1

mp3dec_ex_readFunction · 0.85

Tested by

no test coverage detected