CSFML 3.0.0
Loading...
Searching...
No Matches
SoundBuffer.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/SoundChannel.h>
33#include <CSFML/Audio/Types.h>
34#include <CSFML/System/InputStream.h>
35#include <CSFML/System/Time.h>
36
37#include <stddef.h>
38
39
52 CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename);
53
67 CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data, size_t sizeInBytes);
68
81 CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream);
82
99 CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(
100 const int16_t* samples,
101 uint64_t sampleCount,
102 unsigned int channelCount,
103 unsigned int sampleRate,
104 sfSoundChannel* channelMapData,
105 size_t channelMapSize);
106
115 CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_copy(const sfSoundBuffer* soundBuffer);
116
123 CSFML_AUDIO_API void sfSoundBuffer_destroy(const sfSoundBuffer* soundBuffer);
124
138 CSFML_AUDIO_API bool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename);
139
152 CSFML_AUDIO_API const int16_t* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer);
153
165 CSFML_AUDIO_API uint64_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
166
179 CSFML_AUDIO_API unsigned int sfSoundBuffer_getSampleRate(const sfSoundBuffer* soundBuffer);
180
192 CSFML_AUDIO_API unsigned int sfSoundBuffer_getChannelCount(const sfSoundBuffer* soundBuffer);
193
206 CSFML_AUDIO_API sfSoundChannel* sfSoundBuffer_getChannelMap(const sfSoundBuffer* soundBuffer, size_t* count);
207
216 CSFML_AUDIO_API sfTime sfSoundBuffer_getDuration(const sfSoundBuffer* soundBuffer);
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
InputStream.h
sfSoundBuffer_copy
sfSoundBuffer * sfSoundBuffer_copy(const sfSoundBuffer *soundBuffer)
Create a new sound buffer by copying an existing one.
sfSoundBuffer_getChannelMap
sfSoundChannel * sfSoundBuffer_getChannelMap(const sfSoundBuffer *soundBuffer, size_t *count)
Get the map of position in sample frame to sound channel.
sfSoundBuffer_getSampleRate
unsigned int sfSoundBuffer_getSampleRate(const sfSoundBuffer *soundBuffer)
Get the sample rate of a sound buffer.
sfSoundBuffer_createFromMemory
sfSoundBuffer * sfSoundBuffer_createFromMemory(const void *data, size_t sizeInBytes)
Create a new sound buffer and load it from a file in memory.
sfSoundBuffer_destroy
void sfSoundBuffer_destroy(const sfSoundBuffer *soundBuffer)
Destroy a sound buffer.
sfSoundBuffer_createFromSamples
sfSoundBuffer * sfSoundBuffer_createFromSamples(const int16_t *samples, uint64_t sampleCount, unsigned int channelCount, unsigned int sampleRate, sfSoundChannel *channelMapData, size_t channelMapSize)
Create a new sound buffer and load it from an array of samples in memory.
sfSoundBuffer_getChannelCount
unsigned int sfSoundBuffer_getChannelCount(const sfSoundBuffer *soundBuffer)
Get the number of channels used by a sound buffer.
sfSoundBuffer_createFromStream
sfSoundBuffer * sfSoundBuffer_createFromStream(sfInputStream *stream)
Create a new sound buffer and load it from a custom stream.
sfSoundBuffer_getSampleCount
uint64_t sfSoundBuffer_getSampleCount(const sfSoundBuffer *soundBuffer)
Get the number of samples stored in a sound buffer.
sfSoundBuffer_saveToFile
bool sfSoundBuffer_saveToFile(const sfSoundBuffer *soundBuffer, const char *filename)
Save a sound buffer to an audio file.
sfSoundBuffer_getSamples
const int16_t * sfSoundBuffer_getSamples(const sfSoundBuffer *soundBuffer)
Get the array of audio samples stored in a sound buffer.
sfSoundBuffer_getDuration
sfTime sfSoundBuffer_getDuration(const sfSoundBuffer *soundBuffer)
Get the total duration of a sound buffer.
sfSoundBuffer_createFromFile
sfSoundBuffer * sfSoundBuffer_createFromFile(const char *filename)
Create a new sound buffer and load it from a file.
SoundChannel.h
sfSoundChannel
sfSoundChannel
Types of sound channels that can be read/written from sound buffers/files.
Definition SoundChannel.h:39
Time.h
sfInputStream
Set of callbacks that allow users to define custom file streams.
Definition InputStream.h:46
sfTime
Represents a time value.
Definition Time.h:38