Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukasbanana/acousticslib
Simple Cross Platform Audio Library
https://github.com/lukasbanana/acousticslib
audio ogg ogg-vorbis openal sound xaudio2
Last synced: 2 months ago
JSON representation
Simple Cross Platform Audio Library
- Host: GitHub
- URL: https://github.com/lukasbanana/acousticslib
- Owner: LukasBanana
- License: bsd-3-clause
- Created: 2016-07-15T21:27:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-01T20:13:12.000Z (over 2 years ago)
- Last Synced: 2023-02-26T03:55:55.866Z (almost 2 years ago)
- Topics: audio, ogg, ogg-vorbis, openal, sound, xaudio2
- Language: C++
- Homepage:
- Size: 2.38 MB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
AcousticsLib
============This project provides a simple and cross-platform audio library for modern C++11.
Overview
--------- **Version**: 1.00 Alpha
- **License**: [3-Clause BSD License](https://github.com/LukasBanana/AcousticsLib/blob/master/LICENSE.txt)
- **Documentation**: [AcousticsLib Docu.pdf](https://github.com/LukasBanana/AcousticsLib/blob/master/docu/AcousticsLib%20Docu.pdf)Dependencies
------------Using this library requires the [GaussianLib](https://github.com/LukasBanana/GaussianLib)
Building this library requires the [OpenAL SDK](http://openal.org/), and optionally the [Ogg-Vorbis](http://www.vorbis.com/) libraries
Supported Platforms
-------------------| Platform | OpenAL | XAudio2 |
|----------|:------:|:-------:|
| **Windows Vista/ 7/ 8/ 10** | :heavy_check_mark: | :heavy_check_mark: |
| **Mac OS X** | :heavy_check_mark: | N/A |
| **Linux** | :heavy_check_mark: | N/A |Supported File Formats
----------------------| Format | File Extensions | Read Support | Write Support |
|--------|---------|:------------:|:-------------:|
| Waveform Audio File Format | **WAV** | :heavy_check_mark: | :heavy_check_mark: |
| Audio Interchange File Format | **AIFF**, **AIFC** | :heavy_check_mark: | :heavy_multiplication_x: |
| Ogg-Vorbis | **OGG** | :heavy_check_mark: | :heavy_multiplication_x: |Audio Engines
-------------- **OpenAL** *(in progress)*
Getting Started
---------------Play a sound with less code as possible:
```cpp
#includeint main()
{
// Load default audio system module
auto audioSystem = Ac::AudioSystem::Load();// Play sound with 100% volume
audioSystem->Play("mySound.wav");// Wait for user input
int i = 0;
std::cin >> i;return 0;
}
```Play a sound by choosing a module:
```cpp
#include
#include
#include
#includeint main()
{
// If an audio system is not available, dynamically catch the
// exception an load another audio system, e.g. when "XAudio2"
// is not available due to a missing DirectX version on a Windows platform.
for (auto module : Ac::AudioSystem::FindModules())
{
try
{
// Load audio system from shared library
auto audioSystem = Ac::AudioSystem::Load(module);std::cout
<< "Audio System: \" << audioSystem->GetName() << "\""
<< ", Version: " << audioSystem->GetVersion() <<
std::endl;if (auto sound = audioSystem->LoadSound("mySound.wav"))
{
sound->SetVolume(0.5f); // set volume to 50%
sound->SetPitch(1.5f); // play with 1.5x frequency (or speed)
sound->Play(); // play soundwhile (sound->IsPlaying())
{
// Wait while sound is playing and show current seek position (in seconds)
std::cout << "Playing: " << sound->GetSeek() << std::end;// Wait a moment
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}// Break out from loop, we only need one single audio system
break;
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
return 0;
}
```