MiniDoom

src/i_sound.ml

Mixes Doom sound effects into platform PCM buffers and translates MUS music events to the active MIDI backend.

Package
(global)
Reachable
Yes

Imports

Declarations

_I_chActive

_I_chActive

Stores the i ch active collection used by the i sound subsystem.

View source

_I_chData

_I_chData

Stores the i ch data collection used by the i sound subsystem.

View source

_I_chFrac

_I_chFrac

Stores the i ch frac collection used by the i sound subsystem.

View source

_I_chHandle

_I_chHandle

Stores the i ch handle collection used by the i sound subsystem.

View source

_I_chId

_I_chId

Stores the i ch id collection used by the i sound subsystem.

View source

_I_chLeftVol

_I_chLeftVol

Stores the i ch left vol collection used by the i sound subsystem.

View source

_I_chLen

_I_chLen

Stores the i ch len collection used by the i sound subsystem.

View source

_I_chPos

_I_chPos

Stores the i ch pos collection used by the i sound subsystem.

View source

_I_chRightVol

_I_chRightVol

Stores the i ch right vol collection used by the i sound subsystem.

View source

_I_chStart

_I_chStart

Stores the i ch start collection used by the i sound subsystem.

View source

_I_chStep

_I_chStep

Stores the i ch step collection used by the i sound subsystem.

View source

_I_currentSongHandle

_I_currentSongHandle

Tracks the mutable i current song handle value used by the i sound subsystem.

View source

_I_midiDbgPrinted

_I_midiDbgPrinted

Tracks whether i midi dbg printed is active in the i sound subsystem.

View source

_I_midiHandle

_I_midiHandle

Tracks the mutable i midi handle value used by the i sound subsystem.

View source

_I_mixScaleTable

_I_mixScaleTable

Stores the i mix scale table collection used by the i sound subsystem.

View source

_I_mixScratch

_I_mixScratch

Tracks the mutable i mix scratch value used by the i sound subsystem.

View source

_I_musicChanMap

_I_musicChanMap

Stores the i music chan map collection used by the i sound subsystem.

View source

_I_musicChanVel

_I_musicChanVel

Stores the i music chan vel collection used by the i sound subsystem.

View source

_I_musicData

_I_musicData

Holds the optional i music data resource used by the i sound subsystem.

View source

_I_musicDelay

_I_musicDelay

Tracks the mutable i music delay value used by the i sound subsystem.

View source

_I_musicLastMs

_I_musicLastMs

Tracks the mutable i music last ms value used by the i sound subsystem.

View source

_I_musicLooping

_I_musicLooping

Tracks whether i music looping is active in the i sound subsystem.

View source

_I_musicMsFrac

_I_musicMsFrac

Tracks the mutable i music ms frac value used by the i sound subsystem.

View source

_I_musicPaused

_I_musicPaused

Tracks whether i music paused is active in the i sound subsystem.

View source

_I_musicPlaying

_I_musicPlaying

Tracks whether i music playing is active in the i sound subsystem.

View source

_I_musicPos

_I_musicPos

Tracks the mutable i music pos value used by the i sound subsystem.

View source

_I_musicScoreEnd

_I_musicScoreEnd

Tracks the mutable i music score end value used by the i sound subsystem.

View source

_I_musicScoreStart

_I_musicScoreStart

Tracks the mutable i music score start value used by the i sound subsystem.

View source

_I_musicUsedMidi

_I_musicUsedMidi

Stores the i music used midi collection used by the i sound subsystem.

View source

_I_musicVolume

_I_musicVolume

Tracks the mutable i music volume value used by the i sound subsystem.

View source

_I_nextHandle

_I_nextHandle

Tracks the mutable i next handle value used by the i sound subsystem.

View source

_I_nextSongHandle

_I_nextSongHandle

Tracks the mutable i next song handle value used by the i sound subsystem.

View source

_I_sfxRates

_I_sfxRates

Stores the i sfx rates collection used by the i sound subsystem.

View source

_I_sfxSamples

_I_sfxSamples

Stores the i sfx samples collection used by the i sound subsystem.

View source

_I_sfxVolume

_I_sfxVolume

Tracks the mutable i sfx volume value used by the i sound subsystem.

View source

_I_songData

_I_songData

