Unit sdl2_mixer
Description
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
Record TMix_Chunk |
Functions and Procedures
function Mix_AllocateChannels(numchans: cint): cint cdecl; external MIX_LibName; |
procedure Mix_ChannelFinished(channel_finished: TMix_Channel_Finished) cdecl; external MIX_LibName; |
procedure Mix_ClearError(); cdecl; external SDL_LibName name '_SDL_ClearError'; |
procedure Mix_CloseAudiocdecl; external MIX_LibName; |
function Mix_EachSoundFont(func: TMix_SoundFunc; data: Pointer): cint cdecl; external MIX_LibName; |
function Mix_ExpireChannel(channel: cint; ticks: cint): cint cdecl; external MIX_LibName; |
function Mix_FadeInChannel(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint): cint; |
function Mix_FadeInChannelTimed(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint; ticks: cint): cint cdecl; external MIX_LibName; |
function Mix_FadeInMusic(music: PMix_Music; loops: cint; ms: cint): cint cdecl; external MIX_LibName; |
function Mix_FadeInMusicPos(music: PMix_Music; loops: cint; ms: cint; position: Double): cint cdecl; external MIX_LibName; |
function Mix_FadeOutChannel(which: cint; ms: cint): cint cdecl; external MIX_LibName; |
function Mix_FadeOutGroup(tag: cint; ms: cint): cint cdecl; external MIX_LibName; |
function Mix_FadeOutMusic(ms: cint): cint cdecl; external MIX_LibName; |
function Mix_FadingChannel(which: cint): TMix_Fading cdecl; external MIX_LibName; |
function Mix_FadingMusic: TMix_Fading cdecl; external MIX_LibName; |
procedure Mix_FreeChunk(chunk: PMix_Chunk) cdecl; external MIX_LibName; |
procedure Mix_FreeMusic(music: PMix_Music) cdecl; external MIX_LibName; |
function Mix_GetChunk(channel: cint): PMix_Chunk cdecl; external MIX_LibName; |
function Mix_GetChunkDecoder(index: cint): PAnsiChar cdecl; external MIX_LibName; |
function Mix_GetError: PAnsiChar; cdecl; external SDL_LibName name '_SDL_GetError'; |
function Mix_GetMusicDecoder(index: cint): PAnsiChar cdecl; external MIX_LibName; |
function Mix_GetMusicHookData: Pointer cdecl; external MIX_LibName; |
function Mix_GetMusicType(music: PMix_Music): TMix_MusicType cdecl; external MIX_LibName; |
function Mix_GetNumChunkDecoders: cint cdecl; external MIX_LibName; |
function Mix_GetNumMusicDecoders: cint cdecl; external MIX_LibName; |
function Mix_GetSoundFonts: PAnsiChar cdecl; external MIX_LibName; |
function Mix_GetSynchroValue: cint cdecl; external MIX_LibName; |
function Mix_GroupAvailable(tag: cint): cint cdecl; external MIX_LibName; |
function Mix_GroupChannel(which: cint; tag: cint): cint cdecl; external MIX_LibName; |
function Mix_GroupChannels(from: cint; _to: cint; tag: cint): cint cdecl; external MIX_LibName; |
function Mix_GroupCount(tag: cint): cint cdecl; external MIX_LibName; |
function Mix_GroupNewer(tag: cint): cint cdecl; external MIX_LibName; |
function Mix_GroupOldest(tag: cint): cint cdecl; external MIX_LibName; |
function Mix_HaltChannel(channel: cint): cint cdecl; external MIX_LibName; |
function Mix_HaltGroup(tag: cint): cint cdecl; external MIX_LibName; |
function Mix_HaltMusic: cint cdecl; external MIX_LibName; |
function Mix_HasChunkDecoder(const name: PAnsiChar): TSDL_Bool cdecl; external MIX_LibName; |
function Mix_HasMusicDecoder(const name: PAnsiChar): TSDL_Bool cdecl; external MIX_LibName; |
procedure Mix_HookMusic(func: TMix_Func; arg: Pointer) cdecl; external MIX_LibName; |
procedure Mix_HookMusicFinished(music_finished: PMix_Music_Finished) cdecl; external MIX_LibName; |
function Mix_Init(flags: cint): cint cdecl; external MIX_LibName; |
function Mix_Linked_Version: PSDL_Version cdecl; external MIX_LibName; |
function Mix_LoadMUS(_file: PAnsiChar): PMix_Music cdecl; external MIX_LibName; |
function Mix_LoadMUSType_RW(src: PSDL_RWops; _type: TMix_MusicType; freesrc: cint): PMix_Music cdecl; external MIX_LibName; |
function Mix_LoadMUS_RW(src: PSDL_RWops; freesrc: cint): PMix_Music cdecl; external MIX_LibName; |
function Mix_LoadWAV(_file: PAnsiChar): PMix_Chunk; |
function Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: cint): PMix_Chunk cdecl; external MIX_LibName; |
function Mix_OpenAudio(frequency: cint; format: cuint16; channels: cint; chunksize: cint): cint cdecl; external MIX_LibName; |
procedure Mix_Pause(channel: cint) cdecl; external MIX_LibName; |
function Mix_Paused(channel: cint): cint cdecl; external MIX_LibName; |
function Mix_PausedMusic: cint cdecl; external MIX_LibName; |
procedure Mix_PauseMusiccdecl; external MIX_LibName; |
function Mix_PlayChannel(channel: cint; chunk: PMix_Chunk; loops: cint): cint; |
function Mix_PlayChannelTimed(channel: cint; chunk: PMix_Chunk; loops: cint; ticks: cint): cint cdecl; external MIX_LibName; |
function Mix_Playing(channel: cint): cint cdecl; external MIX_LibName; |
function Mix_PlayingMusic: cint cdecl; external MIX_LibName; |
function Mix_PlayMusic(music: PMix_Music; loops: cint): cint cdecl; external MIX_LibName; |
function Mix_QuerySpec(frequency: pcint; format: pcuint16; channels: pcint): cint cdecl; external MIX_LibName; |
function Mix_QuickLoad_RAW(mem: pcuint8; len: cuint32): PMix_Chunk cdecl; external MIX_LibName; |
function Mix_QuickLoad_WAV(mem: pcuint8): PMix_Chunk cdecl; external MIX_LibName; |
procedure Mix_Quit() cdecl; external MIX_LibName; |
function Mix_RegisterEffect(chan: cint; f: TMix_EffectFunc_t; d: TMix_EffectDone_t; arg: Pointer): cint cdecl; external MIX_LibName; |
function Mix_ReserveChannels(num: cint): cint cdecl; external MIX_LibName; |
procedure Mix_Resume(channel: cint) cdecl; external MIX_LibName; |
procedure Mix_ResumeMusiccdecl; external MIX_LibName; |
procedure Mix_RewindMusiccdecl; external MIX_LibName; |
function Mix_SetDistance(channel: cint; distance: cuint8): cint cdecl; external MIX_LibName; |
function Mix_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; external SDL_LibName name '_SDL_SetError'; |
function Mix_SetMusicCMD(command: PAnsiChar): cint cdecl; external MIX_LibName; |
function Mix_SetMusicPosition(position: Double): cint cdecl; external MIX_LibName; |
function Mix_SetPanning(channel: cint; left: cuint8; right: cuint8): cint cdecl; external MIX_LibName; |
function Mix_SetPosition(channel: cint; angle: cint16; distance: cuint8): cint cdecl; external MIX_LibName; |
procedure Mix_SetPostMix(func: TMix_Func; arg: Pointer) cdecl; external MIX_LibName; |
function Mix_SetReverseStereo(channel: cint; flip: cint): cint cdecl; external MIX_LibName; |
function Mix_SetSoundFonts(paths: PAnsiChar): cint cdecl; external MIX_LibName; |
function Mix_SetSynchroValue(value: cint): cint cdecl; external MIX_LibName; |
function Mix_UnregisterAllEffects(channel: cint): cint cdecl; external MIX_LibName; |
function Mix_UnregisterEffect(channel: cint; f: TMix_EffectFunc_t): cint cdecl; external MIX_LibName; |
procedure MIX_VERSION(Out X: TSDL_Version); |
function Mix_Volume(channel: cint; volume: cint): cint cdecl; external MIX_LibName; |
function Mix_VolumeChunk(chunk: PMix_Chunk; volume: cint): cint cdecl; external MIX_LibName; |
function Mix_VolumeMusic(volume: cint): cint cdecl; external MIX_LibName; |
procedure SDL_MIXER_VERSION(Out X: TSDL_Version); |
Types
Constants
MIX_CHANNELS = 8; |
MIX_CHANNEL_POST = -2; |
MIX_DEFAULT_CHANNELS = 2; |
MIX_DEFAULT_FREQUENCY = 22050; |
MIX_EFFECTSMAXSPEED = 'MIX_EFFECTSMAXSPEED'; |
MIX_INIT_FLAC = $00000001; |
MIX_INIT_MID = $00000020; |
MIX_INIT_MOD = $00000002; |
MIX_INIT_MP3 = $00000008; |
MIX_INIT_OGG = $00000010; |
MIX_INIT_OPUS = $00000040; |
MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION; |
MIX_MAX_VOLUME = SDL2.SDL_MIX_MAXVOLUME; |
MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION; |
MIX_PATCHLEVEL = SDL_MIXER_PATCHLEVEL; |
SDL_MIXER_MAJOR_VERSION = 2; |
SDL_MIXER_MINOR_VERSION = 0; |
SDL_MIXER_PATCHLEVEL = 4; |
Description
Functions and Procedures
function Mix_AllocateChannels(numchans: cint): cint cdecl; external MIX_LibName; |
Dynamically change the number of channels managed by the mixer. If decreasing the number of channels, the upper channels are stopped. This function returns the new number of allocated channels. |
procedure Mix_ChannelFinished(channel_finished: TMix_Channel_Finished) cdecl; external MIX_LibName; |
procedure Mix_ClearError(); cdecl; external SDL_LibName name '_SDL_ClearError'; |
procedure Mix_CloseAudiocdecl; external MIX_LibName; |
Close the mixer, halting all playing audio * |
function Mix_EachSoundFont(func: TMix_SoundFunc; data: Pointer): cint cdecl; external MIX_LibName; |
function Mix_ExpireChannel(channel: cint; ticks: cint): cint cdecl; external MIX_LibName; |
Change the expiration delay for a particular channel. The sample will stop playing after the 'ticks' milliseconds have elapsed, or remove the expiration if 'ticks' is -1 |
function Mix_FadeInChannel(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint): cint; |
function Mix_FadeInChannelTimed(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint; ticks: cint): cint cdecl; external MIX_LibName; |
function Mix_FadeInMusic(music: PMix_Music; loops: cint; ms: cint): cint cdecl; external MIX_LibName; |
Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions * |
function Mix_FadeInMusicPos(music: PMix_Music; loops: cint; ms: cint; position: Double): cint cdecl; external MIX_LibName; |
function Mix_FadeOutChannel(which: cint; ms: cint): cint cdecl; external MIX_LibName; |
Halt a channel, fading it out progressively till it's silent The ms parameter indicates the number of milliseconds the fading will take. |
function Mix_FadeOutGroup(tag: cint; ms: cint): cint cdecl; external MIX_LibName; |
function Mix_FadeOutMusic(ms: cint): cint cdecl; external MIX_LibName; |
function Mix_FadingChannel(which: cint): TMix_Fading cdecl; external MIX_LibName; |
function Mix_FadingMusic: TMix_Fading cdecl; external MIX_LibName; |
Query the fading status of a channel * |
procedure Mix_FreeChunk(chunk: PMix_Chunk) cdecl; external MIX_LibName; |
Free an audio chunk previously loaded * |
procedure Mix_FreeMusic(music: PMix_Music) cdecl; external MIX_LibName; |
function Mix_GetChunk(channel: cint): PMix_Chunk cdecl; external MIX_LibName; |
Get the Mix_Chunk currently associated with a mixer channel Returns NULL if it's an invalid channel, or there's no chunk associated. |
function Mix_GetChunkDecoder(index: cint): PAnsiChar cdecl; external MIX_LibName; |
function Mix_GetError: PAnsiChar; cdecl; external SDL_LibName name '_SDL_GetError'; |
function Mix_GetMusicDecoder(index: cint): PAnsiChar cdecl; external MIX_LibName; |
function Mix_GetMusicHookData: Pointer cdecl; external MIX_LibName; |
Get a pointer to the user data for the current music hook * |
function Mix_GetMusicType(music: PMix_Music): TMix_MusicType cdecl; external MIX_LibName; |
Find out the music format of a mixer music, or the currently playing music, if 'music' is NULL. |
function Mix_GetNumChunkDecoders: cint cdecl; external MIX_LibName; |
Get a list of chunk/music decoders that this build of SDL_mixer provides. This list can change between builds AND runs of the program, if external libraries that add functionality become available. You must successfully call Mix_OpenAudio() before calling these functions. This API is only available in SDL_mixer 1.2.9 and later. // usage... int i; const int total = Mix_GetNumChunkDecoders(); for (i = 0; i < total; i++) printf("Supported chunk decoder: [%s]\n", Mix_GetChunkDecoder(i)); Appearing in this list doesn't promise your specific audio file will decode...but it's handy to know if you have, say, a functioning Timidity install. These return values are static, read-only data; do not modify or free it. The pointers remain valid until you call Mix_CloseAudio(). |
function Mix_GetNumMusicDecoders: cint cdecl; external MIX_LibName; |
function Mix_GetSoundFonts: PAnsiChar cdecl; external MIX_LibName; |
function Mix_GetSynchroValue: cint cdecl; external MIX_LibName; |
function Mix_GroupAvailable(tag: cint): cint cdecl; external MIX_LibName; |
Finds the first available channel in a group of channels, returning -1 if none are available. |
function Mix_GroupChannel(which: cint; tag: cint): cint cdecl; external MIX_LibName; |
Attach a tag to a channel. A tag can be assigned to several mixer channels, to form groups of channels. If 'tag' is -1, the tag is removed (actually -1 is the tag used to represent the group of all the channels). Returns true if everything was OK. |
function Mix_GroupChannels(from: cint; _to: cint; tag: cint): cint cdecl; external MIX_LibName; |
Assign several consecutive channels to a group * |
function Mix_GroupCount(tag: cint): cint cdecl; external MIX_LibName; |
Returns the number of channels in a group. This is also a subtle way to get the total number of channels when 'tag' is -1 |
function Mix_GroupNewer(tag: cint): cint cdecl; external MIX_LibName; |
Finds the "most recent" (i.e. last) sample playing in a group of channels * |
function Mix_GroupOldest(tag: cint): cint cdecl; external MIX_LibName; |
Finds the "oldest" sample playing in a group of channels * |
function Mix_HaltChannel(channel: cint): cint cdecl; external MIX_LibName; |
Halt playing of a particular channel * |
function Mix_HaltGroup(tag: cint): cint cdecl; external MIX_LibName; |
function Mix_HaltMusic: cint cdecl; external MIX_LibName; |
function Mix_HasChunkDecoder(const name: PAnsiChar): TSDL_Bool cdecl; external MIX_LibName; |
function Mix_HasMusicDecoder(const name: PAnsiChar): TSDL_Bool cdecl; external MIX_LibName; |
procedure Mix_HookMusic(func: TMix_Func; arg: Pointer) cdecl; external MIX_LibName; |
Add your own music player or additional mixer function. If 'mix_func' is NULL, the default music player is re-enabled. |
procedure Mix_HookMusicFinished(music_finished: PMix_Music_Finished) cdecl; external MIX_LibName; |
function Mix_Init(flags: cint): cint cdecl; external MIX_LibName; |
Loads dynamic libraries and prepares them for use. Flags should be one or more flags from MIX_InitFlags OR'd together. It returns the flags successfully initialized, or 0 on failure. |
function Mix_Linked_Version: PSDL_Version cdecl; external MIX_LibName; |
This function gets the version of the dynamically linked SDL_mixer library. it should NOT be used to fill a version structure, instead you should use the SDL_MIXER_VERSION() macro. |
function Mix_LoadMUS(_file: PAnsiChar): PMix_Music cdecl; external MIX_LibName; |
function Mix_LoadMUSType_RW(src: PSDL_RWops; _type: TMix_MusicType; freesrc: cint): PMix_Music cdecl; external MIX_LibName; |
Load a music file from an SDL_RWop object assuming a specific format * |
function Mix_LoadMUS_RW(src: PSDL_RWops; freesrc: cint): PMix_Music cdecl; external MIX_LibName; |
Load a music file from an SDL_RWop object (Ogg and MikMod specific currently) Matt Campbell (matt@campbellhome.dhs.org) April 2000 * |
function Mix_LoadWAV(_file: PAnsiChar): PMix_Chunk; |
function Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: cint): PMix_Chunk cdecl; external MIX_LibName; |
Load a wave file or a music (.mod .s3m .it .xm) file * |
function Mix_OpenAudio(frequency: cint; format: cuint16; channels: cint; chunksize: cint): cint cdecl; external MIX_LibName; |
Open the mixer with a certain audio format * |
procedure Mix_Pause(channel: cint) cdecl; external MIX_LibName; |
Pause/Resume a particular channel * |
function Mix_Paused(channel: cint): cint cdecl; external MIX_LibName; |
function Mix_PausedMusic: cint cdecl; external MIX_LibName; |
procedure Mix_PauseMusiccdecl; external MIX_LibName; |
Pause/Resume the music stream * |
function Mix_PlayChannel(channel: cint; chunk: PMix_Chunk; loops: cint): cint; |
Play an audio chunk on a specific channel. If the specified channel is -1, play on the first free channel. If 'loops' is greater than zero, loop the sound that many times. If 'loops' is -1, loop inifinitely (˜65000 times). Returns which channel was used to play the sound. |
function Mix_PlayChannelTimed(channel: cint; chunk: PMix_Chunk; loops: cint; ticks: cint): cint cdecl; external MIX_LibName; |
The same as above, but the sound is played at most 'ticks' milliseconds * |
function Mix_Playing(channel: cint): cint cdecl; external MIX_LibName; |
Check the status of a specific channel. If the specified channel is -1, check all channels. |
function Mix_PlayingMusic: cint cdecl; external MIX_LibName; |
function Mix_PlayMusic(music: PMix_Music; loops: cint): cint cdecl; external MIX_LibName; |
function Mix_QuerySpec(frequency: pcint; format: pcuint16; channels: pcint): cint cdecl; external MIX_LibName; |
Find out what the actual audio device parameters are. This function returns 1 if the audio has been opened, 0 otherwise. |
function Mix_QuickLoad_RAW(mem: pcuint8; len: cuint32): PMix_Chunk cdecl; external MIX_LibName; |
Load raw audio data of the mixer format from a memory buffer * |
function Mix_QuickLoad_WAV(mem: pcuint8): PMix_Chunk cdecl; external MIX_LibName; |
Load a wave file of the mixer format from a memory buffer * |
procedure Mix_Quit() cdecl; external MIX_LibName; |
Unloads libraries loaded with Mix_Init * |
function Mix_RegisterEffect(chan: cint; f: TMix_EffectFunc_t; d: TMix_EffectDone_t; arg: Pointer): cint cdecl; external MIX_LibName; |
Register a special effect function. At mixing time, the channel data is copied into a buffer and passed through each registered effect function. After it passes through all the functions, it is mixed into the final output stream. The copy to buffer is performed once, then each effect function performs on the output of the previous effect. Understand that this extra copy to a buffer is not performed if there are no effects registered for a given chunk, which saves CPU cycles, and any given effect will be extra cycles, too, so it is crucial that your code run fast. Also note that the data that your function is given is in the format of the sound device, and not the format you gave to Mix_OpenAudio(), although they may in reality be the same. This is an unfortunate but necessary speed concern. Use Mix_QuerySpec() to determine if you can handle the data before you register your effect, and take appropriate actions. You may also specify a callback (Mix_EffectDone_t) that is called when the channel finishes playing. This gives you a more fine-grained control than Mix_ChannelFinished(), in case you need to free effect-specific resources, etc. If you don't need this, you can specify NULL. You may set the callbacks before or after calling Mix_PlayChannel(). Things like Mix_SetPanning() are just internal special effect functions, so if you are using that, you've already incurred the overhead of a copy to a separate buffer, and that these effects will be in the queue with any functions you've registered. The list of registered effects for a channel is reset when a chunk finishes playing, so you need to explicitly set them with each call to Mix_PlayChannel*(). You may also register a special effect function that is to be run after final mixing occurs. The rules for these callbacks are identical to those in Mix_RegisterEffect, but they are run after all the channels and the music have been mixed into a single stream, whereas channel-specific effects run on a given channel before any other mixing occurs. These global effect callbacks are call "posteffects". Posteffects only have their Mix_EffectDone_t function called when they are unregistered (since the main output stream is never "done" in the same sense as a channel). You must unregister them manually when you've had enough. Your callback will be told that the channel being mixed is (MIX_CHANNEL_POST) if the processing is considered a posteffect. After all these effects have finished processing, the callback registered through Mix_SetPostMix() runs, and then the stream goes to the audio device. DO NOT EVER call SDL_LockAudio() from your callback function! returns zero if error (no such channel), nonzero if added. Error messages can be retrieved from Mix_GetError(). |
function Mix_ReserveChannels(num: cint): cint cdecl; external MIX_LibName; |
Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate them dynamically to the next sample if requested with a -1 value below. Returns the number of reserved channels. |
procedure Mix_Resume(channel: cint) cdecl; external MIX_LibName; |
procedure Mix_ResumeMusiccdecl; external MIX_LibName; |
procedure Mix_RewindMusiccdecl; external MIX_LibName; |
function Mix_SetDistance(channel: cint; distance: cuint8): cint cdecl; external MIX_LibName; |
Set the "distance" of a channel. (distance) is an integer from 0 to 255 that specifies the location of the sound in relation to the listener. Distance 0 is overlapping the listener, and 255 is as far away as possible A distance of 255 does not guarantee silence; in such a case, you might want to try changing the chunk's volume, or just cull the sample from the mixing process with Mix_HaltChannel(). For efficiency, the precision of this effect may be limited (distances 1 through 7 might all produce the same effect, 8 through 15 are equal, etc). (distance) is an integer between 0 and 255 that specifies the space between the sound and the listener. The larger the number, the further away the sound is. Setting (distance) to 0 unregisters this effect, since the data would be unchanged. If you need more precise positional audio, consider using OpenAL for spatialized effects instead of SDL_mixer. This is only meant to be a basic effect for simple "3D" games. Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and the distance attenuation will be done to the final mixed stream before passing it on to the audio device. This uses the Mix_RegisterEffect() API internally. returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if position effect is enabled. Error messages can be retrieved from Mix_GetError(). |
function Mix_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; external SDL_LibName name '_SDL_SetError'; |
We'll use SDL for reporting errors * |
function Mix_SetMusicCMD(command: PAnsiChar): cint cdecl; external MIX_LibName; |
Stop music and set external music playback command * |
function Mix_SetMusicPosition(position: Double): cint cdecl; external MIX_LibName; |
Set the current position in the music stream. This returns 0 if successful, or -1 if it failed or isn't implemented. This function is only implemented for MOD music formats (set pattern order number) and for OGG, FLAC, MP3_MAD, MP3_MPG and MODPLUG music (set position in seconds), at the moment. |
function Mix_SetPanning(channel: cint; left: cuint8; right: cuint8): cint cdecl; external MIX_LibName; |
Set the panning of a channel. The left and right channels are specified as integers between 0 and 255, quietest to loudest, respectively. Technically, this is just individual volume control for a sample with two (stereo) channels, so it can be used for more than just panning. If you want real panning, call it like this: Mix_SetPanning(channel, left, 255 - left); ...which isn't so hard. Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and the panning will be done to the final mixed stream before passing it on to the audio device. This uses the Mix_RegisterEffect() API internally, and returns without registering the effect function if the audio device is not configured for stereo output. Setting both (left) and (right) to 255 causes this effect to be unregistered, since that is the data's normal state. returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if panning effect enabled. Note that an audio device in mono mode is a no-op, but this call will return successful in that case. Error messages can be retrieved from Mix_GetError(). |
function Mix_SetPosition(channel: cint; angle: cint16; distance: cuint8): cint cdecl; external MIX_LibName; |
Set the position of a channel. (angle) is an integer from 0 to 360, that specifies the location of the sound in relation to the listener. (angle) will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260). Angle 0 is due north, and rotates clockwise as the value increases. For efficiency, the precision of this effect may be limited (angles 1 through 7 might all produce the same effect, 8 through 15 are equal, etc). (distance) is an integer between 0 and 255 that specifies the space between the sound and the listener. The larger the number, the further away the sound is. Using 255 does not guarantee that the channel will be culled from the mixing process or be completely silent. For efficiency, the precision of this effect may be limited (distance 0 through 5 might all produce the same effect, 6 through 10 are equal, etc). Setting (angle) and (distance) to 0 unregisters this effect, since the data would be unchanged. If you need more precise positional audio, consider using OpenAL for spatialized effects instead of SDL_mixer. This is only meant to be a basic effect for simple "3D" games. If the audio device is configured for mono output, then you won't get any effectiveness from the angle; however, distance attenuation on the channel will still occur. While this effect will function with stereo voices, it makes more sense to use voices with only one channel of sound, so when they are mixed through this effect, the positioning will sound correct. You can convert them to mono through SDL before giving them to the mixer in the first place if you like. Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and the positioning will be done to the final mixed stream before passing it on to the audio device. This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning(). returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if position effect is enabled. Error messages can be retrieved from Mix_GetError(). |
procedure Mix_SetPostMix(func: TMix_Func; arg: Pointer) cdecl; external MIX_LibName; |
function Mix_SetReverseStereo(channel: cint; flip: cint): cint cdecl; external MIX_LibName; |
Causes a channel to reverse its stereo. This is handy if the user has his speakers hooked up backwards, or you would like to have a minor bit of psychedelia in your sound code. :) Calling this function with (flip) set to non-zero reverses the chunks's usual channels. If (flip) is zero, the effect is unregistered. This uses the Mix_RegisterEffect() API internally, and thus is probably more CPU intensive than having the user just plug in his speakers correctly. Mix_SetReverseStereo() returns without registering the effect function if the audio device is not configured for stereo output. If you specify MIX_CHANNEL_POST for (channel), then this the effect is used on the final mixed stream before sending it on to the audio device (a posteffect). returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if reversing effect is enabled. Note that an audio device in mono mode is a no-op, but this call will return successful in that case. Error messages can be retrieved from Mix_GetError(). |
function Mix_SetSoundFonts(paths: PAnsiChar): cint cdecl; external MIX_LibName; |
Set/Get/Iterate SoundFonts paths to use by supported MIDI backends * |
function Mix_SetSynchroValue(value: cint): cint cdecl; external MIX_LibName; |
Synchro value is set by MikMod from modules while playing * |
function Mix_UnregisterAllEffects(channel: cint): cint cdecl; external MIX_LibName; |
You may not need to call this explicitly, unless you need to stop all effects from processing in the middle of a chunk's playback. Note that this will also shut off some internal effect processing, since Mix_SetPanning() and others may use this API under the hood. This is called internally when a channel completes playback. Posteffects are never implicitly unregistered as they are for channels, but they may be explicitly unregistered through this function by specifying MIX_CHANNEL_POST for a channel. returns zero if error (no such channel), nonzero if all effects removed. Error messages can be retrieved from Mix_GetError(). |
function Mix_UnregisterEffect(channel: cint; f: TMix_EffectFunc_t): cint cdecl; external MIX_LibName; |
You may not need to call this explicitly, unless you need to stop an effect from processing in the middle of a chunk's playback. Posteffects are never implicitly unregistered as they are for channels, but they may be explicitly unregistered through this function by specifying MIX_CHANNEL_POST for a channel. returns zero if error (no such channel or effect), nonzero if removed. Error messages can be retrieved from Mix_GetError(). |
procedure MIX_VERSION(Out X: TSDL_Version); |
function Mix_Volume(channel: cint; volume: cint): cint cdecl; external MIX_LibName; |
Set the volume in the range of 0-128 of a specific channel or chunk. If the specified channel is -1, set volume for all channels. Returns the original volume. If the specified volume is -1, just return the current volume. |
function Mix_VolumeChunk(chunk: PMix_Chunk; volume: cint): cint cdecl; external MIX_LibName; |
function Mix_VolumeMusic(volume: cint): cint cdecl; external MIX_LibName; |
procedure SDL_MIXER_VERSION(Out X: TSDL_Version); |
This macro can be used to fill a version structure with the compile-time version of the SDL_mixer library. |
Types
cintptr_t = PtrInt; |
cuintptr_t = PtrUInt; |
"The following type designates an unsigned integer type [or signed respectivly] with the property that any valid pointer to void can be converted to this type, then converted back to a pointer to void, and the result will compare equal to the original pointer: uintptr_t" Source: https://pubs.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html |
PMix_Channel_Finished = ˆTMix_Channel_Finished; |
PMix_Chunk = ˆTMix_Chunk; |
PMix_EffectDone_t = ˆTMix_EffectDone_t; |
PMix_EffectFunc_t = ˆTMix_EffectFunc_t; |
PMix_Fading = ˆTMix_Fading; |
PMix_Func = ˆTMix_Func; |
PMIX_InitFlags = ˆTMIX_InitFlags; |
PMix_Music = type Pointer; |
PMix_MusicType = ˆTMix_MusicType; |
PMix_Music_Finished = ˆTMix_Music_Finished; |
PMix_SoundFunc = ˆTMix_SoundFunc; |
ppcuint8 = ˆpcuint8; |
PPMix_Channel_Finished = ˆPMix_Channel_Finished; |
Add your own callback when a channel has finished playing. NULL to disable callback. The callback may be called from the mixer's audio callback or it could be called as a result of Mix_HaltChannel(), etc. do not call SDL_LockAudio() from this callback; you will either be inside the audio callback, or SDL_mixer will explicitly lock the audio before calling your callback. |
PPMix_Chunk = ˆPMix_Chunk; |
The internal format for an audio chunk * |
PPMix_EffectDone_t = ˆPMix_EffectDone_t; |
This is a callback that signifies that a channel has finished all its loops and has completed playback. This gets called if the buffer plays out normally, or if you call Mix_HaltChannel(), implicitly stop a channel via Mix_AllocateChannels(), or unregister a callback while it's still playing. DO NOT EVER call SDL_LockAudio() from your callback function! |
PPMix_EffectFunc_t = ˆPMix_EffectFunc_t; |
This is the format of a special effect callback: myeffect(int chan, void *stream, int len, void *udata); (chan) is the channel number that your effect is affecting. (stream) is the buffer of data to work upon. (len) is the size of (stream), and (udata) is a user-defined bit of data, which you pass as the last arg of Mix_RegisterEffect(), and is passed back unmolested to your callback. Your effect changes the contents of (stream) based on whatever parameters are significant, or just leaves it be, if you prefer. You can do whatever you like to the buffer, though, and it will continue in its changed state down the mixing pipeline, through any other effect functions, then finally to be mixed with the rest of the channels and music for the final output stream. DO NOT EVER call SDL_LockAudio() from your callback function! |
PPMix_Fading = ˆPMix_Fading; |
The different fading types supported * |
PPMix_Func = ˆPMix_Func; |
Set a function that is called after all mixing is performed. This can be used to provide real-time visual display of the audio stream or add a custom mixer filter for the stream data. |
PPMIX_InitFlags = ˆPMIX_InitFlags; |
// Removed in SDL2_mixer 2.0.2 MIX_INIT_MODPLUG = $00000004; MIX_INIT_FLUIDSYNTH = $00000020; |
PPMix_Music = ˆPMix_Music; |
The internal format for a music chunk interpreted via mikmod * |
PPMix_MusicType = ˆPMix_MusicType; |
PPMix_Music_Finished = ˆPMix_Music_Finished; |
Add your own callback when the music has finished playing or when it is stopped from a call to Mix_HaltMusic. |
PPMix_SoundFunc = ˆPMix_SoundFunc; |
PPUInt8Array = ˆPUInt8Array; |
Data types for all compilers |
PUInt8Array = ˆTUInt8Array; |
TMix_Channel_Finished = procedure(channel: cint) cdecl; |
TMix_EffectDone_t = procedure(chan: cint; udata: Pointer) cdecl; |
TMix_EffectFunc_t = procedure(chan: cint; stream: Pointer; len: cint; udata: Pointer) cdecl; |
TMix_Fading = (...); |
Values
|
TMix_Func = procedure(udata: Pointer; stream: pcuint8; len: cint) cdecl; |
TMIX_InitFlags = cint; |
TMix_MusicType = (...); |
Values
|
TMix_Music_Finished = procedure() cdecl; |
TMix_SoundFunc = function(c: PAnsiChar; p: Pointer): cint cdecl; |
TUInt8Array = array [0..MAXINT shr 1] of cuint8; |
Constants
MIX_CHANNELS = 8; |
The default mixer has 8 simultaneous mixing channels * |
MIX_CHANNEL_POST = -2; |
Special Effects API by ryan c. gordon. (icculus@icculus.org) * |
MIX_DEFAULT_CHANNELS = 2; |
MIX_DEFAULT_FREQUENCY = 22050; |
Good default values for a PC soundcard * |
MIX_EFFECTSMAXSPEED = 'MIX_EFFECTSMAXSPEED'; |
MIX_INIT_FLAC = $00000001; |
MIX_INIT_MID = $00000020; |
MIX_INIT_MOD = $00000002; |
MIX_INIT_MP3 = $00000008; |
MIX_INIT_OGG = $00000010; |
MIX_INIT_OPUS = $00000040; |
MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION; |
Backwards compatibility * |
MIX_MAX_VOLUME = SDL2.SDL_MIX_MAXVOLUME; |
MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION; |
MIX_PATCHLEVEL = SDL_MIXER_PATCHLEVEL; |
SDL_MIXER_MAJOR_VERSION = 2; |
Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL * |
SDL_MIXER_MINOR_VERSION = 0; |
SDL_MIXER_PATCHLEVEL = 4; |
Generated by PasDoc 0.16.0.