2 # create win32 source for OpenAL on-demand loading from AL API definitions
3 # a set of defines al* -> idal*
4 # typedefs and code pointer functions definition
6 # 1: get linking with no OpenAL DLL link in anymore
7 # i.e. have the defines and the code pointer working
13 [ 'ALenum', 'alGetError', 'ALvoid' ],
14 [ 'ALvoid', 'alGenBuffers', 'ALsizei', 'ALuint *' ],
15 [ 'ALboolean', 'alIsSource', 'ALuint' ],
16 [ 'ALvoid', 'alSourceStop', 'ALuint' ],
17 [ 'ALvoid', 'alGetSourcei', 'ALuint', 'ALenum', 'ALint *' ],
18 [ 'ALint', 'alGetInteger', 'ALenum' ],
19 [ 'ALCvoid', 'alcSuspendContext', 'ALCcontext *' ],
20 [ 'ALCboolean', 'alcMakeContextCurrent', 'ALCcontext *' ],
21 [ 'ALCvoid', 'alcProcessContext', 'ALCcontext *' ],
22 [ 'ALCvoid', 'alcDestroyContext', 'ALCcontext *' ],
23 [ 'ALCubyte *', 'alcGetString', 'ALCdevice *', 'ALCenum' ],
24 [ 'ALvoid', 'alBufferData', 'ALuint', 'ALenum', 'ALvoid *', 'ALsizei', 'ALsizei' ],
25 [ 'ALvoid', 'alDeleteBuffers', 'ALsizei', 'ALuint *' ],
26 [ 'ALboolean', 'alIsExtensionPresent', 'ALubyte *' ],
27 [ 'ALvoid', 'alDeleteSources', 'ALsizei', 'ALuint *' ],
28 [ 'ALenum', 'alGetEnumValue', 'ALubyte *' ],
29 [ 'ALvoid *', 'alGetProcAddress', 'ALubyte *' ],
30 [ 'ALCcontext *', 'alcCreateContext', 'ALCdevice *', 'ALCint *' ],
31 [ 'ALCdevice *', 'alcOpenDevice', 'ALubyte *' ],
32 [ 'ALvoid', 'alListenerfv', 'ALenum', 'ALfloat*' ],
33 [ 'ALvoid', 'alSourceQueueBuffers', 'ALuint', 'ALsizei', 'ALuint *' ],
34 [ 'ALvoid', 'alSourcei', 'ALuint', 'ALenum', 'ALint' ],
35 [ 'ALvoid', 'alListenerf', 'ALenum', 'ALfloat' ],
36 [ 'ALCvoid', 'alcCloseDevice', 'ALCdevice *' ],
37 [ 'ALboolean', 'alIsBuffer', 'ALuint' ],
38 [ 'ALvoid', 'alSource3f', 'ALuint', 'ALenum', 'ALfloat', 'ALfloat', 'ALfloat' ],
39 [ 'ALvoid', 'alGenSources', 'ALsizei', 'ALuint *' ],
40 [ 'ALvoid', 'alSourcef', 'ALuint', 'ALenum', 'ALfloat' ],
41 [ 'ALvoid', 'alSourceUnqueueBuffers', 'ALuint', 'ALsizei', 'ALuint *' ],
42 [ 'ALvoid', 'alSourcePlay', 'ALuint' ],
45 def warningHeader( f ):
46 f.write( '// generated header. do not edit\n' )
47 f.write( '// ' + __file__ + '\n' )
48 f.write( '// ' + time.asctime() + '\n\n' )
50 def genIDALFunc( f, declare ):
56 f.write( extern + func[0] + ' ( ALAPIENTRY * id' + func[1] + ' )( ' )
58 while ( i < len( func ) ):
66 f.write( ' ) = NULL;\n' )
68 def genDefineMapping( f ):
71 f.write( '#define %s id%s\n' % ( fname, fname ) )
76 cast = func[0] + ' ( ALAPIENTRY * ) ( '
78 while ( i < len( func ) ):
85 f.write( 'id' + func[1] + ' = ( ' + cast + ' )GetProcAddress( h, "' + func[1] + '" );\n' )
86 f.write( 'if ( !id' + func[1] + ') {\n return "' + func[1] + '";\n}\n' )
88 if __name__ == '__main__':
89 f = open( 'idal.h', 'w' )
91 genIDALFunc( f, True )
95 f = open( 'idal.cpp', 'w' )
97 genIDALFunc( f, False )
99 f.write( 'const char* InitializeIDAL( HMODULE h ) {\n' )
101 f.write( 'return NULL;\n' );