Stores the i song data collection used by the i sound subsystem.

View source

_I_soundTimerEnabled

_I_soundTimerEnabled

Tracks whether i sound timer enabled is active in the i sound subsystem.

View source

_I_stepTable

_I_stepTable

Stores the i step table collection used by the i sound subsystem.

View source

_I_wavebuf_t struct

_I_waveBuffers

_I_waveBuffers

Stores the i wave buffers collection used by the i sound subsystem.

View source

_I_waveHandle

_I_waveHandle

Tracks the mutable i wave handle value used by the i sound subsystem.

View source

_I_waveReady

_I_waveReady

Tracks whether i wave ready is active in the i sound subsystem.

View source

_IS_CalcStereoVolumes

inline function _IS_CalcStereoVolumes(vol127, sep)

Applies Doom's quadratic separation curve and returns clamped left/right 0..127 channel gains.

ParameterTypeDefaultDescription
vol127dynamic—Vol127 value supplied to `_IS_CalcStereoVolumes`.
sepdynamic—Sep value supplied to `_IS_CalcStereoVolumes`.

View source

_IS_Clamp

inline function _IS_Clamp(v, lo, hi)

Converts and clamps a scalar to an inclusive mixer/MIDI range.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
lodynamic—Inclusive lower bound.
hidynamic—Inclusive upper bound.

View source

_IS_ClampS16

inline function _IS_ClampS16(v)

Saturates a mixed accumulator to the signed 16-bit PCM sample range.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_IS_EnsureSfxCacheSize

function _IS_EnsureSfxCacheSize()

Resizes per-SFX rate/sample/length caches to the metadata table while preserving existing entries.

View source

_IS_EnumIndex

inline function _IS_EnumIndex(v, fallback)

Converts enum-compatible integer values without accepting fractional numbers.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
fallbackdynamic—Value returned when the requested conversion or lookup is unavailable.

View source

_IS_FindChannelByHandle

inline function _IS_FindChannelByHandle(handle)

Resolves a public sound handle to its active software channel index, or minus one when stale.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `_IS_FindChannelByHandle`.

View source

_IS_FindChannelForNewSound

function _IS_FindChannelForNewSound(sid)

Reuses a free mixing channel, otherwise evicting the oldest after enforcing single-instance effects.

ParameterTypeDefaultDescription
siddynamic—Sid value supplied to `_IS_FindChannelForNewSound`.

View source

_IS_GMEM_FIXED

const _IS_GMEM_FIXED = 0

Defines is gmem fixed for the i sound subsystem.

View source

_IS_InitMixScaleTable

inline function _IS_InitMixScaleTable()

Precomputes exact 8-bit sample scaling so the mixer can avoid per-sample division.

View source

_IS_InitStepTable

inline function _IS_InitStepTable()

Precomputes 16.16 pitch steps for every signed Doom pitch offset.

View source

_IS_IsSeq

inline function _IS_IsSeq(v)

Accepts either array or list storage used by translated audio tables.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_IS_LoadSfxData

function _IS_LoadSfxData(sid)

Decodes and caches a DMX sound lump's sample rate and unsigned 8-bit PCM payload by SFX id.

ParameterTypeDefaultDescription
siddynamic—Sid value supplied to `_IS_LoadSfxData`.

View source

_IS_MapMusChannel

function _IS_MapMusChannel(mchan)

Assigns a stable non-percussion MIDI channel to a MUS channel, with MUS channel 15 mapped to percussion.

ParameterTypeDefaultDescription
mchandynamic—Mchan value supplied to `_IS_MapMusChannel`.

View source

_IS_MIDI_MAPPER

const _IS_MIDI_MAPPER = 4294967295

Defines is midi mapper for the i sound subsystem.

View source

_IS_MidiAllNotesOff

inline function _IS_MidiAllNotesOff()

Sends both all-notes-off and all-sound-off controllers on every MIDI channel.

View source

_IS_MidiInit

inline function _IS_MidiInit()

Opens the platform MIDI backend once and stores its pointer-sized output handle.

View source

_IS_MidiMsg2

inline function _IS_MidiMsg2(status, data1)

Packs and sends a two-byte MIDI message, reporting only the first failure in developer mode.

