CSFML 3.0.0
Loading...
Searching...
No Matches
Sound.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <CSFML/Audio/Export.h>
31
32#include <CSFML/Audio/EffectProcessor.h>
33#include <CSFML/Audio/SoundSourceCone.h>
34#include <CSFML/Audio/SoundStatus.h>
35#include <CSFML/Audio/Types.h>
36#include <CSFML/System/Time.h>
37#include <CSFML/System/Vector3.h>
38
39
48 CSFML_AUDIO_API sfSound* sfSound_create(const sfSoundBuffer* buffer);
49
58 CSFML_AUDIO_API sfSound* sfSound_copy(const sfSound* sound);
59
66 CSFML_AUDIO_API void sfSound_destroy(const sfSound* sound);
67
80 CSFML_AUDIO_API void sfSound_play(sfSound* sound);
81
91 CSFML_AUDIO_API void sfSound_pause(sfSound* sound);
92
103 CSFML_AUDIO_API void sfSound_stop(sfSound* sound);
104
116 CSFML_AUDIO_API void sfSound_setBuffer(sfSound* sound, const sfSoundBuffer* buffer);
117
126 CSFML_AUDIO_API const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound);
127
140 CSFML_AUDIO_API void sfSound_setLooping(sfSound* sound, bool loop);
141
150 CSFML_AUDIO_API bool sfSound_isLooping(const sfSound* sound);
151
160 CSFML_AUDIO_API sfSoundStatus sfSound_getStatus(const sfSound* sound);
161
175 CSFML_AUDIO_API void sfSound_setPitch(sfSound* sound, float pitch);
176
189 CSFML_AUDIO_API void sfSound_setPan(sfSound* sound, float pan);
190
191
202 CSFML_AUDIO_API void sfSound_setVolume(sfSound* sound, float volume);
203
216 CSFML_AUDIO_API void sfSound_setSpatializationEnabled(sfSound* sound, bool enabled);
217
229 CSFML_AUDIO_API void sfSound_setPosition(sfSound* sound, sfVector3f position);
230
243 CSFML_AUDIO_API void sfSound_setDirection(sfSound* sound, sfVector3f direction);
244
255 CSFML_AUDIO_API void sfSound_setCone(sfSound* sound, sfSoundSourceCone cone);
256
269 CSFML_AUDIO_API void sfSound_setVelocity(sfSound* sound, sfVector3f velocity);
270
281 CSFML_AUDIO_API void sfSound_setDopplerFactor(sfSound* sound, float factor);
282
297 CSFML_AUDIO_API void sfSound_setDirectionalAttenuationFactor(sfSound* sound, float factor);
298
312 CSFML_AUDIO_API void sfSound_setRelativeToListener(sfSound* sound, bool relative);
313
328 CSFML_AUDIO_API void sfSound_setMinDistance(sfSound* sound, float distance);
329
344 CSFML_AUDIO_API void sfSound_setMaxDistance(sfSound* sound, float distance);
345
357 CSFML_AUDIO_API void sfSound_setMinGain(sfSound* sound, float gain);
358
371 CSFML_AUDIO_API void sfSound_setMaxGain(sfSound* sound, float gain);
372
389 CSFML_AUDIO_API void sfSound_setAttenuation(sfSound* sound, float attenuation);
390
401 CSFML_AUDIO_API void sfSound_setPlayingOffset(sfSound* sound, sfTime timeOffset);
402
413 CSFML_AUDIO_API void sfSound_setEffectProcessor(sfSound* sound, sfEffectProcessor effectProcessor);
414
423 CSFML_AUDIO_API float sfSound_getPitch(const sfSound* sound);
424
433 CSFML_AUDIO_API float sfSound_getPan(const sfSound* sound);
434
443 CSFML_AUDIO_API float sfSound_getVolume(const sfSound* sound);
444
453 CSFML_AUDIO_API bool sfSound_isSpatializationEnabled(const sfSound* sound);
454
463 CSFML_AUDIO_API sfVector3f sfSound_getPosition(const sfSound* sound);
464
473 CSFML_AUDIO_API sfVector3f sfSound_getDirection(const sfSound* sound);
474
483 CSFML_AUDIO_API sfSoundSourceCone sfSound_getCone(const sfSound* sound);
484
493 CSFML_AUDIO_API sfVector3f sfSound_getVelocity(const sfSound* sound);
494
503 CSFML_AUDIO_API float sfSound_getDopplerFactor(const sfSound* sound);
504
513 CSFML_AUDIO_API float sfSound_getDirectionalAttenuationFactor(const sfSound* sound);
514
524 CSFML_AUDIO_API bool sfSound_isRelativeToListener(const sfSound* sound);
525
534 CSFML_AUDIO_API float sfSound_getMinDistance(const sfSound* sound);
535
544 CSFML_AUDIO_API float sfSound_getMaxDistance(const sfSound* sound);
545
554 CSFML_AUDIO_API float sfSound_getMinGain(const sfSound* sound);
555
564 CSFML_AUDIO_API float sfSound_getMaxGain(const sfSound* sound);
565
574 CSFML_AUDIO_API float sfSound_getAttenuation(const sfSound* sound);
575
584 CSFML_AUDIO_API sfTime sfSound_getPlayingOffset(const sfSound* sound);
Export.h
CSFML_AUDIO_API
#define CSFML_AUDIO_API
Definition Audio/Export.h:42
Types.h
sfSoundBuffer
struct sfSoundBuffer sfSoundBuffer
Definition Audio/Types.h:29
sfSound
struct sfSound sfSound
Definition Audio/Types.h:28
EffectProcessor.h
sfEffectProcessor
void(* sfEffectProcessor)(const float *inputFrames, unsigned int *inputFrameCount, float *outputFrames, unsigned int *outputFrameCount, unsigned int frameChannelCount)
Callable that is provided with sound data for processing.
Definition EffectProcessor.h:102
SoundSourceCone.h
SoundStatus.h
sfSoundStatus
sfSoundStatus
Enumeration of statuses for sounds and musics.
Definition SoundStatus.h:38
sfSound_getMaxGain
float sfSound_getMaxGain(const sfSound *sound)
Get the maximum gain of the sound.
sfSound_setPan
void sfSound_setPan(sfSound *sound, float pan)
Set the pan of the sound.
sfSound_isRelativeToListener
bool sfSound_isRelativeToListener(const sfSound *sound)
Tell whether a sound's position is relative to the listener or is absolute.
sfSound_setCone
void sfSound_setCone(sfSound *sound, sfSoundSourceCone cone)
Set the cone properties of the sound in the audio scene.
sfSound_setSpatializationEnabled
void sfSound_setSpatializationEnabled(sfSound *sound, bool enabled)
Set whether spatialization of the sound is enabled.
sfSound_getPitch
float sfSound_getPitch(const sfSound *sound)
Get the pitch of a sound.
sfSound_pause
void sfSound_pause(sfSound *sound)
Pause a sound.
sfSound_setDirection
void sfSound_setDirection(sfSound *sound, sfVector3f direction)
Set the 3D direction of the sound in the audio scene.
sfSound_setPosition
void sfSound_setPosition(sfSound *sound, sfVector3f position)
Set the 3D position of a sound in the audio scene.
sfSound_copy
sfSound * sfSound_copy(const sfSound *sound)
Create a new sound by copying an existing one.
sfSound_getCone
sfSoundSourceCone sfSound_getCone(const sfSound *sound)
Get the cone properties of the sound in the audio scene.
sfSound_setVolume
void sfSound_setVolume(sfSound *sound, float volume)
Set the volume of a sound.
sfSound_setRelativeToListener
void sfSound_setRelativeToListener(sfSound *sound, bool relative)
Make the sound's position relative to the listener or absolute.
sfSound_setMaxGain
void sfSound_setMaxGain(sfSound *sound, float gain)
Set the maximum gain of the sound.
sfSound_stop
void sfSound_stop(sfSound *sound)
Stop playing a sound.
sfSound_create
sfSound * sfSound_create(const sfSoundBuffer *buffer)
Create a new sound.
sfSound_isSpatializationEnabled
bool sfSound_isSpatializationEnabled(const sfSound *sound)
Tell whether spatialization of the sound is enabled.
sfSound_destroy
void sfSound_destroy(const sfSound *sound)
Destroy a sound.
sfSound_play
void sfSound_play(sfSound *sound)
Start or resume playing a sound.
sfSound_setAttenuation
void sfSound_setAttenuation(sfSound *sound, float attenuation)
Set the attenuation factor of a sound.
sfSound_setPitch
void sfSound_setPitch(sfSound *sound, float pitch)
Set the pitch of a sound.
sfSound_setMinGain
void sfSound_setMinGain(sfSound *sound, float gain)
Set the minimum gain of the sound.
sfSound_getMaxDistance
float sfSound_getMaxDistance(const sfSound *sound)
Get the maximum distance of the sound.
sfSound_getPan
float sfSound_getPan(const sfSound *sound)
Get the pan of the sound.
sfSound_setVelocity
void sfSound_setVelocity(sfSound *sound, sfVector3f velocity)
Set the 3D velocity of the sound in the audio scene.
sfSound_getMinDistance
float sfSound_getMinDistance(const sfSound *sound)
Get the minimum distance of a sound.
sfSound_getVolume
float sfSound_getVolume(const sfSound *sound)
Get the volume of a sound.
sfSound_setDopplerFactor
void sfSound_setDopplerFactor(sfSound *sound, float factor)
Set the doppler factor of the sound.
sfSound_getPlayingOffset
sfTime sfSound_getPlayingOffset(const sfSound *sound)
Get the current playing position of a sound.
sfSound_setBuffer
void sfSound_setBuffer(sfSound *sound, const sfSoundBuffer *buffer)
Set the source buffer containing the audio data to play.
sfSound_getVelocity
sfVector3f sfSound_getVelocity(const sfSound *sound)
Get the 3D velocity of the sound in the audio scene.
sfSound_getDopplerFactor
float sfSound_getDopplerFactor(const sfSound *sound)
Get the doppler factor of the sound.
sfSound_setEffectProcessor
void sfSound_setEffectProcessor(sfSound *sound, sfEffectProcessor effectProcessor)
Set the effect processor to be applied to the sound.
sfSound_setPlayingOffset
void sfSound_setPlayingOffset(sfSound *sound, sfTime timeOffset)
Change the current playing position of a sound.
sfSound_setMinDistance
void sfSound_setMinDistance(sfSound *sound, float distance)
Set the minimum distance of a sound.
sfSound_getPosition
sfVector3f sfSound_getPosition(const sfSound *sound)
Get the 3D position of a sound in the audio scene.
sfSound_getAttenuation
float sfSound_getAttenuation(const sfSound *sound)
Get the attenuation factor of a sound.
sfSound_getBuffer
const sfSoundBuffer * sfSound_getBuffer(const sfSound *sound)
Get the audio buffer attached to a sound.
sfSound_getStatus
sfSoundStatus sfSound_getStatus(const sfSound *sound)
Get the current status of a sound (stopped, paused, playing)
sfSound_setMaxDistance
void sfSound_setMaxDistance(sfSound *sound, float distance)
Set the maximum distance of the sound.
sfSound_setLooping
void sfSound_setLooping(sfSound *sound, bool loop)
Set whether or not a sound should loop after reaching the end.
sfSound_getDirectionalAttenuationFactor
float sfSound_getDirectionalAttenuationFactor(const sfSound *sound)
Get the directional attenuation factor of the sound.
sfSound_isLooping
bool sfSound_isLooping(const sfSound *sound)
Tell whether or not a sound is in loop mode.
sfSound_getDirection
sfVector3f sfSound_getDirection(const sfSound *sound)
Get the 3D direction of the sound in the audio scene.
sfSound_setDirectionalAttenuationFactor
void sfSound_setDirectionalAttenuationFactor(sfSound *sound, float factor)
Set the directional attenuation factor of the sound.
sfSound_getMinGain
float sfSound_getMinGain(const sfSound *sound)
Get the minimum gain of the sound.
Time.h
Vector3.h
sfSoundSourceCone
Structure defining the properties of a directional cone.
Definition SoundSourceCone.h:39
sfTime
Represents a time value.
Definition Time.h:38
sfVector3f
3-component vector of floats
Definition Vector3.h:38