mixLoadRawAudio function mixer
- Pointer<
MixMixer> mixer, - Pointer<
NativeType> data, - int datalen,
- Pointer<
SdlAudioSpec> spec,
Load raw PCM data from a memory buffer.
There are other options for streaming raw PCM: an SDL_AudioStream can be connected to a track, as can an SDL_IOStream, and will read from those sources on-demand when it is time to mix the audio. This function is useful for loading static audio data that is meant to be played multiple times.
This function will load the raw data in its entirety and cache it in RAM, allocating a copy. If the original data will outlive the created MIX_Audio, you can use MIX_LoadRawAudioNoCopy() to avoid extra allocations and copies.
MIX_Audio objects can be shared between multiple mixers. The mixer
parameter just suggests the most likely mixer to use this audio, in case
some optimization might be applied, but this is not required, and a NULL
mixer may be specified.
\param mixer a mixer this audio is intended to be used with. May be NULL. \param data the raw PCM data to load. \param datalen the size, in bytes, of the raw PCM data. \param spec what format the raw data is in. \returns an audio object that can be used to make sound on a mixer, or NULL on failure; call SDL_GetError() for more information.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL_mixer 3.0.0.
\sa MIX_DestroyAudio \sa MIX_SetTrackAudio \sa MIX_LoadRawAudio_IO \sa MIX_LoadRawAudioNoCopy \sa MIX_LoadAudio_IO
extern SDL_DECLSPEC MIX_Audio * SDLCALL MIX_LoadRawAudio(MIX_Mixer *mixer, const void *data, size_t datalen, const SDL_AudioSpec *spec)
Implementation
Pointer<MixAudio> mixLoadRawAudio(
Pointer<MixMixer> mixer,
Pointer<NativeType> data,
int datalen,
Pointer<SdlAudioSpec> spec,
) {
final mixLoadRawAudioLookupFunction = _libMixer
.lookupFunction<
Pointer<MixAudio> Function(
Pointer<MixMixer> mixer,
Pointer<NativeType> data,
Uint32 datalen,
Pointer<SdlAudioSpec> spec,
),
Pointer<MixAudio> Function(
Pointer<MixMixer> mixer,
Pointer<NativeType> data,
int datalen,
Pointer<SdlAudioSpec> spec,
)
>('MIX_LoadRawAudio');
return mixLoadRawAudioLookupFunction(mixer, data, datalen, spec);
}