github.com/gotranspile/cxgo@v0.3.7/libs/openal.go (about)

     1  package libs
     2  
     3  const (
     4  	alH  = "AL/al.h"
     5  	alcH = "AL/alc.h"
     6  )
     7  
     8  func init() {
     9  	RegisterLibrary(alH, func(c *Env) *Library {
    10  		return &Library{
    11  			// TODO
    12  			Header: `
    13  #include <` + BuiltinH + `>
    14  
    15  #define ALvoid void
    16  
    17  typedef unsigned int ALuint;
    18  typedef int ALint;
    19  typedef int ALsizei;
    20  typedef int ALenum;
    21  typedef float ALfloat;
    22  
    23  const int INT16_MIN = 0;
    24  const int INT16_MAX = 0;
    25  
    26  const int AL_NO_ERROR = 0;
    27  const int AL_BUFFERS_PROCESSED = 0;
    28  const int AL_PITCH = 0;
    29  const int AL_GAIN = 0;
    30  const int AL_POSITION = 0;
    31  const int AL_SOURCE_STATE = 0;
    32  const int AL_PLAYING = 0;
    33  const int AL_FORMAT_STEREO16 = 0;
    34  const int AL_FORMAT_MONO16 = 0;
    35  
    36  ALenum alGetError(ALvoid);
    37  
    38  void alGetSourcei(ALuint source, ALenum pname, ALint* value);
    39  void alSourcef(ALuint source, ALenum param, ALfloat value);
    40  void alSourcefv(ALuint source, ALenum param, ALfloat* values);
    41  void alListenerf(ALenum param, ALfloat value);
    42  void alListener3f(ALenum param, ALfloat v1, ALfloat v2, ALfloat v3);
    43  void alGenSources(ALsizei n, ALuint* sources);
    44  void alGenBuffers(ALsizei n, ALuint* buffers);
    45  void alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
    46  void alSourceQueueBuffers(ALuint source, ALsizei n, ALuint* buffers);
    47  void alSourceUnqueueBuffers(ALuint source, ALsizei n, ALuint* buffers);
    48  void alSourcePlay(ALuint source);
    49  void alSourceStop(ALuint source);
    50  `,
    51  		}
    52  	})
    53  	RegisterLibrary(alcH, func(c *Env) *Library {
    54  		return &Library{
    55  			// TODO
    56  			Header: `
    57  #include <` + alH + `>
    58  
    59  typedef int ALCenum;
    60  typedef int ALCint;
    61  typedef char ALCchar;
    62  typedef int ALCboolean;
    63  
    64  typedef struct{} ALCdevice;
    65  typedef struct{} ALCcontext;
    66  
    67  ALCdevice *alcOpenDevice(const ALCchar *devicename);
    68  ALCcontext * alcCreateContext(ALCdevice *device, ALCint* attrlist);
    69  ALCboolean alcMakeContextCurrent(ALCcontext *context);
    70  `,
    71  		}
    72  	})
    73  }