Support "type 2" HyperCard sound resources

This commit is contained in:
Iliyas Jorio 2021-03-02 08:23:56 +01:00
parent 5f088fab3c
commit 6f4a04975d

View File

@ -610,15 +610,29 @@ OSErr GetSoundHeaderOffset(SndListHandle sndHandle, long* offset)
memstream sndStream((Ptr) *sndHandle, GetHandleSize((Handle) sndHandle)); memstream sndStream((Ptr) *sndHandle, GetHandleSize((Handle) sndHandle));
Pomme::BigEndianIStream f(sndStream); Pomme::BigEndianIStream f(sndStream);
// Skip everything before sound commands // Read header
Expect<SInt16>(1, f.Read<SInt16>(), "'snd ' format"); SInt16 format = f.Read<SInt16>();
Expect<SInt16>(1, f.Read<SInt16>(), "'snd ' modifier count"); switch (format)
Expect<SInt16>(5, f.Read<SInt16>(), "'snd ' sampledSynth"); {
UInt32 initBits = f.Read<UInt32>(); case 1: // Standard 'snd ' resource
{
Expect<SInt16>(1, f.Read<SInt16>(), "'snd ' modifier count");
Expect<SInt16>(5, f.Read<SInt16>(), "'snd ' sampledSynth");
UInt32 initBits = f.Read<UInt32>();
if (initBits & initMACE6)
TODOFATAL2("MACE-6 not supported yet");
break;
}
if (initBits & initMACE6) case 2: // HyperCard sampled-sound format
TODOFATAL2("MACE-6 not supported yet"); f.Skip(2); // Skip reference count (for application use)
break;
default:
return badFormat;
}
// Now read sound commands
SInt16 nCmds = f.Read<SInt16>(); SInt16 nCmds = f.Read<SInt16>();
//LOG << nCmds << " commands\n"; //LOG << nCmds << " commands\n";
for (; nCmds >= 1; nCmds--) for (; nCmds >= 1; nCmds--)