mixLoadRawAudioIo function mixer

Pointer<MixAudio> mixLoadRawAudioIo(
  1. Pointer<MixMixer> mixer,
  2. Pointer<SdlIoStream> io,
  3. Pointer<SdlAudioSpec> spec,
  4. bool closeio,
)

Load raw PCM data from an SDL_IOStream.

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.

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 io the SDL_IOStream to load data from. \param spec what format the raw data is in. \param closeio true if SDL_mixer should close io before returning (success or failure). \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 \sa MIX_LoadRawAudioNoCopy \sa MIX_LoadAudio_IO

extern SDL_DECLSPEC MIX_Audio * SDLCALL MIX_LoadRawAudio_IO(MIX_Mixer *mixer, SDL_IOStream *io, const SDL_AudioSpec *spec, bool closeio)

Implementation

Pointer<MixAudio> mixLoadRawAudioIo(
  Pointer<MixMixer> mixer,
  Pointer<SdlIoStream> io,
  Pointer<SdlAudioSpec> spec,
  bool closeio,
) {
  final mixLoadRawAudioIoLookupFunction = _libMixer
      .lookupFunction<
        Pointer<MixAudio> Function(
          Pointer<MixMixer> mixer,
          Pointer<SdlIoStream> io,
          Pointer<SdlAudioSpec> spec,
          Uint8 closeio,
        ),
        Pointer<MixAudio> Function(
          Pointer<MixMixer> mixer,
          Pointer<SdlIoStream> io,
          Pointer<SdlAudioSpec> spec,
          int closeio,
        )
      >('MIX_LoadRawAudio_IO');
  return mixLoadRawAudioIoLookupFunction(mixer, io, spec, closeio ? 1 : 0);
}