Sound_Z - widberg/fmtk GitHub Wiki

Chum World SOUND
ImZouna Sound_Z

bitfield SoundFlags {
    /// The sound is not playing when this is 1
    PAUSED : 1;
    /// dwFlags, DSBPLAY_LOOPING is passed to IDirectSoundBuffer8::Play if 1
    LOOPING : 1;
    /// Mono when 0, Stereo when 1
    /// Calls IDirectSoundBuffer8::SetPan when updating the sound if this is 0
    STEREO : 1;
    padding : 13;
};

struct Sound_Z_LinkHeader : ResourceObject_Z {
    u32 sample_rate;
    u32 sound_data_size;
    SoundFlags flags;
    std::assert(flags.PAUSED == 1, "flags.PAUSED != 1");
};

struct Sound_Z : Sound_Z_LinkHeader {
    /// Raw signed 16-bit PCM, little-endian audio data
    u8 data[sound_data_size];
};
SoundZAlt

struct Sound_Z_Header : ResourceObject_Z {
    std::uint32_t sampleRate;
// The following fields only exist if sample rate > 0
// Should always exist in latest version
    std::uint32_t dataSize;
        // Size of the data
    std::uint16_t soundFlags;
// older versions have 2 extra bytes for aligment
    std::uint16_t zero;
};
struct Sound_Z {
    std::uint8_t data[__header.dataSize];
        // Raw signed 16-bit PCM, little-endian, 1 channel audio data
};
⚠️ **GitHub.com Fallback** ⚠️