Nice hustle, tons-o-fun! Next time, eat a salad!
SALAD is an OpenAL loader library which is made specifically to avoid any licensing issues caused by OpenAL-soft being licensed under LGPL.
SALAD is named after GLAD just because I thought it would be funny.
In order to use SALAD you need a working ANSI C compiler with extensions (Visual C/C++ and GNU C extensions are supported so far).
You can just copy files in yours source tree, then add salad.c
as a source and append a new directory to the include path.
git submodule add https://github.com/undnull/salad.git
add_subdirectory(salad)
- OPTIONAL:
set(SALAD_PARANOID OFF CACHE BOOL "" FORCE)
- OPTIONAL:
set(SALAD_EXAMPLES OFF CACHE BOOL "" FORCE)
target_link_libraries(my_engine salad)
I wrote all the headers (myself with a bit of help from regular expressions) based on OpenAL-soft ones but using SALAD's header. So the entirety of this repo is licensed under Simplified BSD license (see LICENSE for details).
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/salad.h>
#include <stddef.h>
int main(void)
{
if(!saladLoadAL())
return 1;
ALCdevice *dev = alcOpenDevice(NULL);
// ....
return 0;
}
I was writing this in order to implement a better sound system for my Source Engine mod/game so this one is probably reasonable:
#include "AL/al.h"
#include "AL/alc.h"
#include "AL/salad.h"
#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()
{
if(!saladLoadALFunc(SALAD_LoadFunc, NULL)) {
// Crash the game?
return false;
}
ALCdevice *dev = alcOpenDevice(NULL);
// ...
return true;
}