table of contents
- experimental 3.1.2+git20260204~9ea9abe+ds-1
| MIX_CreateSineWaveAudio(3) | SDL_mixer3 FUNCTIONS | MIX_CreateSineWaveAudio(3) |
NAME¶
MIX_CreateSineWaveAudio - Create a MIX_Audio that generates a sinewave.
SYNOPSIS¶
#include <SDL3_mixer/SDL_mixer.h>
MIX_Audio * MIX_CreateSineWaveAudio(MIX_Mixer *mixer, int hz, float amplitude, Sint64 ms);
DESCRIPTION¶
This is useful just to have _something_ to play, perhaps for testing or debugging purposes.
You specify its frequency in Hz (determines the pitch of the sinewave's audio) and amplitude (determines the volume of the sinewave: 1.0f is very loud, 0.0f is silent).
A number of milliseconds of audio to generate can be specified. Specifying a value less than zero will generate infinite audio (when assigned to a MIX_Track, the sinewave will play forever).
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.
FUNCTION PARAMETERS¶
RETURN VALUE¶
Returns an audio object that can be used to make sound on a mixer, or NULL on failure; call SDL_GetError() for more information.
THREAD SAFETY¶
It is safe to call this function from any thread.
AVAILABILITY¶
This function is available since SDL_mixer 3.0.0.
SEE ALSO¶
MIX_DestroyAudio(3), MIX_SetTrackAudio(3), MIX_LoadAudio_IO(3)
| SDL_mixer 3.1.3 | SDL_mixer |