Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/untodesu/salad
An OpenAL loader
https://github.com/untodesu/salad
openal openal-soft
Last synced: 28 days ago
JSON representation
An OpenAL loader
- Host: GitHub
- URL: https://github.com/untodesu/salad
- Owner: untodesu
- License: bsd-2-clause
- Created: 2021-07-26T15:42:09.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-03T10:11:11.000Z (30 days ago)
- Last Synced: 2025-01-03T11:18:19.581Z (30 days ago)
- Topics: openal, openal-soft
- Language: C
- Homepage:
- Size: 69.3 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SALAD
> _Nice hustle, tons-o-fun! Next time, eat a salad!_SALAD is an OpenAL loader which is made out of frustration with an obvious lack of permissively-licensed OpenAL loaders in the software/game development world. SALAD and all the headers are licensed under Simplified BSD License (see [LICENSE](LICENSE) for the full license text)
### Why SALAD?
Because it's funny. The library is named as an omage to an existing OpenGL loader [GLAD](https://github.com/Dav1dde/glad); if you compare the two loaders, using both to load their respective API functions is very similar and that's intentional.# Usage
## Prerequisites
* A working ISO C90 (ANSI C89) compiler
* A system installation of OpenAL or an OpenAL DLL module## Compiling directly
* Just copy all the headers and `salad.c` into your project's source tree and include them in the build script; everything should world out of the box;
* Make sure to comply with license terms (at least put the license text somewhere, I guess);## Using a CMake subdirectory
```cmake
add_subdirectory(salad)
target_link_libraries(myproject PRIVATE salad)
```## Using default DLL paths
```c
#include
#include
#includeint main(void)
{
if(!saladLoadALdefault())
return 1;ALCdevice *device = alcOpenDevice(NULL);
/* ... */
return 0;
}
```## Using a custom DLL loader (Source SDK)
Initially I created the loader to integrate with Source SDK, so this example might be relevant for those who want to do the same with a better chance of success without burning out:```c++
// In the precompiled header
#include "AL/al.h"
#include "AL/alc.h"
#include "AL/salad.h"// In the C++ source
#include "tier1/interface.h"static CDllDemandLoader al_dll("OpenAL32");
static void *SALAD_LoadFunc(const char *procname, void *arg)
{
return al_dll.GetProcAddress(procname);
}bool InitSomething(void)
{
if(!saladLoadALfunc(&SALAD_LoadFunc, NULL)) {
// Crash the game?
return false;
}ALCdevice *dev = alcOpenDevice(NULL);
// ...return true;
}
```