Loading...
Searching...
No Matches
SoundStream.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
36#include <CSFML/Audio/Types.h>
37#include <CSFML/System/Time.h>
39
40#include <stddef.h>
41
42
47typedef struct
48{
49 int16_t* samples;
50 unsigned int sampleCount;
52
54typedef void (*sfSoundStreamSeekCallback)(sfTime, void*);
55
56
74 unsigned int channelCount,
75 unsigned int sampleRate,
76 sfSoundChannel* channelMapData,
77 size_t channelMapSize,
78 void* userData);
79
87
101
112
124
134
146
159
173
188
202
214
228
241
255
267
281
293
309
324
340
356
369
382
399CSFML_AUDIO_API void sfSoundStream_setAttenuation(sfSoundStream* soundStream, float attenuation);
400
412
426
436
446
456
466
476
486
496
506
516
526
537
547
557
567
577
587
597
609
#define CSFML_AUDIO_API
struct sfSoundStream sfSoundStream
Definition Audio/Types.h:32
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.
sfSoundChannel
Types of sound channels that can be read/written from sound buffers/files.
sfSoundStatus
Enumeration of statuses for sounds and musics.
Definition SoundStatus.h:38
void sfSoundStream_setSpatializationEnabled(sfSoundStream *soundStream, bool enabled)
Set whether spatialization of the sound is enabled.
sfSoundSourceCone sfSoundStream_getCone(const sfSoundStream *soundStream)
Get the cone properties of the sound in the audio scene.
void sfSoundStream_setVelocity(sfSoundStream *soundStream, sfVector3f velocity)
Set the 3D velocity of the sound in the audio scene.
bool(* sfSoundStreamGetDataCallback)(sfSoundStreamChunk *, void *)
Type of the callback used to get a sound stream data.
Definition SoundStream.h:53
void sfSoundStream_setMinGain(sfSoundStream *soundStream, float gain)
Set the minimum gain of the sound.
void sfSoundStream_setPan(sfSoundStream *soundStream, float pan)
Set the pan of the sound.
void sfSoundStream_setMinDistance(sfSoundStream *soundStream, float distance)
Set the minimum distance of a sound stream.
sfVector3f sfSoundStream_getVelocity(const sfSoundStream *soundStream)
Get the 3D velocity of the sound in the audio scene.
void sfSoundStream_setDirection(sfSoundStream *soundStream, sfVector3f direction)
Set the 3D direction of the sound in the audio scene.
void sfSoundStream_setRelativeToListener(sfSoundStream *soundStream, bool relative)
Make a sound stream's position relative to the listener or absolute.
float sfSoundStream_getVolume(const sfSoundStream *soundStream)
Get the volume of a sound stream.
float sfSoundStream_getMinGain(const sfSoundStream *soundStream)
Get the minimum gain of the sound.
float sfSoundStream_getDopplerFactor(const sfSoundStream *soundStream)
Get the doppler factor of the sound.
void sfSoundStream_setPlayingOffset(sfSoundStream *soundStream, sfTime timeOffset)
Change the current playing position of a sound stream.
void sfSoundStream_setDopplerFactor(sfSoundStream *soundStream, float factor)
Set the doppler factor of the sound.
sfSoundStatus sfSoundStream_getStatus(const sfSoundStream *soundStream)
Get the current status of a sound stream (stopped, paused, playing)
sfSoundStream * sfSoundStream_create(sfSoundStreamGetDataCallback onGetData, sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, sfSoundChannel *channelMapData, size_t channelMapSize, void *userData)
Create a new sound stream.
void sfSoundStream_pause(sfSoundStream *soundStream)
Pause a sound stream.
unsigned int sfSoundStream_getChannelCount(const sfSoundStream *soundStream)
Return the number of channels of a sound stream.
void sfSoundStream_setPosition(sfSoundStream *soundStream, sfVector3f position)
Set the 3D position of a sound stream in the audio scene.
float sfSoundStream_getMaxDistance(const sfSoundStream *soundStream)
Get the maximum distance of the sound.
void sfSoundStream_setCone(sfSoundStream *soundStream, sfSoundSourceCone cone)
Set the cone properties of the sound in the audio scene.
bool sfSoundStream_isLooping(const sfSoundStream *soundStream)
Tell whether or not a sound stream is in loop mode.
sfSoundChannel * sfSoundStream_getChannelMap(const sfSoundStream *soundStream, size_t *count)
Get the map of position in sample frame to sound channel.
bool sfSoundStream_isRelativeToListener(const sfSoundStream *soundStream)
Tell whether a sound stream's position is relative to the listener or is absolute.
void sfSoundStream_setLooping(sfSoundStream *soundStream, bool loop)
Set whether or not a sound stream should loop after reaching the end.
void sfSoundStream_setDirectionalAttenuationFactor(sfSoundStream *soundStream, float factor)
Set the directional attenuation factor of the sound.
void sfSoundStream_stop(sfSoundStream *soundStream)
Stop playing a sound stream.
void sfSoundStream_destroy(const sfSoundStream *soundStream)
Destroy a sound stream.
bool sfSoundStream_isSpatializationEnabled(const sfSoundStream *soundStream)
Tell whether spatialization of the sound is enabled.
float sfSoundStream_getMinDistance(const sfSoundStream *soundStream)
Get the minimum distance of a sound stream.
float sfSoundStream_getDirectionalAttenuationFactor(const sfSoundStream *soundStream)
Get the directional attenuation factor of the sound.
void sfSoundStream_setAttenuation(sfSoundStream *soundStream, float attenuation)
Set the attenuation factor of a sound stream.
void(* sfSoundStreamSeekCallback)(sfTime, void *)
Type of the callback used to seek in a sound stream.
Definition SoundStream.h:54
void sfSoundStream_play(sfSoundStream *soundStream)
Start or resume playing a sound stream.
void sfSoundStream_setPitch(sfSoundStream *soundStream, float pitch)
Set the pitch of a sound stream.
sfVector3f sfSoundStream_getPosition(const sfSoundStream *soundStream)
Get the 3D position of a sound stream in the audio scene.
void sfSoundStream_setVolume(sfSoundStream *soundStream, float volume)
Set the volume of a sound stream.
unsigned int sfSoundStream_getSampleRate(const sfSoundStream *soundStream)
Get the sample rate of a sound stream.
void sfSoundStream_setMaxGain(sfSoundStream *soundStream, float gain)
Set the maximum gain of the sound.
float sfSoundStream_getPitch(const sfSoundStream *soundStream)
Get the pitch of a sound stream.
float sfSoundStream_getPan(const sfSoundStream *soundStream)
Get the pan of the sound.
sfVector3f sfSoundStream_getDirection(const sfSoundStream *soundStream)
Get the 3D direction of the sound in the audio scene.
void sfSoundStream_setEffectProcessor(sfSoundStream *soundStream, sfEffectProcessor effectProcessor)
Set the effect processor to be applied to the sound.
void sfSoundStream_setMaxDistance(sfSoundStream *soundStream, float distance)
Set the maximum distance of the sound.
sfTime sfSoundStream_getPlayingOffset(const sfSoundStream *soundStream)
Get the current playing position of a sound stream.
float sfSoundStream_getAttenuation(const sfSoundStream *soundStream)
Get the attenuation factor of a sound stream.
float sfSoundStream_getMaxGain(const sfSoundStream *soundStream)
Get the maximum gain of the sound.
Structure defining the properties of a directional cone.
defines the data to fill by the OnGetData callback
Definition SoundStream.h:48
int16_t * samples
Pointer to the audio samples.
Definition SoundStream.h:49
unsigned int sampleCount
Number of samples pointed by Samples.
Definition SoundStream.h:50
Represents a time value.
Definition Time.h:38
3-component vector of floats
Definition Vector3.h:38