AudioSequenceFactory: fix mono streamed tracks not playing (#7291)

In WriteMonoSingleSeq, layerPlaceholderOff was recorded before WriteNoshort,
causing a stray 0x00 byte to be emitted into the mono channel script. The
0x00 decoded as a delay of 0 ticks, which deferred the subsequent ldlayer
byte by one tick and left channel->instrument unset when the layer first
processed its note, producing no sound.

Move layerPlaceholderOff to after WriteNoshort so the placeholder writes
the correct address, matching WriteStereoSingleSeq.

Fixes #7264
This commit is contained in:
David Racine
2026-10-03 09:50:08 -04:00
committed by GitHub
parent 69a7cdb179
commit e07916487d
@@ -201,8 +201,8 @@ static void WriteMonoSingleSeq(Ship::BinaryWriter* writer, uint16_t delay, uint8
writer->Seek(channelStart, Ship::SeekOffsetType::Start);
// Channel header
layerPlaceholderOff = static_cast<uint16_t>(writer->GetBaseAddress());
WriteNoshort(writer);
layerPlaceholderOff = static_cast<uint16_t>(writer->GetBaseAddress());
WriteLdlayer(writer, 0, 0);
WritePan(writer, 64);
WriteVolCHeader(writer, 127); // Max volume