mirror of
https://github.com/SFML/SFML.git
synced 2024-11-29 14:51:06 +08:00
Fix Opus audio sample rate to 48kHz
This commit is contained in:
parent
aaae80e7f4
commit
4008cbfe6a
@ -119,9 +119,12 @@ bool SoundFileReaderOpus::open(InputStream& stream, Info& info)
|
|||||||
// Retrieve the music attributes
|
// Retrieve the music attributes
|
||||||
const OpusHead* opusHead = op_head(m_opus, -1);
|
const OpusHead* opusHead = op_head(m_opus, -1);
|
||||||
info.channelCount = opusHead->channel_count;
|
info.channelCount = opusHead->channel_count;
|
||||||
info.sampleRate = opusHead->input_sample_rate;
|
|
||||||
info.sampleCount = static_cast<std::size_t>(op_pcm_total(m_opus, -1) * opusHead->channel_count);
|
info.sampleCount = static_cast<std::size_t>(op_pcm_total(m_opus, -1) * opusHead->channel_count);
|
||||||
|
|
||||||
|
// All Opus audio is encoded at 48kHz
|
||||||
|
// https://opus-codec.org/docs/opusfile_api-0.5/structOpusHead.html#a73b80a913eca33d829f1667caee80d9e
|
||||||
|
info.sampleRate = 48000;
|
||||||
|
|
||||||
// We must keep the channel count for the seek function
|
// We must keep the channel count for the seek function
|
||||||
m_channelCount = info.channelCount;
|
m_channelCount = info.channelCount;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user