+ support reading .wav files that have extra data in the end of the 'fmt '

chunk. Added test case, which is a file, generated by the Euphoric emulator.

git-svn-id: trunk@47461 -
This commit is contained in:
nickysn 2020-11-19 23:05:25 +00:00
parent 28bdb364f0
commit 46b35256bd
7 changed files with 10 additions and 1 deletions

3
.gitattributes vendored
View File

@ -4344,6 +4344,9 @@ packages/fcl-sound/tests/data/wav/reader/valid/44k_stereo_32.wav.raw -text
packages/fcl-sound/tests/data/wav/reader/valid/44k_stereo_8.wav -text svneol=unset#audio/x-wav
packages/fcl-sound/tests/data/wav/reader/valid/44k_stereo_8.wav.info.txt svneol=native#text/plain
packages/fcl-sound/tests/data/wav/reader/valid/44k_stereo_8.wav.raw -text svneol=unset#application/octet-stream
packages/fcl-sound/tests/data/wav/reader/valid/euphoric_tape.wav -text svneol=unset#audio/x-wav
packages/fcl-sound/tests/data/wav/reader/valid/euphoric_tape.wav.info.txt svneol=native#text/plain
packages/fcl-sound/tests/data/wav/reader/valid/euphoric_tape.wav.raw -text svneol=unset#application/octet-stream
packages/fcl-sound/tests/tcwavreader.pas svneol=native#text/plain
packages/fcl-sound/tests/testfclsound.lpi svneol=native#text/plain
packages/fcl-sound/tests/testfclsound.lpr svneol=native#text/plain

View File

@ -94,7 +94,9 @@ begin
Result := Result and (riff.ChunkHeader.ID = AUDIO_CHUNK_ID_RIFF) and (riff.Format = AUDIO_CHUNK_ID_WAVE);
Result := Result and (fStream.Read(fmt, sizeof(fmt)) = sizeof(fmt));
LEtoN(fmt);
Result := Result and (fmt.ChunkHeader.ID = AUDIO_CHUNK_ID_fmt);
Result := Result and (fmt.ChunkHeader.ID = AUDIO_CHUNK_ID_fmt) and ((fmt.ChunkHeader.Size + 8) >= sizeof(fmt));
if Result and ((fmt.ChunkHeader.Size + 8) > sizeof(fmt)) then
fStream.Seek((fmt.ChunkHeader.Size + 8) - sizeof(fmt), soCurrent);
if Result and (fmt.Format <> 1) then
Exit(False);
end;

View File

@ -0,0 +1 @@
4800 1 8

File diff suppressed because one or more lines are too long

View File

@ -84,6 +84,7 @@ begin
TestValidFile('44k_stereo_24.wav');
TestValidFile('44k_stereo_32.wav');
TestValidFile('44k_mono_16_tag.wav');
TestValidFile('euphoric_tape.wav');
end;

View File

@ -49,6 +49,7 @@
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="../src"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>