From 0d6b3f0d7d96212e95566e30b3909ea48163a1dc Mon Sep 17 00:00:00 2001 From: attila Date: Wed, 28 Aug 2024 17:12:07 +0200 Subject: [PATCH] Formatting The documentation specifies that the "Duration" property is given in 100 nanosecond units, which is a good thing, otherwise the calculation wouldn't be correct. --- .../codecs/juce_WindowsMediaAudioFormat.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp index 301ce06c3b..543ad1a1ff 100644 --- a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp @@ -278,12 +278,12 @@ private: { if (auto wmHeaderInfo = wmSyncReader.getInterface()) { - QWORD lengthInNanoseconds = 0; - WORD lengthOfLength = sizeof (lengthInNanoseconds); + QWORD lengthInHundredNanoseconds = 0; + WORD lengthOfLength = sizeof (lengthInHundredNanoseconds); WORD streamNum = 0; WMT_ATTR_DATATYPE wmAttrDataType; wmHeaderInfo->GetAttributeByName (&streamNum, L"Duration", &wmAttrDataType, - (BYTE*) &lengthInNanoseconds, &lengthOfLength); + (BYTE*) &lengthInHundredNanoseconds, &lengthOfLength); if (auto wmProfile = wmSyncReader.getInterface()) { @@ -308,7 +308,7 @@ private: sampleRate = inputFormat->nSamplesPerSec; numChannels = inputFormat->nChannels; bitsPerSample = inputFormat->wBitsPerSample != 0 ? inputFormat->wBitsPerSample : 16; - lengthInSamples = (lengthInNanoseconds * (QWORD) sampleRate) / 10000000; + lengthInSamples = (lengthInHundredNanoseconds * (QWORD) sampleRate) / 10000000; } } }