CSFML 3.0.0
Loading...
Searching...
No Matches
SoundRecorder.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/Time.h>
35
36#include <stddef.h>
37
38
39 typedef bool (*sfSoundRecorderStartCallback)(void*);
40 typedef bool (*sfSoundRecorderProcessCallback)(const int16_t*, size_t, void*);
41 typedef void (*sfSoundRecorderStopCallback)(void*);
42
43
55 CSFML_AUDIO_API sfSoundRecorder* sfSoundRecorder_create(sfSoundRecorderStartCallback onStart,
56 sfSoundRecorderProcessCallback onProcess,
57 sfSoundRecorderStopCallback onStop,
58 void* userData);
59
66 CSFML_AUDIO_API void sfSoundRecorder_destroy(const sfSoundRecorder* soundRecorder);
67
84 CSFML_AUDIO_API bool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
85
92 CSFML_AUDIO_API void sfSoundRecorder_stop(sfSoundRecorder* soundRecorder);
93
106 CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder* soundRecorder);
107
118 CSFML_AUDIO_API bool sfSoundRecorder_isAvailable(void);
119
132 CSFML_AUDIO_API const char* const* sfSoundRecorder_getAvailableDevices(size_t* count);
133
143 CSFML_AUDIO_API const char* sfSoundRecorder_getDefaultDevice(void);
144
159 CSFML_AUDIO_API bool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name);
160
169 CSFML_AUDIO_API const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder);
170
185 CSFML_AUDIO_API void sfSoundRecorder_setChannelCount(sfSoundRecorder* soundRecorder, unsigned int channelCount);
186
198 CSFML_AUDIO_API unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder* soundRecorder);
199
212 CSFML_AUDIO_API sfSoundChannel* sfSoundRecorder_getChannelMap(const sfSoundRecorder* soundRecorder, size_t* count);
Export.h
CSFML_AUDIO_API
#define CSFML_AUDIO_API
Definition Audio/Export.h:42
Types.h
sfSoundRecorder
struct sfSoundRecorder sfSoundRecorder
Definition Audio/Types.h:31
SoundChannel.h
sfSoundChannel
sfSoundChannel
Types of sound channels that can be read/written from sound buffers/files.
Definition SoundChannel.h:39
sfSoundRecorder_create
sfSoundRecorder * sfSoundRecorder_create(sfSoundRecorderStartCallback onStart, sfSoundRecorderProcessCallback onProcess, sfSoundRecorderStopCallback onStop, void *userData)
Construct a new sound recorder from callback functions.
sfSoundRecorder_setDevice
bool sfSoundRecorder_setDevice(sfSoundRecorder *soundRecorder, const char *name)
Set the audio capture device.
sfSoundRecorder_isAvailable
bool sfSoundRecorder_isAvailable(void)
Check if the system supports audio capture.
sfSoundRecorder_getDevice
const char * sfSoundRecorder_getDevice(sfSoundRecorder *soundRecorder)
Get the name of the current audio capture device.
sfSoundRecorder_destroy
void sfSoundRecorder_destroy(const sfSoundRecorder *soundRecorder)
Destroy a sound recorder.
sfSoundRecorder_stop
void sfSoundRecorder_stop(sfSoundRecorder *soundRecorder)
Stop the capture of a sound recorder.
sfSoundRecorder_setChannelCount
void sfSoundRecorder_setChannelCount(sfSoundRecorder *soundRecorder, unsigned int channelCount)
Set the channel count of the audio capture device.
sfSoundRecorder_getAvailableDevices
const char *const * sfSoundRecorder_getAvailableDevices(size_t *count)
Get a list of the names of all available audio capture devices.
sfSoundRecorder_start
bool sfSoundRecorder_start(sfSoundRecorder *soundRecorder, unsigned int sampleRate)
Start the capture of a sound recorder.
sfSoundRecorder_getSampleRate
unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder *soundRecorder)
Get the sample rate of a sound recorder.
sfSoundRecorder_getDefaultDevice
const char * sfSoundRecorder_getDefaultDevice(void)
Get the name of the default audio capture device.
sfSoundRecorderStopCallback
void(* sfSoundRecorderStopCallback)(void *)
Type of the callback used when stopping a capture.
Definition SoundRecorder.h:41
sfSoundRecorder_getChannelCount
unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder *soundRecorder)
Get the number of channels used by this recorder.
sfSoundRecorderStartCallback
bool(* sfSoundRecorderStartCallback)(void *)
Type of the callback used when starting a capture.
Definition SoundRecorder.h:39
sfSoundRecorderProcessCallback
bool(* sfSoundRecorderProcessCallback)(const int16_t *, size_t, void *)
Type of the callback used to process audio data.
Definition SoundRecorder.h:40
sfSoundRecorder_getChannelMap
sfSoundChannel * sfSoundRecorder_getChannelMap(const sfSoundRecorder *soundRecorder, size_t *count)
Get the map of position in sample frame to sound channel.
Time.h