.\" This manpage content is licensed under Creative Commons
.\"  Attribution 4.0 International (CC BY 4.0)
.\"   https://creativecommons.org/licenses/by/4.0/
.\" This manpage was generated from SDL_mixer's wiki page for MIX_SetTrackAudioStream:
.\"   https://wiki.libsdl.org/SDL3_mixer/MIX_SetTrackAudioStream
.\" Generated with SDL/build-scripts/wikiheaders.pl
.\"  revision 3.2.4+ds-1
.\" Please report issues in this manpage's content at:
.\"   https://github.com/libsdl-org/sdlwiki/issues/new
.\" Please report issues in the generation of this manpage from the wiki at:
.\"   https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20MIX_SetTrackAudioStream
.\" SDL_mixer can be found at https://libsdl.org/projects/SDL_mixer/
.de URL
\$2 \(laURL: \$1 \(ra\$3
..
.if \n[.g] .mso www.tmac
.TH MIX_SetTrackAudioStream 3 "SDL_mixer 3.2.4" "SDL_mixer" "SDL_mixer3 FUNCTIONS"
.SH NAME
MIX_SetTrackAudioStream \- Set a
.BR MIX_Track \(aqs
input to an SDL_AudioStream\[char46]
.SH SYNOPSIS
.nf
.B #include <SDL3_mixer/SDL_mixer.h>
.PP
.BI "bool MIX_SetTrackAudioStream(MIX_Track *track, SDL_AudioStream *stream);
.fi
.SH DESCRIPTION
Using an audio stream allows the application to generate any type of audio, in any format, possibly procedurally or on-demand, and mix in with all other tracks\[char46]
.PP
When a track uses an audio stream, it will call SDL_GetAudioStreamData as it needs more audio to mix\[char46] The app can either buffer data to the stream ahead of time, or set a callback on the stream to provide data as needed\[char46] Please refer to SDL\(aqs documentation for details\[char46]
.PP
A given audio stream may only be assigned to a single track at a time; duplicate assignments won\(aqt return an error, but assigning a stream to multiple tracks will cause each track to read from the stream arbitrarily, causing confusion and incorrect mixing\[char46]
.PP
Once a track has a valid input, it can start mixing sound by calling
.BR MIX_PlayTrack (),
or possibly
.BR MIX_PlayTag ()\[char46]
.PP
Calling this function with a NULL audio stream is legal, and removes any input from the track\[char46] If the track was currently playing, the next time the mixer runs, it\(aqll notice this and mark the track as stopped, calling any assigned
.BR MIX_TrackStoppedCallback \[char46]
.PP
It is legal to change the input of a track while it\(aqs playing, however some states, like loop points, may cease to make sense with the new audio\[char46] In such a case, one can call
.BR MIX_PlayTrack
again to adjust parameters\[char46]
.PP
The provided audio stream must remain valid until the track no longer needs it (either by changing the track\(aqs input or destroying the track)\[char46]

.SH FUNCTION PARAMETERS
.TP
.I track
the track on which to set a new audio input\[char46]
.TP
.I stream
the audio stream to use as the track\(aqs input\[char46]
.SH RETURN VALUE
Returns true on success, false on error; call SDL_GetError() for details\[char46]

.SH THREAD SAFETY
It is safe to call this function from any thread\[char46]

.SH AVAILABILITY
This function is available since SDL_mixer 3\[char46]0\[char46]0\[char46]