ParameterTypeDefaultDescription
statusdynamic—Status value supplied to `_IS_MidiMsg2`.
data1dynamic—Data1 value supplied to `_IS_MidiMsg2`.

View source

_IS_MidiMsg3

inline function _IS_MidiMsg3(status, data1, data2)

Packs and sends a three-byte MIDI message, reporting only the first failure in developer mode.

ParameterTypeDefaultDescription
statusdynamic—Status value supplied to `_IS_MidiMsg3`.
data1dynamic—Data1 value supplied to `_IS_MidiMsg3`.
data2dynamic—Data2 value supplied to `_IS_MidiMsg3`.

View source

_IS_MidiShutdown

inline function _IS_MidiShutdown()

Resets all MIDI voices, closes the mapper handle, and clears local ownership.

View source

_IS_MIX_BUF_BYTES

const _IS_MIX_BUF_BYTES = _IS_MIX_SAMPLES * 4

Defines is mix buf bytes for the i sound subsystem.

View source

_IS_MIX_RATE

const _IS_MIX_RATE = 11025

Defines is mix rate for the i sound subsystem.

View source

_IS_MIX_SAMPLES

const _IS_MIX_SAMPLES = 512

Defines is mix samples for the i sound subsystem.

View source

_IS_MixToBytes

function _IS_MixToBytes(outb)

Mixes active unsigned 8-bit SFX channels into an interleaved signed 16-bit stereo PCM block.

ParameterTypeDefaultDescription
outbdynamic—Outb value supplied to `_IS_MixToBytes`.

View source

_IS_MusCtrlToMidi

inline function _IS_MusCtrlToMidi(ctrl)

Maps Doom MUS controller numbers to their General MIDI controller equivalents.

ParameterTypeDefaultDescription
ctrldynamic—Ctrl value supplied to `_IS_MusCtrlToMidi`.

View source

_IS_MusicFindSlotIndex

inline function _IS_MusicFindSlotIndex(handle)

Resolves a registered song handle to its metadata slot, or minus one when unregistered.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `_IS_MusicFindSlotIndex`.

View source

_IS_MusicProcessSlice

function _IS_MusicProcessSlice()

Translates MUS events into MIDI messages until a timed slice boundary or score end is reached.

View source

_IS_MusicResetRuntime

function _IS_MusicResetRuntime()

Resets MUS channel velocities/mappings, reserves MIDI percussion channel 10, and clears timing fractions.

View source

_IS_MusicRestart

inline function _IS_MusicRestart()

Silences current notes and rewinds a looping MUS score to its first event with fresh channel mappings.

View source

_IS_MusicRunTicks

function _IS_MusicRunTicks(ticks)

Consumes a bounded number of 140-Hz MUS ticks, honoring delays, looping, pause, and malformed-score guards.

ParameterTypeDefaultDescription
ticksdynamic—Ticks value supplied to `_IS_MusicRunTicks`.

View source

_IS_MusicScale7

inline function _IS_MusicScale7(v)

Applies sequencer-side master gain on Windows MIDI devices that may ignore midiOutSetVolume; Linux delegates gain to FluidSynth.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_IS_MusicSetSlotPlaying

inline function _IS_MusicSetSlotPlaying(handle, playing, looping)

Updates the looping and playing flags stored with a registered song handle.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `_IS_MusicSetSlotPlaying`.
playingdynamic—Playing value supplied to `_IS_MusicSetSlotPlaying`.
loopingdynamic—Looping value supplied to `_IS_MusicSetSlotPlaying`.

View source

_IS_MusicStartInternal

function _IS_MusicStartInternal(handle, data, looping)

Validates a MUS score header/range and initializes decoder, timing, loop, and registration state for playback.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `_IS_MusicStartInternal`.
datadynamic—Binary or structured data to process.
loopingdynamic—Looping value supplied to `_IS_MusicStartInternal`.

View source

_IS_MusicStopInternal

function _IS_MusicStopInternal(updateSlot)

Silences MIDI, clears the active MUS decoder/timing state, and optionally marks its song slot stopped.

ParameterTypeDefaultDescription
updateSlotdynamic—Update slot value supplied to `_IS_MusicStopInternal`.

View source

_IS_MusicTicker

function _IS_MusicTicker()

