Minor fixes

This commit is contained in:
Jérôme Leclercq 2021-05-29 21:59:51 +02:00
parent 7ced0e5f08
commit 2cd09833a4
3 changed files with 10 additions and 9 deletions

View File

@ -38,13 +38,13 @@ namespace Nz
case 4: case 4:
return AudioFormat::U16_Quad; return AudioFormat::U16_Quad;
case 5: case 6:
return AudioFormat::U16_5_1; return AudioFormat::U16_5_1;
case 6: case 7:
return AudioFormat::U16_6_1; return AudioFormat::U16_6_1;
case 7: case 8:
return AudioFormat::U16_7_1; return AudioFormat::U16_7_1;
default: default:
@ -137,7 +137,7 @@ namespace Nz
if (parameters.forceMono && format != AudioFormat::U16_Mono) if (parameters.forceMono && format != AudioFormat::U16_Mono)
{ {
UInt32 frameCount = UInt32(info.samples / info.channels); UInt64 frameCount = UInt64(info.samples / info.channels);
MixToMono(info.buffer, info.buffer, static_cast<UInt32>(info.channels), frameCount); MixToMono(info.buffer, info.buffer, static_cast<UInt32>(info.channels), frameCount);
format = AudioFormat::U16_Mono; format = AudioFormat::U16_Mono;
@ -283,6 +283,7 @@ namespace Nz
void Seek(UInt64 offset) override void Seek(UInt64 offset) override
{ {
mp3dec_ex_seek(&m_decoder, offset); mp3dec_ex_seek(&m_decoder, offset);
m_readSampleCount = offset;
} }
UInt64 Tell() override UInt64 Tell() override

View File

@ -40,13 +40,13 @@ namespace Nz
case 4: case 4:
return AudioFormat::U16_Quad; return AudioFormat::U16_Quad;
case 5: case 6:
return AudioFormat::U16_5_1; return AudioFormat::U16_5_1;
case 6: case 7:
return AudioFormat::U16_6_1; return AudioFormat::U16_6_1;
case 7: case 8:
return AudioFormat::U16_7_1; return AudioFormat::U16_7_1;
default: default:

View File

@ -382,8 +382,8 @@ namespace Nz
{ {
// If we don't have to read, we move forward // If we don't have to read, we move forward
UInt64 currentPos = m_impl->GetCursorPos(); UInt64 currentPos = m_impl->GetCursorPos();
if (!m_impl->SetCursorPos(CursorPosition::AtCurrent, size))
m_impl->SetCursorPos(CursorPosition::AtCurrent, size); return 0;
return static_cast<std::size_t>(m_impl->GetCursorPos() - currentPos); return static_cast<std::size_t>(m_impl->GetCursorPos() - currentPos);
} }