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