Converts elapsed milliseconds to fractional 140-Hz MUS ticks and advances active playback with stall clamping.

View source

_IS_NormalizeVolume127

inline function _IS_NormalizeVolume127(v)

Converts legacy 0..15 Doom volume values to 0..127 while accepting already normalized MIDI-scale values.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_IS_NUM_MIX_CHANNELS

const _IS_NUM_MIX_CHANNELS = 8

Defines the is num mix channels count used by the i sound subsystem.

View source

_IS_NUM_WAVE_BUFS

const _IS_NUM_WAVE_BUFS = 4

Defines the is num wave bufs count used by the i sound subsystem.

View source

_IS_PitchToStep

inline function _IS_PitchToStep(pitch, rate)

Combines Doom pitch and source sample rate into a positive 16.16 mixer cursor step.

ParameterTypeDefaultDescription
pitchdynamic—Pitch value supplied to `_IS_PitchToStep`.
ratedynamic—Rate value supplied to `_IS_PitchToStep`.

View source

_IS_ReadMusVarLen

inline function _IS_ReadMusVarLen(data, posref)

Decodes a bounded MUS base-128 variable-length delay and advances the caller's byte cursor.

ParameterTypeDefaultDescription
datadynamic—Binary or structured data to process.
posrefdynamic—Posref value supplied to `_IS_ReadMusVarLen`.

View source

_IS_ReadU16

inline function _IS_ReadU16(buf, off)

Reads a checked unsigned little-endian 16-bit field, returning zero outside the buffer.

ParameterTypeDefaultDescription
bufdynamic—Buf value supplied to `_IS_ReadU16`.
offdynamic—Zero-based byte or element offset.

View source

_IS_ReadU32

inline function _IS_ReadU32(buf, off)

Reads a checked unsigned little-endian 32-bit field, returning zero outside the buffer.

ParameterTypeDefaultDescription
bufdynamic—Buf value supplied to `_IS_ReadU32`.
offdynamic—Zero-based byte or element offset.

View source

_IS_ReadU64

inline function _IS_ReadU64(buf, off)

Reconstructs a pointer-sized little-endian value from two checked 32-bit words.

ParameterTypeDefaultDescription
bufdynamic—Buf value supplied to `_IS_ReadU64`.
offdynamic—Zero-based byte or element offset.

View source

_IS_ResetChannels

function _IS_ResetChannels()

Reinitializes every software mixing channel to an inactive, centered, empty state.

View source

_IS_SetChannelVolumes

inline function _IS_SetChannelVolumes(slot, vol, sep)

Stores Doom's separation-adjusted left/right gains for one checked software mixing channel.

ParameterTypeDefaultDescription
slotdynamic—Slot value supplied to `_IS_SetChannelVolumes`.
voldynamic—Vol value supplied to `_IS_SetChannelVolumes`.
sepdynamic—Sep value supplied to `_IS_SetChannelVolumes`.

View source

_IS_ShouldSingleInstance

inline function _IS_ShouldSingleInstance(sid)

Identifies chainsaw, platform-move, and pistol effects that replace an existing identical channel.

ParameterTypeDefaultDescription
siddynamic—Sid value supplied to `_IS_ShouldSingleInstance`.

View source

_IS_StopAllSfx

inline function _IS_StopAllSfx()

Marks every software SFX channel inactive without disturbing music playback.

View source

_IS_TickMs

inline function _IS_TickMs()

Returns the platform millisecond clock used to schedule MUS playback.

View source

_IS_ToInt

inline function _IS_ToInt(v, fallback)

Converts numeric or numeric-string values by truncating toward zero, otherwise returning the supplied fallback.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
fallbackdynamic—Value returned when the requested conversion or lookup is unavailable.

View source

_IS_WAVE_MAPPER

const _IS_WAVE_MAPPER = 4294967295

Defines is wave mapper for the i sound subsystem.

View source

_IS_WaveFindFreeBuffer

inline function _IS_WaveFindFreeBuffer()

Returns the first waveform ring slot not currently owned by WinMM, or minus one when saturated.

View source

_IS_WaveFormat

inline function _IS_WaveFormat()

Builds the PCM WAVEFORMATEX for 11,025-Hz stereo signed 16-bit mixer output.

View source

_IS_WAVEHDR_SIZE

