Sound_Player module

make_stream

procedureSource

Makes a stream to play data. Returns null when the sound is not loaded or has more channels than a stream can take.

Example
samples: [64] s16;
sound := Sound_Data.{ loaded = true, type = .LINEAR_SAMPLE_ARRAY, nchannels = 1, samples = samples.data, nsamples_times_nchannels = samples.count };

stream := make_stream(*sound, .UI);
assert(stream != null);

not_loaded: Sound_Data;
assert(make_stream(*not_loaded) == null);

Doesn't run in the browser (skipped on wasm).

make_stream :: (
    data: *Sound_Data,
    category := Sound_Category.GENERAL_SFX
) -> *Sound_Stream

Makes a stream to play data. Returns null when the sound is not loaded or has more channels than a stream can take.

Parameters

data: *Sound_Data
a loaded sound.
category := Sound_Category.GENERAL_SFX
the group the stream belongs to, for volume control.

Returns

Example
samples: [64] s16;
sound := Sound_Data.{ loaded = true, type = .LINEAR_SAMPLE_ARRAY, nchannels = 1, samples = samples.data, nsamples_times_nchannels = samples.count };

stream := make_stream(*sound, .UI);
assert(stream != null);

not_loaded: Sound_Data;
assert(make_stream(*not_loaded) == null);

Doesn't run in the browser (skipped on wasm).

See also