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 for the full license text)
Because it's funny. The library is named as an omage to an existing OpenGL loader GLAD; if you compare the two loaders, using both to load their respective API functions is very similar and that's intentional.
- A working ISO C90 (ANSI C89) compiler
- A system installation of OpenAL or an OpenAL DLL module
- 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);
add_subdirectory(salad)
target_link_libraries(myproject PRIVATE salad)
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/salad.h>
int main(void)
{
if(!saladLoadALdefault())
return 1;
ALCdevice *device = alcOpenDevice(NULL);
/* ... */
return 0;
}
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:
// 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;
}