const _IS_WAVEHDR_SIZE = 48

Defines is wavehdr size for the i sound subsystem.

View source

_IS_WaveInit

function _IS_WaveInit()

Opens WinMM waveform output and allocates/prepares the fixed ring of unmanaged PCM buffers.

View source

_IS_WaveIsDone

inline function _IS_WaveIsDone(wb)

Reads a submitted WAVEHDR's WHDR_DONE flag, treating never-submitted buffers as immediately reusable.

ParameterTypeDefaultDescription
wbdynamic—Wb value supplied to `_IS_WaveIsDone`.

View source

_IS_WaveRefresh

inline function _IS_WaveRefresh()

Marks submitted ring buffers reusable after WinMM reports their headers complete.

View source

_IS_WaveShutdown

function _IS_WaveShutdown()

Resets waveform output, unprepares every header, frees unmanaged buffers, and closes the device.

View source

_IS_WaveSubmitMixedBuffer

function _IS_WaveSubmitMixedBuffer()

Fills one free unmanaged waveform buffer with a mixed block and queues its prepared header to WinMM.

View source

_IS_WHDR_DONE

const _IS_WHDR_DONE = 1

Defines is whdr done for the i sound subsystem.

View source

_IS_WriteU16

inline function _IS_WriteU16(buf, off, value)

Writes one non-negative unsigned 16-bit value in little-endian order to a WinMM structure buffer.

ParameterTypeDefaultDescription
bufdynamic—Buf value supplied to `_IS_WriteU16`.
offdynamic—Zero-based byte or element offset.
valuedynamic—Value consumed by the operation.

View source

_IS_WriteU32

inline function _IS_WriteU32(buf, off, value)

Writes one non-negative unsigned 32-bit value in little-endian order to a WinMM structure buffer.

ParameterTypeDefaultDescription
bufdynamic—Buf value supplied to `_IS_WriteU32`.
offdynamic—Zero-based byte or element offset.
valuedynamic—Value consumed by the operation.

View source

_IS_WriteU64

inline function _IS_WriteU64(buf, off, value)

Writes a pointer-sized 64-bit value as two little-endian words in a WinMM structure buffer.

ParameterTypeDefaultDescription
bufdynamic—Buf value supplied to `_IS_WriteU64`.
offdynamic—Zero-based byte or element offset.
valuedynamic—Value consumed by the operation.

View source

_ISnd_IDiv

inline function _ISnd_IDiv(a, b)

Divides mixer integers with truncation toward zero and returns zero for a zero divisor.

ParameterTypeDefaultDescription
adynamic—First input operand.
bdynamic—Second input operand.

View source

addsfx

function addsfx(sfxid, volume, step, seperation)

Assigns cached PCM to a mixing channel, initializes cursor/gains, and returns a unique playback handle.

ParameterTypeDefaultDescription
sfxiddynamic—Sfxid value supplied to `addsfx`.
volumedynamic—Volume value supplied to `addsfx`.
stepdynamic—Step value supplied to `addsfx`.
seperationdynamic—Seperation value supplied to `addsfx`.

View source

getsfx

function getsfx(name, lenOut)

Loads a named `DS*` sound lump and writes its byte length through the legacy output reference.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.
lenOutdynamic—Len out value supplied to `getsfx`.

View source

GlobalAlloc

extern function GlobalAlloc(flags as u32, size as u32) from "kernel32.dll" symbol "GlobalAlloc" returns ptr

Allocates fixed-address unmanaged storage for WinMM sample buffers and WAVEHDR records.

ParameterTypeDefaultDescription
flagsu32—Bit flags that control the operation.
sizeu32—Requested size in bytes or elements.

Returns: The resulting fixed-address unmanaged storage for WinMM sample buffers and WAVEHDR records.

View source

GlobalFree

extern function GlobalFree(mem as ptr) from "kernel32.dll" symbol "GlobalFree" returns ptr

Releases unmanaged WinMM buffer/header storage and returns null on success.

ParameterTypeDefaultDescription
memptr—`ptr` value supplied as mem to `GlobalFree`.

Returns: Result returned by the native `GlobalFree` binding as `ptr`.

View source

I_GetSfxLumpNum

function I_GetSfxLumpNum(sfxinfo)

