From fa6f5b81ae04797226d2c31a53a9594c2d79e2c5 Mon Sep 17 00:00:00 2001 From: nkorslund Date: Fri, 11 Jul 2008 22:23:37 +0000 Subject: [PATCH] Fixed non-AL stuff from Chris git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@19 ea6a568a-9f4f-0410-981a-c910a81bb256 --- Makefile | 2 +- bsa/bsafile.d | 2 +- core/inifile.d | 2 +- core/resource.d | 34 ------ esm/filereader.d | 7 +- esm/loadgmst.d | 1 + monster/util/aa.d | 1 + nif/data.d | 4 +- nif/niffile.d | 4 +- nif/node.d | 2 +- ogre/bindings.d | 23 ---- ogre/cpp_interface.cpp | 96 ---------------- sound/al.d | 244 +++++++++++++++++++++++++++++++++++++++++ sound/alc.d | 90 +++++++++++++++ util/random.d | 2 +- 15 files changed, 349 insertions(+), 165 deletions(-) create mode 100644 sound/al.d create mode 100644 sound/alc.d diff --git a/Makefile b/Makefile index effec6648..0773eca9f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Compiler settings CXX?= g++ -CXXFLAGS?= +CXXFLAGS?= -Wall -g # Compiler settings for Ogre + OIS. Change as needed. OGCC=$(CXX) $(CXXFLAGS) `pkg-config --cflags OGRE OIS` diff --git a/bsa/bsafile.d b/bsa/bsafile.d index 53dda3b70..8e57a869c 100644 --- a/bsa/bsafile.d +++ b/bsa/bsafile.d @@ -177,7 +177,7 @@ class BSAFile */ assert(!isLoaded); - uint fsize = mmf.length; + ulong fsize = mmf.length; if( fsize < 12 ) fail("File too small to be a valid BSA archive"); diff --git a/core/inifile.d b/core/inifile.d index b6e61eada..fa3c7434f 100644 --- a/core/inifile.d +++ b/core/inifile.d @@ -186,7 +186,7 @@ struct IniReader { char[] value; if(vars.inList(SecVar(sec,var), value)) - return atoi(value); + return cast(int)atoi(value); else return def; } diff --git a/core/resource.d b/core/resource.d index 5b622c3f6..67752bd9f 100644 --- a/core/resource.d +++ b/core/resource.d @@ -368,28 +368,6 @@ struct ResourceManager // mem } - // Inserts a texture into ogre. Currently it only supports BSA - // textures, will later support textures in the file system. OGRE is - // able to load these itself, so in that case we can IIRC do - // nothing. The tex pointer points to an already existing Texture* - // resource in C++. - void loadTexture(TextureIndex ti, void *tex) - in - { - assert(ti.isLoaded); - assert(!ti.isEmpty); - } - body - { - assert(0, "This function is no longer in use"); - - void[] s = archives[ti.bsaFile].findSlice(ti.bsaIndex); - - // Insert it into ogre. Note that we are actually being called - // from a manual loader at this point, this just dumps the texture - // data into an existing OGRE resource. - cpp_loadMemImage(ti.name.ptr, ti.type.ptr, s.ptr, s.length, tex); - } } struct SoundResource @@ -472,18 +450,6 @@ struct TextureResource public: - // Insert the texture resource into OGRE. THIS IS NO LONGER NEEDED. - void load() - in - { - assert(!isEmpty()); - } - body - { - writefln("still calling TextureResource.load"); - if(ml == null) ml = cpp_createTexture(name.ptr, this); - } - char[] getName() { return name; } char[] getNewName() { return newName; } diff --git a/esm/filereader.d b/esm/filereader.d index 3683dd6ad..01666c9c2 100644 --- a/esm/filereader.d +++ b/esm/filereader.d @@ -86,12 +86,13 @@ enum Version { Unknown, v12, v13 } struct TES3FileContext { char[] filename; - uint leftFile, leftRec, leftSub; + uint leftRec, leftSub; + size_t leftFile; NAME recName, subName; FileType type; Version ver; - ulong filepos; + size_t filepos; } /** @@ -205,7 +206,7 @@ struct TES3File { if(filename != c.filename) openFile(c.filename, r); - file.seekSet(c.filepos); + file.seekSet(cast(long)c.filepos); // File is now open, copy state information filename = c.filename; diff --git a/esm/loadgmst.d b/esm/loadgmst.d index 213cf6613..c3455463c 100644 --- a/esm/loadgmst.d +++ b/esm/loadgmst.d @@ -227,6 +227,7 @@ struct GameSetting else if(type == VarType.Float) return format(f); else if(type == VarType.String) return str; else if(type == VarType.None) return "(no value)"; + assert(0); } void load() diff --git a/monster/util/aa.d b/monster/util/aa.d index 90b8f6c10..fbb37819c 100644 --- a/monster/util/aa.d +++ b/monster/util/aa.d @@ -367,6 +367,7 @@ struct HashTable(Key, Value, Alloc = GCAlloc, Hash = DefHash, return old; } fail("Failed to replace key '%s', not found", k); + assert(0); } // Remove key, return value. If key does not exist, throw an diff --git a/nif/data.d b/nif/data.d index 3e639e333..0b876c602 100644 --- a/nif/data.d +++ b/nif/data.d @@ -167,7 +167,7 @@ class NiAutoNormalParticlesData : ShapeData debug(verbose) writef("Active vertices: "); // Number of active vertices (always matches count?) - activeCount = nifFile.wgetUshortIs(vertices.length/3); + activeCount = nifFile.wgetUshortIs(cast(ushort)vertices.length/3); nifFile.wgetFloat(); // Active radius (?) nifFile.wgetShort(); // Number of valid entries in the following arrays @@ -522,7 +522,7 @@ class NiTriShapeData : ShapeData { super.read(); - ushort verts = vertices.length/3; + ushort verts = cast(ushort)(vertices.length/3); short tris = nifFile.getShort; debug(verbose) writefln("Number of faces: ", tris); diff --git a/nif/niffile.d b/nif/niffile.d index 1b28e9ae0..e05f4e766 100644 --- a/nif/niffile.d +++ b/nif/niffile.d @@ -117,7 +117,7 @@ struct NIFFile recObj = null; } - long size() + ulong size() in { if(f is null) fail("Cannot get size, file is not open"); @@ -129,7 +129,7 @@ struct NIFFile bool eof() { return f.eof(); } - void seekCur(ulong skip) + void seekCur(long skip) in { if(f is null) fail("Cannot seek, file is not open"); diff --git a/nif/node.d b/nif/node.d index 639961583..b4e7842f8 100644 --- a/nif/node.d +++ b/nif/node.d @@ -64,7 +64,7 @@ abstract class Node : Named { super.read(); - flags = nifFile.getShort(); + flags = nifFile.getUshort(); nifFile.getTransformation(trafo); debug(verbose) diff --git a/ogre/bindings.d b/ogre/bindings.d index 52cc097ae..e09041903 100644 --- a/ogre/bindings.d +++ b/ogre/bindings.d @@ -79,20 +79,6 @@ void cpp_startRendering(); // Cleans up after ogre void cpp_cleanup(); -// Create a manual loader for textures -ManualLoader cpp_createTexture( - char* name, // Resource name - TextureIndex ti); // Texture index - -// Inserts texture from memory data. This isn't used anymore and will -// be removed. -void cpp_loadMemImage( - char* name, // Name to give the resource - char* type, // Image type (eg. "dds") - void* data, // Pointer to file data - uint size, // Size - void* texture); // Texture resource - // Gets a child SceneNode from the root node, then detatches it to // hide it from view. Used for creating the "template" node associated // with a NIF mesh. @@ -162,12 +148,3 @@ void cpp_moveCameraRel(float x, float y, float z); // Do some debug action. Check the menu for today's specials! void cpp_debug(int i); - -// CALLBACKS: - -// Called when a texture wants to be loaded. Not used anymore. -void d_loadTexture(TextureIndex ti, void *tex) -{ - assert(0); - resources.loadTexture(ti, tex); -} diff --git a/ogre/cpp_interface.cpp b/ogre/cpp_interface.cpp index 13f70a883..65963b2df 100644 --- a/ogre/cpp_interface.cpp +++ b/ogre/cpp_interface.cpp @@ -603,102 +603,6 @@ extern "C" SceneNode* cpp_createNode( return node; } -// Callback to make D insert a texture. -extern "C" void d_loadTexture(void* tl, Resource *r); - -// Manual loader for textures -class TextureLoader : public ManualResourceLoader -{ - void *textureIndex; - -public: - - TextureLoader(char* name, void* ti) : textureIndex(ti) - { createTexture(name); } - ~TextureLoader() {} - - void createTexture(char *name) - { - // Completely disable these textures for now. - - return; - // Create a manually loaded texture. Dimensions etc are dummy - // values that will be overwritten later. - TexturePtr texture = TextureManager::getSingleton().createManual - ( - name, // Name - "General", // Group - TEX_TYPE_2D, // Texture type - 1, 1, // Dimensions - 0, // Mipmaps - //PF_DXT1, // Pixel format - PF_UNKNOWN, // Pixel format - TU_DEFAULT, - this); - - // Now unload this dummy image. This forces the image to be - // reloaded when needed. - texture->unload(); - } - - void loadResource(Resource *resource) - { - // This makes the D code insert the image. - d_loadTexture(textureIndex, resource); - } -}; - -// Create a new manually loaded texture, and return the manual loader -extern "C" TextureLoader *cpp_createTexture( - char *name, - void *textureIndex) -{ - return new TextureLoader(name, textureIndex); -} - -int hasLoad = 0; - -extern "C" void cpp_loadMemImage( - char* name, // Name to give the resource - char* type, // Image type (eg. "dds") - void* data, // Pointer to file data - uint32_t size,// Size - Texture* txt)// Texture -{ - - DataStreamPtr m(new MemoryDataStream(name, data, size)); - Image i; - i.load(m, type); - - txt->setHeight(i.getHeight()); - txt->setWidth(i.getWidth()); - std::cout << "New width: " << txt->getWidth() - << " source: " << txt->getSrcWidth() << "\n"; - - // _loadImages requires a list of image pointers - ConstImagePtrList lst(1, &i); - txt->_loadImages(lst); - - /* - if(hasLoad != 15) - { - hasLoad = 15; - - std::cout << "cpp_loadMemImage: name=" << name << " type=" << type - << " data size=" << size << "\n"; - std::cout << "Data stream size=" << m->size() << "\n"; - std::cout << "Image: buffer size=" << i.getSize() << " dimensions=" - << i.getWidth() << "x" << i.getHeight() << " mipmaps=" - << i.getNumMipmaps() << "\n"; - std::cout << "Image format: " << i.getFormat() << "\n"; - - //const char* filename = "output.png"; - //i.save(filename); - //std::cout << "Saved file to " << filename << "\n"; - } - */ -} - /* Code currently not in use // We need this later for animated meshes. Boy will this be a mess. diff --git a/sound/al.d b/sound/al.d new file mode 100644 index 000000000..7ad5af98b --- /dev/null +++ b/sound/al.d @@ -0,0 +1,244 @@ +extern(System): + +//Defines +const int AL_NONE = 0; + +const int AL_FALSE = 0; +const int AL_TRUE = 1; + +const int AL_SOURCE_RELATIVE = 0x202; +const int AL_CONE_INNER_ANGLE = 0x1001; +const int AL_CONE_OUTER_ANGLE = 0x1002; +const int AL_PITCH = 0x1003; +const int AL_POSITION = 0x1004; +const int AL_DIRECTION = 0x1005; +const int AL_VELOCITY = 0x1006; +const int AL_LOOPING = 0x1007; +const int AL_BUFFER = 0x1009; +const int AL_GAIN = 0x100A; +const int AL_MIN_GAIN = 0x100D; +const int AL_MAX_GAIN = 0x100E; +const int AL_ORIENTATION = 0x100F; +const int AL_SOURCE_STATE = 0x1010; +const int AL_INITIAL = 0x1011; +const int AL_PLAYING = 0x1012; +const int AL_PAUSED = 0x1013; +const int AL_STOPPED = 0x1014; +const int AL_BUFFERS_QUEUED = 0x1015; +const int AL_BUFFERS_PROCESSED = 0x1016; +const int AL_SEC_OFFSET = 0x1024; +const int AL_SAMPLE_OFFSET = 0x1025; +const int AL_BYTE_OFFSET = 0x1026; +const int AL_SOURCE_TYPE = 0x1027; +const int AL_STATIC = 0x1028; +const int AL_STREAMING = 0x1029; +const int AL_UNDETERMINED = 0x1030; + +const int AL_FORMAT_MONO8 = 0x1100; +const int AL_FORMAT_MONO16 = 0x1101; +const int AL_FORMAT_STEREO8 = 0x1102; +const int AL_FORMAT_STEREO16 = 0x1103; + +const int AL_REFERENCE_DISTANCE = 0x1020; +const int AL_ROLLOFF_FACTOR = 0x1021; +const int AL_CONE_OUTER_GAIN = 0x1022; +const int AL_MAX_DISTANCE = 0x1023; +const int AL_FREQUENCY = 0x2001; +const int AL_BITS = 0x2002; +const int AL_CHANNELS = 0x2003; +const int AL_SIZE = 0x2004; +const int AL_UNUSED = 0x2010; +const int AL_PENDING = 0x2011; +const int AL_PROCESSED = 0x2012; + +const int AL_NO_ERROR = AL_FALSE; +const int AL_INVALID_NAME = 0xA001; +const int AL_INVALID_ENUM = 0xA002; +const int AL_INVALID_VALUE = 0xA003; +const int AL_INVALID_OPERATION = 0xA004; +const int AL_OUT_OF_MEMORY = 0xA005; + +const int AL_VENDOR = 0xB001; +const int AL_VERSION = 0xB002; +const int AL_RENDERER = 0xB003; +const int AL_EXTENSIONS = 0xB004; + +const int AL_DOPPLER_FACTOR = 0xC000; +const int AL_DOPPLER_VELOCITY = 0xC001; +const int AL_SPEED_OF_SOUND = 0xC003; + +const int AL_DISTANCE_MODEL = 0xD000; +const int AL_INVERSE_DISTANCE = 0xD001; +const int AL_INVERSE_DISTANCE_CLAMPED = 0xD002; +const int AL_LINEAR_DISTANCE = 0xD003; +const int AL_LINEAR_DISTANCE_CLAMPED = 0xD004; +const int AL_EXPONENT_DISTANCE = 0xD005; +const int AL_EXPONENT_DISTANCE_CLAMPED = 0xD006; + +//Typedefs +alias char ALboolean; +alias char ALchar; +alias char ALbyte; +alias ubyte ALubyte; +alias short ALshort; +alias ushort ALushort; +alias int ALint; +alias uint ALuint; +alias int ALsizei; +alias int ALenum; +alias float ALfloat; +alias double ALdouble; +alias void ALvoid; + +//AL Functions +void alEnable( ALenum capability ); +void alDisable( ALenum capability ); +ALboolean alIsEnabled( ALenum capability ); +ALchar* alGetString( ALenum param ); +void alGetBooleanv( ALenum param, ALboolean* data ); +void alGetIntegerv( ALenum param, ALint* data ); +void alGetFloatv( ALenum param, ALfloat* data ); +void alGetDoublev( ALenum param, ALdouble* data ); +ALboolean alGetBoolean( ALenum param ); +ALint alGetInteger( ALenum param ); +ALfloat alGetFloat( ALenum param ); +ALdouble alGetDouble( ALenum param ); +ALenum alGetError(); +ALboolean alIsExtensionPresent( ALchar* extname ); +void* alGetProcAddress( ALchar* fname ); +ALenum alGetEnumValue( ALchar* ename ); + +void alListenerf( ALenum param, ALfloat value ); +void alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +void alListenerfv( ALenum param, ALfloat* values ); +void alListeneri( ALenum param, ALint value ); +void alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 ); +void alListeneriv( ALenum param, ALint* values ); + +void alGetListenerf( ALenum param, ALfloat* value ); +void alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); +void alGetListenerfv( ALenum param, ALfloat* values ); +void alGetListeneri( ALenum param, ALint* value ); +void alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); +void alGetListeneriv( ALenum param, ALint* values ); + +void alGenSources( ALsizei n, ALuint* sources ); +void alDeleteSources( ALsizei n, ALuint* sources ); +ALboolean alIsSource( ALuint sid ); +void alSourcef( ALuint sid, ALenum param, ALfloat value ); +void alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +void alSourcefv( ALuint sid, ALenum param, ALfloat* values ); +void alSourcei( ALuint sid, ALenum param, ALint value ); +void alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); +void alSourceiv( ALuint sid, ALenum param, ALint* values ); +void alGetSourcef( ALuint sid, ALenum param, ALfloat* value ); +void alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +void alGetSourcefv( ALuint sid, ALenum param, ALfloat* values ); +void alGetSourcei( ALuint sid, ALenum param, ALint* value ); +void alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +void alGetSourceiv( ALuint sid, ALenum param, ALint* values ); +void alSourcePlayv( ALsizei ns, ALuint *sids ); +void alSourceStopv( ALsizei ns, ALuint *sids ); +void alSourceRewindv( ALsizei ns, ALuint *sids ); +void alSourcePausev( ALsizei ns, ALuint *sids ); +void alSourcePlay( ALuint sid ); +void alSourceStop( ALuint sid ); +void alSourceRewind( ALuint sid ); +void alSourcePause( ALuint sid ); +void alSourceQueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids ); +void alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids ); + +void alGenBuffers( ALsizei n, ALuint* buffers ); +void alDeleteBuffers( ALsizei n, ALuint* buffers ); +ALboolean alIsBuffer( ALuint bid ); +void alBufferData( ALuint bid, ALenum format, ALvoid* data, ALsizei size, ALsizei freq ); +void alBufferf( ALuint bid, ALenum param, ALfloat value ); +void alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +void alBufferfv( ALuint bid, ALenum param, ALfloat* values ); +void alBufferi( ALuint bid, ALenum param, ALint value ); +void alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); +void alBufferiv( ALuint bid, ALenum param, ALint* values ); +void alGetBufferf( ALuint bid, ALenum param, ALfloat* value ); +void alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +void alGetBufferfv( ALuint bid, ALenum param, ALfloat* values ); +void alGetBufferi( ALuint bid, ALenum param, ALint* value ); +void alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +void alGetBufferiv( ALuint bid, ALenum param, ALint* values ); +void alDopplerFactor( ALfloat value ); +void alDopplerVelocity( ALfloat value ); +void alSpeedOfSound( ALfloat value ); +void alDistanceModel( ALenum distanceModel ); + +typedef void ( *LPALENABLE)( ALenum capability ); +typedef void ( *LPALDISABLE)( ALenum capability ); +typedef ALboolean ( *LPALISENABLED)( ALenum capability ); +typedef const ALchar* ( *LPALGETSTRING)( ALenum param ); +typedef void ( *LPALGETBOOLEANV)( ALenum param, ALboolean* data ); +typedef void ( *LPALGETINTEGERV)( ALenum param, ALint* data ); +typedef void ( *LPALGETFLOATV)( ALenum param, ALfloat* data ); +typedef void ( *LPALGETDOUBLEV)( ALenum param, ALdouble* data ); +typedef ALboolean ( *LPALGETBOOLEAN)( ALenum param ); +typedef ALint ( *LPALGETINTEGER)( ALenum param ); +typedef ALfloat ( *LPALGETFLOAT)( ALenum param ); +typedef ALdouble ( *LPALGETDOUBLE)( ALenum param ); +typedef ALenum ( *LPALGETERROR)(); +typedef ALboolean ( *LPALISEXTENSIONPRESENT)(ALchar* extname ); +typedef void* ( *LPALGETPROCADDRESS)( ALchar* fname ); +typedef ALenum ( *LPALGETENUMVALUE)( ALchar* ename ); +typedef void ( *LPALLISTENERF)( ALenum param, ALfloat value ); +typedef void ( *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void ( *LPALLISTENERFV)( ALenum param, ALfloat* values ); +typedef void ( *LPALLISTENERI)( ALenum param, ALint value ); +typedef void ( *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void ( *LPALLISTENERIV)( ALenum param, ALint* values ); +typedef void ( *LPALGETLISTENERF)( ALenum param, ALfloat* value ); +typedef void ( *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); +typedef void ( *LPALGETLISTENERFV)( ALenum param, ALfloat* values ); +typedef void ( *LPALGETLISTENERI)( ALenum param, ALint* value ); +typedef void ( *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); +typedef void ( *LPALGETLISTENERIV)( ALenum param, ALint* values ); +typedef void ( *LPALGENSOURCES)( ALsizei n, ALuint* sources ); +typedef void ( *LPALDELETESOURCES)( ALsizei n, ALuint* sources ); +typedef ALboolean ( *LPALISSOURCE)( ALuint sid ); +typedef void ( *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value); +typedef void ( *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void ( *LPALSOURCEFV)( ALuint sid, ALenum param, ALfloat* values ); +typedef void ( *LPALSOURCEI)( ALuint sid, ALenum param, ALint value); +typedef void ( *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void ( *LPALSOURCEIV)( ALuint sid, ALenum param, ALint* values ); +typedef void ( *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value ); +typedef void ( *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +typedef void ( *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values ); +typedef void ( *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value ); +typedef void ( *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +typedef void ( *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values ); +typedef void ( *LPALSOURCEPLAYV)( ALsizei ns, ALuint *sids ); +typedef void ( *LPALSOURCESTOPV)( ALsizei ns, ALuint *sids ); +typedef void ( *LPALSOURCEREWINDV)( ALsizei ns, ALuint *sids ); +typedef void ( *LPALSOURCEPAUSEV)( ALsizei ns, ALuint *sids ); +typedef void ( *LPALSOURCEPLAY)( ALuint sid ); +typedef void ( *LPALSOURCESTOP)( ALuint sid ); +typedef void ( *LPALSOURCEREWIND)( ALuint sid ); +typedef void ( *LPALSOURCEPAUSE)( ALuint sid ); +typedef void ( *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids ); +typedef void ( *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids ); +typedef void ( *LPALGENBUFFERS)( ALsizei n, ALuint* buffers ); +typedef void ( *LPALDELETEBUFFERS)( ALsizei n, ALuint* buffers ); +typedef ALboolean ( *LPALISBUFFER)( ALuint bid ); +typedef void ( *LPALBUFFERDATA)( ALuint bid, ALenum format, ALvoid* data, ALsizei size, ALsizei freq ); +typedef void ( *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value); +typedef void ( *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void ( *LPALBUFFERFV)( ALuint bid, ALenum param, ALfloat* values ); +typedef void ( *LPALBUFFERI)( ALuint bid, ALenum param, ALint value); +typedef void ( *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void ( *LPALBUFFERIV)( ALuint bid, ALenum param, ALint* values ); +typedef void ( *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value ); +typedef void ( *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +typedef void ( *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values ); +typedef void ( *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value ); +typedef void ( *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +typedef void ( *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values ); +typedef void ( *LPALDOPPLERFACTOR)( ALfloat value ); +typedef void ( *LPALDOPPLERVELOCITY)( ALfloat value ); +typedef void ( *LPALSPEEDOFSOUND)( ALfloat value ); +typedef void ( *LPALDISTANCEMODEL)( ALenum distanceModel ); diff --git a/sound/alc.d b/sound/alc.d new file mode 100644 index 000000000..9aa75d7c6 --- /dev/null +++ b/sound/alc.d @@ -0,0 +1,90 @@ +extern(System): + +//Definitions +const int ALC_FALSE = 0; +const int ALC_TRUE = 1; + +const int ALC_FREQUENCY = 0x1007; +const int ALC_REFRESH = 0x1008; +const int ALC_SYNC = 0x1009; +const int ALC_MONO_SOURCES = 0x1010; +const int ALC_STEREO_SOURCES = 0x1011; +const int ALC_NO_ERROR = ALC_FALSE; +const int ALC_INVALID_DEVICE = 0xA001; +const int ALC_INVALID_CONTEXT = 0xA002; +const int ALC_INVALID_ENUM = 0xA003; +const int ALC_INVALID_VALUE = 0xA004; +const int ALC_OUT_OF_MEMORY = 0xA005; +const int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004; +const int ALC_DEVICE_SPECIFIER = 0x1005; +const int ALC_EXTENSIONS = 0x1006; +const int ALC_MAJOR_VERSION = 0x1000; +const int ALC_MINOR_VERSION = 0x1001; +const int ALC_ATTRIBUTES_SIZE = 0x1002; +const int ALC_ALL_ATTRIBUTES = 0x1003; + +const int ALC_CAPTURE_DEVICE_SPECIFIER = 0x310; +const int ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311; +const int ALC_CAPTURE_SAMPLES = 0x312; + +//Device and context structures +alias void ALCdevice; +alias void ALCcontext; + +//Typedefs +alias char ALCboolean; +alias char ALCchar; +alias char ALCbyte; +alias ubyte ALCubyte; +alias short ALCshort; +alias ushort ALCushort; +alias int ALCint; +alias uint ALCuint; +alias int ALCsizei; +alias int ALCenum; +alias float ALCfloat; +alias double ALCdouble; +alias void ALCvoid; + +//Context functions +ALCcontext* alcCreateContext( ALCdevice *device, ALCint* attrlist ); +ALCboolean alcMakeContextCurrent( ALCcontext *context ); +void alcProcessContext( ALCcontext *context ); +void alcSuspendContext( ALCcontext *context ); +void alcDestroyContext( ALCcontext *context ); +ALCcontext* alcGetCurrentContext(); +ALCdevice* alcGetContextsDevice( ALCcontext *context ); +ALCdevice * alcOpenDevice( ALCchar *devicename ); +ALCboolean alcCloseDevice( ALCdevice *device ); +ALCenum alcGetError( ALCdevice *device ); +ALCboolean alcIsExtensionPresent( ALCdevice *device, ALCchar *extname ); +void* alcGetProcAddress( ALCdevice *device, ALCchar *funcname ); +ALCenum alcGetEnumValue( ALCdevice *device, ALCchar *enumname ); +ALCchar* alcGetString( ALCdevice *device, ALCenum param ); +void alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data ); +ALCdevice* alcCaptureOpenDevice( ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); +ALCboolean alcCaptureCloseDevice( ALCdevice *device ); +void alcCaptureStart( ALCdevice *device ); +void alcCaptureStop( ALCdevice *device ); +void alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); + +typedef ALCcontext * ( *LPALCCREATECONTEXT) (ALCdevice *device, ALCint *attrlist); +typedef ALCboolean ( *LPALCMAKECONTEXTCURRENT)( ALCcontext *context ); +typedef void ( *LPALCPROCESSCONTEXT)( ALCcontext *context ); +typedef void ( *LPALCSUSPENDCONTEXT)( ALCcontext *context ); +typedef void ( *LPALCDESTROYCONTEXT)( ALCcontext *context ); +typedef ALCcontext * ( *LPALCGETCURRENTCONTEXT)( ); +typedef ALCdevice * ( *LPALCGETCONTEXTSDEVICE)( ALCcontext *context ); +typedef ALCdevice * ( *LPALCOPENDEVICE)( ALCchar *devicename ); +typedef ALCboolean ( *LPALCCLOSEDEVICE)( ALCdevice *device ); +typedef ALCenum ( *LPALCGETERROR)( ALCdevice *device ); +typedef ALCboolean ( *LPALCISEXTENSIONPRESENT)( ALCdevice *device, ALCchar *extname ); +typedef void * ( *LPALCGETPROCADDRESS)(ALCdevice *device, ALCchar *funcname ); +typedef ALCenum ( *LPALCGETENUMVALUE)(ALCdevice *device, ALCchar *enumname ); +typedef const ALCchar* ( *LPALCGETSTRING)( ALCdevice *device, ALCenum param ); +typedef void ( *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest ); +typedef ALCdevice * ( *LPALCCAPTUREOPENDEVICE)( ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); +typedef ALCboolean ( *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device ); +typedef void ( *LPALCCAPTURESTART)( ALCdevice *device ); +typedef void ( *LPALCCAPTURESTOP)( ALCdevice *device ); +typedef void ( *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); diff --git a/util/random.d b/util/random.d index 75853aff3..10685118a 100644 --- a/util/random.d +++ b/util/random.d @@ -112,7 +112,7 @@ class DRand : Random void initialize(long newSeed) { origSeed = newSeed; - rand_seed(newSeed, 0); + rand_seed(cast(uint)newSeed, 0); } alias Random.initialize initialize;