napi_openal
The goal of this library provides OpenAL bindings for node using N-API.
You also need napi_ffmpeg for handling media files.
Supported OS
Currently only macOS but will support others soon.
Installation
brew install SDL2 shivavg openal-soft freealut brew install ffmpeg --enable-libass --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-sdl2
npm install napi_openal
Usage
Open media file using ffmpeg
AV;ic = AV;AVAV; audioStream = AV; audioCtx = AV;AV;
Open audio device using Open AL
// open al handling...aDevice = AL;aContext = AL; // make active contextAL;alSource = AL;AL;AL;AV;
Play audio stream
{ let ret = AV; ifrettype != 1 return; // Prefill all of the buffers let sample_rate = AV; ifa_count < 3 AL; a_count++; ret = retbuffer = null; ifa_count == 3 AL; AL; else let val = 0; /* Check if OpenAL is done with any of the queued buffers */ do val = AL; AV; whileval <= 0; /* Pop the oldest queued buffer from the source, fill it * with the new data, then requeue it */ //let buffer; whileval-- AL; ret = retbuffer = null; /* Make sure the source is still playing, and restart it if needed. */ val = AL; ifval != ALAL_PLAYING AL; }