Resolves an SFX metadata name to its `DS*` lump, falling back to the pistol sound when absent.

ParameterTypeDefaultDescription
sfxinfodynamic—Sfxinfo value supplied to `I_GetSfxLumpNum`.

View source

I_HandleSoundTimer

function I_HandleSoundTimer()

Preserves the legacy timer callback hook; WinMM/MUS advancement is driven by the main update loop.

View source

I_InitMusic

function I_InitMusic()

Clears song registration/playback state, opens MIDI output, and applies the default master volume.

View source

I_InitSound

function I_InitSound()

Initializes SFX caches/tables/channels, opens waveform output, and starts the MIDI music backend.

View source

I_PauseSong

function I_PauseSong(handle)

Pauses the active registered song, resets sounding MIDI notes, and updates its slot flags.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_PauseSong`.

View source

I_PlaySong

function I_PlaySong(handle, looping)

Resolves a registered song, validates/starts its MUS stream, and records requested looping state.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_PlaySong`.
loopingdynamic—Looping value supplied to `I_PlaySong`.

View source

I_PrecacheSfx

function I_PrecacheSfx(id)

Decodes one SFX id into the rate/sample cache before first playback.

ParameterTypeDefaultDescription
iddynamic—Id value supplied to `I_PrecacheSfx`.

View source

I_QrySongPlaying

function I_QrySongPlaying(handle)

Reports whether the requested handle is the active, unpaused MUS song.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_QrySongPlaying`.

View source

I_RegisterSong

function I_RegisterSong(data)

Stores immutable MUS bytes under a new handle with initial stopped/non-looping metadata.

ParameterTypeDefaultDescription
datadynamic—Binary or structured data to process.

View source

I_ResumeSong

function I_ResumeSong(handle)

Resumes the active paused song from its MUS cursor with a rebased wall-clock timestamp.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_ResumeSong`.

View source

I_SetChannels

function I_SetChannels()

Rebuilds the pitch table if needed and resets all software mixing channels.

View source

I_SetMusicVolume

function I_SetMusicVolume(volume)

Normalizes Doom music volume and applies it to both WinMM MIDI output channels.

ParameterTypeDefaultDescription
volumedynamic—Volume value supplied to `I_SetMusicVolume`.

View source

I_SetSfxVolume

function I_SetSfxVolume(volume)

Normalizes and stores the master SFX gain used when starting/mixing effects.

ParameterTypeDefaultDescription
volumedynamic—Volume value supplied to `I_SetSfxVolume`.

View source

I_ShutdownMusic

function I_ShutdownMusic()

Stops the active MUS score and resets/closes the platform MIDI backend.

View source

I_ShutdownSound

function I_ShutdownSound()

Stops SFX, releases waveform buffers/device state, and shuts down registered MIDI music.

View source

I_SoundDelTimer

function I_SoundDelTimer()

Clears the legacy sound-timer enabled flag during backend teardown.

View source

I_SoundIsPlaying

function I_SoundIsPlaying(handle)

Reports whether a sound handle still owns an active channel with unread PCM samples.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_SoundIsPlaying`.

View source

I_SoundSetTimer

function I_SoundSetTimer(ticks)

Marks the legacy sound timer enabled while ignoring its obsolete tick-period argument.

ParameterTypeDefaultDescription
ticksdynamic—Ticks value supplied to `I_SoundSetTimer`.

View source

I_StartSound

function I_StartSound(id, vol, sep, pitch, priority)

Loads an SFX, derives its pitch step, assigns a mixing channel, and returns a public playback handle.

ParameterTypeDefaultDescription
iddynamic—Id value supplied to `I_StartSound`.
voldynamic—Vol value supplied to `I_StartSound`.
sepdynamic—Sep value supplied to `I_StartSound`.
pitchdynamic—Pitch value supplied to `I_StartSound`.
prioritydynamic—Playback or task priority used by the operation.

View source

I_StopSong

function I_StopSong(handle)

Stops the active song decoder or clears only the metadata flags of a different registered handle.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_StopSong`.

View source

I_StopSound

function I_StopSound(handle)

Deactivates the software mixing channel associated with a public sound handle.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_StopSound`.

View source

I_SubmitSound

function I_SubmitSound()

Fills every currently free WinMM ring slot with a freshly mixed PCM block.

View source

I_UnRegisterSong

function I_UnRegisterSong(handle)

Stops a matching active song and removes its handle/data record from the registration table.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_UnRegisterSong`.

