YourGameLib
Loading...
Searching...
No Matches
audio.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_AUDIO_H
21#define YOURGAME_AUDIO_H
22
23#include <string>
24#include <vector>
25
26namespace yourgame
27{
28 namespace audio
29 {
33 int init(int numSources, int numChannels = 0, int sampleRate = 0);
34
38 void shutdown();
39
43 bool isInitialized();
44
48 int storeFile(const std::string &filename);
49
57 int play(const std::string &filename, bool loop = false);
58
65 int stop(int sourceId);
66
74 int pause(int sourceId, bool pause);
75
83 int setChannelGains(int sourceId, const std::vector<float> &gains);
84 } // namespace audio
85} // namespace yourgame
86
87#endif
bool loop
Definition audio.cpp:94
int stop(int sourceId)
stop audio source
Definition audio.cpp:322
bool isInitialized()
check if audio initialized
Definition audio.cpp:242
int init(int numSources, int numChannels=0, int sampleRate=0)
initialize audio
Definition audio.cpp:189
void shutdown()
shutdown audio
Definition audio.cpp:224
int play(const std::string &filename, bool loop=false)
play audio file, that was previously loaded via storeFile()
Definition audio.cpp:266
int pause(int sourceId, bool pause)
pause/unpause audio source
Definition audio.cpp:330
int storeFile(const std::string &filename)
load and store audio file
Definition audio.cpp:247
int setChannelGains(int sourceId, const std::vector< float > &gains)
set gain per channel of an audio source
Definition audio.cpp:353
Definition audio.h:27