View source

I_UpdateSound

function I_UpdateSound()

Advances wall-clock-driven MUS/MIDI playback during the engine sound update.

View source

I_UpdateSoundParams

function I_UpdateSoundParams(handle, vol, sep, pitch)

Recomputes pitch step and stereo gains for an active sound handle.

ParameterTypeDefaultDescription
handledynamic—Handle value supplied to `I_UpdateSoundParams`.
voldynamic—Vol value supplied to `I_UpdateSoundParams`.
sepdynamic—Sep value supplied to `I_UpdateSoundParams`.
pitchdynamic—Pitch value supplied to `I_UpdateSoundParams`.

View source

lengths

lengths

Stores the lengths collection used by the i sound subsystem.

View source

midiOutClose

extern function midiOutClose(hmo as ptr) from "winmm.dll" symbol "midiOutClose" returns u32

Closes the Windows MIDI output handle after playback has stopped.

ParameterTypeDefaultDescription
hmoptr—`ptr` value supplied as hmo to `midiOutClose`.

Returns: Result returned by the native `midiOutClose` binding as `u32`.

View source

midiOutOpen

extern function midiOutOpen(phmo as bytes, dev as u32, cb as ptr, inst as ptr, flags as u32) from "winmm.dll" symbol "midiOutOpen" returns u32

Opens the Windows MIDI mapper and writes its output handle to caller-owned storage.

ParameterTypeDefaultDescription
phmobytes—`bytes` value supplied as phmo to `midiOutOpen`.
devu32—`u32` value supplied as dev to `midiOutOpen`.
cbptr—`ptr` value supplied as cb to `midiOutOpen`.
instptr—`ptr` value supplied as inst to `midiOutOpen`.
flagsu32—Bit flags that control the operation.

Returns: Result returned by the native `midiOutOpen` binding as `u32`.

View source

midiOutReset

extern function midiOutReset(hmo as ptr) from "winmm.dll" symbol "midiOutReset" returns u32

Silences and resets every channel on the active Windows MIDI output device.

ParameterTypeDefaultDescription
hmoptr—`ptr` value supplied as hmo to `midiOutReset`.

Returns: Result returned by the native `midiOutReset` binding as `u32`.

View source

midiOutSetVolume

extern function midiOutSetVolume(hmo as ptr, vol as u32) from "winmm.dll" symbol "midiOutSetVolume" returns u32

Applies a packed left/right 16-bit master volume to the MIDI output device.

ParameterTypeDefaultDescription
hmoptr—`ptr` value supplied as hmo to `midiOutSetVolume`.
volu32—`u32` value supplied as vol to `midiOutSetVolume`.

Returns: Result returned by the native `midiOutSetVolume` binding as `u32`.

View source

midiOutShortMsg

extern function midiOutShortMsg(hmo as ptr, msg as u32) from "winmm.dll" symbol "midiOutShortMsg" returns u32

Sends one packed channel/system MIDI message to the active output device.

ParameterTypeDefaultDescription
hmoptr—`ptr` value supplied as hmo to `midiOutShortMsg`.
msgu32—`u32` value supplied as msg to `midiOutShortMsg`.

Returns: Result returned by the native `midiOutShortMsg` binding as `u32`.

View source

myioctl

function myioctl(fd, req, arg)

Retains the legacy Unix audio-control entry point as a deterministic no-op on WinMM.

ParameterTypeDefaultDescription
fddynamic—Fd value supplied to `myioctl`.
reqdynamic—Req value supplied to `myioctl`.
argdynamic—Arg value supplied to `myioctl`.

View source

RtlMoveMemoryFromPtr

extern function RtlMoveMemoryFromPtr(dst as bytes, src as ptr, len as u32) from "kernel32.dll" symbol "RtlMoveMemory" returns void

Copies an unmanaged WAVEHDR record into managed bytes for flag inspection.

ParameterTypeDefaultDescription
dstbytes—`bytes` value supplied as dst to `RtlMoveMemoryFromPtr`.
srcptr—`ptr` value supplied as src to `RtlMoveMemoryFromPtr`.
lenu32—`u32` value supplied as len to `RtlMoveMemoryFromPtr`.

View source

RtlMoveMemoryToPtr

extern function RtlMoveMemoryToPtr(dst as ptr, src as bytes, len as u32) from "kernel32.dll" symbol "RtlMoveMemory" returns void

Copies a managed byte buffer into fixed unmanaged WinMM storage.

ParameterTypeDefaultDescription
dstptr—`ptr` value supplied as dst to `RtlMoveMemoryToPtr`.
srcbytes—`bytes` value supplied as src to `RtlMoveMemoryToPtr`.
lenu32—`u32` value supplied as len to `RtlMoveMemoryToPtr`.

View source

waveOutClose

extern function waveOutClose(hwo as ptr) from "winmm.dll" symbol "waveOutClose" returns u32

Closes a reset waveform output handle after all headers have been unprepared.

ParameterTypeDefaultDescription
hwoptr—`ptr` value supplied as hwo to `waveOutClose`.

Returns: Result returned by the native `waveOutClose` binding as `u32`.

View source

waveOutOpen

extern function waveOutOpen(phwo as bytes, dev as u32, pwfx as bytes, cb as ptr, inst as ptr, flags as u32) from "winmm.dll" symbol "waveOutOpen" returns u32

Opens the WinMM waveform mapper with the supplied PCM format and writes the device handle to caller storage.

ParameterTypeDefaultDescription
phwobytes—`bytes` value supplied as phwo to `waveOutOpen`.
devu32—`u32` value supplied as dev to `waveOutOpen`.
pwfxbytes—Native wave-format descriptor.
cbptr—`ptr` value supplied as cb to `waveOutOpen`.
instptr—`ptr` value supplied as inst to `waveOutOpen`.
flagsu32—Bit flags that control the operation.

Returns: Result returned by the native `waveOutOpen` binding as `u32`.

View source

waveOutPrepareHeader

extern function waveOutPrepareHeader(hwo as ptr, pwh as ptr, cbwh as u32) from "winmm.dll" symbol "waveOutPrepareHeader" returns u32

Registers one unmanaged WAVEHDR with an open waveform device before queued playback.

ParameterTypeDefaultDescription
hwoptr—`ptr` value supplied as hwo to `waveOutPrepareHeader`.
pwhptr—`ptr` value supplied as pwh to `waveOutPrepareHeader`.
cbwhu32—`u32` value supplied as cbwh to `waveOutPrepareHeader`.

Returns: Result returned by the native `waveOutPrepareHeader` binding as `u32`.

View source

waveOutReset

extern function waveOutReset(hwo as ptr) from "winmm.dll" symbol "waveOutReset" returns u32

Stops waveform playback and returns all queued buffers to the application.

ParameterTypeDefaultDescription
hwoptr—`ptr` value supplied as hwo to `waveOutReset`.

Returns: Result returned by the native `waveOutReset` binding as `u32`.

View source

waveOutUnprepareHeader

extern function waveOutUnprepareHeader(hwo as ptr, pwh as ptr, cbwh as u32) from "winmm.dll" symbol "waveOutUnprepareHeader" returns u32

Releases WinMM ownership of a completed WAVEHDR before its unmanaged memory is freed.

ParameterTypeDefaultDescription
hwoptr—`ptr` value supplied as hwo to `waveOutUnprepareHeader`.
pwhptr—`ptr` value supplied as pwh to `waveOutUnprepareHeader`.
cbwhu32—`u32` value supplied as cbwh to `waveOutUnprepareHeader`.

Returns: Result returned by the native `waveOutUnprepareHeader` binding as `u32`.

View source

waveOutWrite

extern function waveOutWrite(hwo as ptr, pwh as ptr, cbwh as u32) from "winmm.dll" symbol "waveOutWrite" returns u32

Queues a prepared WAVEHDR buffer for asynchronous playback on the waveform device.

ParameterTypeDefaultDescription
hwoptr—`ptr` value supplied as hwo to `waveOutWrite`.
pwhptr—`ptr` value supplied as pwh to `waveOutWrite`.
cbwhu32—`u32` value supplied as cbwh to `waveOutWrite`.

Returns: Result returned by the native `waveOutWrite` binding as `u32`.

View source