# HG changeset patch # User koda # Date 1280566434 -7200 # Node ID c247dee9e1c0cbf1754b8bbf41cc935cfa0d86f0 # Parent fd8c22a358de23c58940bf98d99eeecaeab29f00 applying smaxx patch where it should be diff -r fd8c22a358de -r c247dee9e1c0 .hgeol --- a/.hgeol Fri Jul 30 13:36:03 2010 +0200 +++ b/.hgeol Sat Jul 31 10:53:54 2010 +0200 @@ -1,7 +1,6 @@ [patterns] **.h = native **.c = native -**.m = native **.cpp = native **.lua = native **.txt = native diff -r fd8c22a358de -r c247dee9e1c0 QTfrontend/game.cpp --- a/QTfrontend/game.cpp Fri Jul 30 13:36:03 2010 +0200 +++ b/QTfrontend/game.cpp Sat Jul 31 10:53:54 2010 +0200 @@ -292,6 +292,7 @@ arguments << config->netNick().toUtf8().toBase64(); arguments << (config->isMusicEnabled() ? "1" : "0"); arguments << (config->isReducedQuality() ? "1" : "0"); + arguments << (config->isStereoEnabled() ? "1" : "0"); return arguments; } diff -r fd8c22a358de -r c247dee9e1c0 QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Fri Jul 30 13:36:03 2010 +0200 +++ b/QTfrontend/gameuiconfig.cpp Sat Jul 31 10:53:54 2010 +0200 @@ -48,6 +48,7 @@ Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr); Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool()); + Form->ui.pageOptions->CBEnableStereo->setChecked(value("video/anaglyph", false).toBool()); Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects); Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool()); Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool()); @@ -116,6 +117,7 @@ setValue("video/fullscreen", vid_Fullscreen()); setValue("video/reducequality", isReducedQuality()); + setValue("video/anaglyph", isStereoEnabled()); setValue("frontend/effects", isFrontendEffects()); @@ -236,6 +238,11 @@ return Form->ui.pageOptions->CBAltDamage->isChecked(); } +bool GameUIConfig::isStereoEnabled() const +{ + return Form->ui.pageOptions->CBEnableStereo->isChecked(); +} + bool GameUIConfig::appendDateTimeToRecordName() { return Form->ui.pageOptions->CBNameWithDate->isChecked(); diff -r fd8c22a358de -r c247dee9e1c0 QTfrontend/gameuiconfig.h --- a/QTfrontend/gameuiconfig.h Fri Jul 30 13:36:03 2010 +0200 +++ b/QTfrontend/gameuiconfig.h Sat Jul 31 10:53:54 2010 +0200 @@ -55,6 +55,7 @@ bool isFrontendFullscreen() const; bool isWeaponTooltip() const; void resizeToConfigValues(); + bool isStereoEnabled() const; #ifdef __APPLE__ #ifdef SPARKLE_ENABLED diff -r fd8c22a358de -r c247dee9e1c0 QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Fri Jul 30 13:36:03 2010 +0200 +++ b/QTfrontend/pages.cpp Sat Jul 31 10:53:54 2010 +0200 @@ -612,6 +612,10 @@ CBReduceQuality->setText(QCheckBox::tr("Reduced quality")); GBAlayout->addWidget(CBReduceQuality); + CBEnableStereo = new QCheckBox(AGGroupBox); + CBEnableStereo->setText(QCheckBox::tr("Anaglyph rendering (red/cyan)")); + GBAlayout->addWidget(CBEnableStereo); + hr = new QFrame(AGGroupBox); hr->setFrameStyle(QFrame::HLine); hr->setLineWidth(3); diff -r fd8c22a358de -r c247dee9e1c0 QTfrontend/pages.h --- a/QTfrontend/pages.h Fri Jul 30 13:36:03 2010 +0200 +++ b/QTfrontend/pages.h Sat Jul 31 10:53:54 2010 +0200 @@ -221,6 +221,7 @@ QComboBox *CBResolution; QCheckBox *CBEnableSound; QCheckBox *CBEnableFrontendSound; + QCheckBox *CBEnableStereo; #ifdef _WIN32 QCheckBox *CBHardwareSound; #endif diff -r fd8c22a358de -r c247dee9e1c0 hedgewars/adler32.pas --- a/hedgewars/adler32.pas Fri Jul 30 13:36:03 2010 +0200 +++ b/hedgewars/adler32.pas Sat Jul 31 10:53:54 2010 +0200 @@ -1,152 +1,152 @@ -unit Adler32; - -{ZLib - Adler32 checksum function} - - -interface - -(************************************************************************* - - DESCRIPTION : ZLib - Adler32 checksum function - - REQUIREMENTS : TP5-7, D1-D7/D9-D10/D12, FPC, VP - - EXTERNAL DATA : --- - - MEMORY USAGE : --- - - DISPLAY MODE : --- - - REFERENCES : RFC 1950 (http://tools.ietf.org/html/rfc1950) - - - Version Date Author Modification - ------- -------- ------- ------------------------------------------ - 0.10 30.08.03 W.Ehrhardt Initial version based on MD5 layout - 2.10 30.08.03 we Common vers., XL versions for Win32 - 2.20 27.09.03 we FPC/go32v2 - 2.30 05.10.03 we STD.INC, TP5.0 - 2.40 10.10.03 we common version, english comments - 3.00 01.12.03 we Common version 3.0 - 3.01 22.05.05 we Adler32UpdateXL (i,n: integer) - 3.02 17.12.05 we Force $I- in Adler32File - 3.03 07.08.06 we $ifdef BIT32: (const fname: shortstring...) - 3.04 10.02.07 we Adler32File: no eof, XL and filemode via $ifdef - 3.05 04.07.07 we BASM16: speed-up factor 15 - 3.06 12.11.08 we uses BTypes, Ptr2Inc and/or Str255 - 3.07 25.04.09 we updated RFC URL(s) - 3.08 19.07.09 we D12 fix: assign with typecast string(fname) -**************************************************************************) - -(*------------------------------------------------------------------------- - (C) Copyright 2002-2009 Wolfgang Ehrhardt - - This software is provided 'as-is', without any express or implied warranty. - In no event will the authors be held liable for any damages arising from - the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software in - a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source distribution. -----------------------------------------------------------------------------*) - -(* -As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need. -That means no btypes, file loading, and the assembly version disabled. -*) - -procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint); - -implementation - -(* -$ifdef BASM16 - -procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint); - //-update Adler32 with Msg data -const - BASE = 65521; // max. prime < 65536 - NMAX = 5552; // max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^32 -type - LH = packed record - L,H: word; - end; -var - s1,s2: longint; - n: integer; -begin - s1 := LH(adler).L; - s2 := LH(adler).H; - while Len > 0 do begin - if Len 0 do begin - if Len 0 do begin + if Len 0 do begin + if Len '') and (ParamStr(2) <> '') then - if (ParamCount <> 3) and (ParamCount <> 18) then + if (ParamCount <> 3) and (ParamCount <> 19) then begin for i:= 0 to 7 do begin @@ -784,7 +786,6 @@ {$ENDIF} {$I+} {$ENDIF} - end; procedure freeModule; diff -r fd8c22a358de -r c247dee9e1c0 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Fri Jul 30 13:36:03 2010 +0200 +++ b/hedgewars/uStore.pas Sat Jul 31 10:53:54 2010 +0200 @@ -39,9 +39,7 @@ rotationQt: GLfloat; wScreen: LongInt; hScreen: LongInt; - framel, framer, depthl, depthr: GLuint; - texl, texr: GLuint; - + procedure initModule; procedure freeModule; @@ -803,15 +801,6 @@ SDL_FreeSurface(MissionIcons); FreeTexture(ropeIconTex); FreeTexture(HHTexture); - if isStereoEnabled then - begin - glDeleteTextures(1, @texl); - glDeleteRenderbuffersEXT(1, @depthl); - glDeleteFramebuffersEXT(1, @framel); - glDeleteTextures(1, @texr); - glDeleteRenderbuffersEXT(1, @depthr); - glDeleteFramebuffersEXT(1, @framer) - end end; @@ -1181,9 +1170,7 @@ {$ENDIF} end; -{$IFDEF IPHONEOS} - cGPUVendor:= gvApple; -{$ELSE} +{$IFNDEF IPHONEOS} if StrPos(Str2PChar(vendor), Str2PChar('nvidia')) <> nil then cGPUVendor:= gvNVIDIA else if StrPos(Str2PChar(vendor), Str2PChar('intel')) <> nil then @@ -1191,43 +1178,8 @@ else if StrPos(Str2PChar(vendor), Str2PChar('ati')) <> nil then cGPUVendor:= gvIntel; //SupportNPOTT:= glLoadExtension('GL_ARB_texture_non_power_of_two'); - - if isStereoEnabled then - begin - // prepare left and right frame buffers and associated textures - glLoadExtension('GL_EXT_framebuffer_object'); - - // left - glGenFramebuffersEXT(1, @framel); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framel); - glGenRenderbuffersEXT(1, @depthl); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthl); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, cScreenWidth, cScreenHeight); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthl); - glGenTextures(1, @texl); - glBindTexture(GL_TEXTURE_2D, texl); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cScreenWidth, cScreenHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texl, 0); - - // right - glGenFramebuffersEXT(1, @framer); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framer); - glGenRenderbuffersEXT(1, @depthr); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthr); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, cScreenWidth, cScreenHeight); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthr); - glGenTextures(1, @texr); - glBindTexture(GL_TEXTURE_2D, texr); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cScreenWidth, cScreenHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texr, 0); - - // reset - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0) - end; +{$ELSE} + cGPUVendor:= gvApple; {$ENDIF} {$IFDEF DEBUGFILE} diff -r fd8c22a358de -r c247dee9e1c0 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Fri Jul 30 13:36:03 2010 +0200 +++ b/hedgewars/uWorld.pas Sat Jul 31 10:53:54 2010 +0200 @@ -22,7 +22,6 @@ interface uses SDLh, uGears, uConsts, uFloat, uRandom; -type TRenderMode = (rmDefault, rmLeftEye, rmRightEye); var FollowGear: PGear; WindBarWidth: LongInt; @@ -45,7 +44,6 @@ procedure InitWorld; procedure DrawWorld(Lag: LongInt); -procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); procedure HideMission; @@ -73,11 +71,6 @@ amSel: TAmmoType = amNothing; missionTex: PTexture; missionTimer: LongInt; - stereoDepth: GLfloat = 0; - -const cStereo_Sky = 0.0750; - cStereo_Horizon = 0.0250; - cStereo_Water = 0.0125; procedure InitWorld; var i, t: LongInt; @@ -535,7 +528,14 @@ procedure DrawWorld(Lag: LongInt); -var cc: array[0..3] of GLfloat; +var i, t: LongInt; + r: TSDL_Rect; + tdx, tdy: Double; + grp: TCapGroup; + s: string[15]; + highlight: Boolean; + offset, offsetX, offsetY, ScreenBottom: LongInt; + VertexBuffer: array [0..3] of TVertex2f; begin if not isPaused then begin @@ -564,101 +564,6 @@ if not isPaused then MoveCamera; - if not isStereoEnabled then - begin - glClear(GL_COLOR_BUFFER_BIT); - DrawWorldStereo(Lag, rmDefault) - end - else - begin - // create left fb - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framel); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - DrawWorldStereo(Lag, rmLeftEye); - - // create right fb - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framer); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - DrawWorldStereo(0, rmRightEye); - - // detatch drawing from fbs - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glGetFloatv(GL_COLOR_CLEAR_VALUE, @cc); - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - glClearColor(cc[0], cc[1], cc[2], cc[3]); - SetScale(cDefaultZoomLevel); - - // enable gl stuff - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE); - - // draw left frame - glBindTexture(GL_TEXTURE_2D, texl); - glColor3f(0.0, 1.0, 1.0); - glBegin(GL_QUADS); - glTexCoord2f(0.0, 0.0); - glVertex2d(cScreenWidth / -2, cScreenHeight); - glTexCoord2f(1.0, 0.0); - glVertex2d(cScreenWidth / 2, cScreenHeight); - glTexCoord2f(1.0, 1.0); - glVertex2d(cScreenWidth / 2, 0); - glTexCoord2f(0.0, 1.0); - glVertex2d(cScreenWidth / -2, 0); - glEnd(); - - // draw right frame - glBindTexture(GL_TEXTURE_2D, texr); - glColor3f(1.0, 0.0, 0.0); - glBegin(GL_QUADS); - glTexCoord2f(0.0, 0.0); - glVertex2d(cScreenWidth / -2, cScreenHeight); - glTexCoord2f(1.0, 0.0); - glVertex2d(cScreenWidth / 2, cScreenHeight); - glTexCoord2f(1.0, 1.0); - glVertex2d(cScreenWidth / 2, 0); - glTexCoord2f(0.0, 1.0); - glVertex2d(cScreenWidth / -2, 0); - glEnd(); - - // reset - glColor3f(1.0, 1.0, 1.0); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - SetScale(zoom); - end -end; - -procedure ChangeDepth(rm: TRenderMode; d: GLfloat); -begin - if rm = rmDefault then exit - else if rm = rmRightEye then d:= -d; - stereoDepth:= stereoDepth + d; - glMatrixMode(GL_PROJECTION); - glTranslatef(d, 0, 0); - glMatrixMode(GL_MODELVIEW) -end; - -procedure ResetDepth(rm: TRenderMode); -begin - if rm = rmDefault then exit; - glMatrixMode(GL_PROJECTION); - glTranslatef(-stereoDepth, 0, 0); - glMatrixMode(GL_MODELVIEW); - stereoDepth:= 0; -end; - -procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); -var i, t: LongInt; - r: TSDL_Rect; - tdx, tdy: Double; - grp: TCapGroup; - s: string[15]; - highlight: Boolean; - offset, offsetX, offsetY, screenBottom: LongInt; - scale: GLfloat; - VertexBuffer: array [0..3] of TVertex2f; -begin if (cReducedQuality and rqNoBackground) = 0 then begin // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway @@ -969,65 +874,58 @@ offsetX:= 10; {$ENDIF} offsetY:= cOffsetY; - -// don't increment fps when drawing the right frame -if (RM = rmDefault) or (RM = rmLeftEye) then -begin - inc(Frames); +inc(Frames); - if cShowFPS or (GameType = gmtDemo) then - inc(CountTicks, Lag); - if (GameType = gmtDemo) and (CountTicks >= 1000) then - begin - i:=GameTicks div 1000; - t:= i mod 60; - s:= inttostr(t); - if t < 10 then s:= '0' + s; - i:= i div 60; - t:= i mod 60; - s:= inttostr(t) + ':' + s; - if t < 10 then s:= '0' + s; - s:= inttostr(i div 60) + ':' + s; +if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag); +if (GameType = gmtDemo) and (CountTicks >= 1000) then + begin + i:=GameTicks div 1000; + t:= i mod 60; + s:= inttostr(t); + if t < 10 then s:= '0' + s; + i:= i div 60; + t:= i mod 60; + s:= inttostr(t) + ':' + s; + if t < 10 then s:= '0' + s; + s:= inttostr(i div 60) + ':' + s; - if timeTexture <> nil then - FreeTexture(timeTexture); - timeTexture:= nil; + if timeTexture <> nil then + FreeTexture(timeTexture); + timeTexture:= nil; - tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); - tmpSurface:= doSurfaceConversion(tmpSurface); - timeTexture:= Surface2Tex(tmpSurface, false); - SDL_FreeSurface(tmpSurface) - end; + tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); + tmpSurface:= doSurfaceConversion(tmpSurface); + timeTexture:= Surface2Tex(tmpSurface, false); + SDL_FreeSurface(tmpSurface) + end; - if timeTexture <> nil then - DrawTexture((cScreenWidth shr 1) - 20 - timeTexture^.w - offsetY, offsetX + timeTexture^.h+5, timeTexture); +if timeTexture <> nil then + DrawTexture((cScreenWidth shr 1) - 20 - timeTexture^.w - offsetY, offsetX + timeTexture^.h+5, timeTexture); - if cShowFPS then - begin - if CountTicks >= 1000 then - begin - FPS:= Frames; - Frames:= 0; - CountTicks:= 0; - s:= inttostr(FPS) + ' fps'; - if fpsTexture <> nil then - FreeTexture(fpsTexture); - fpsTexture:= nil; - tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); - tmpSurface:= doSurfaceConversion(tmpSurface); - fpsTexture:= Surface2Tex(tmpSurface, false); - SDL_FreeSurface(tmpSurface) - end; - if fpsTexture <> nil then - DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture); - end; +if cShowFPS then + begin + if CountTicks >= 1000 then + begin + FPS:= Frames; + Frames:= 0; + CountTicks:= 0; + s:= inttostr(FPS) + ' fps'; + if fpsTexture <> nil then + FreeTexture(fpsTexture); + fpsTexture:= nil; + tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); + tmpSurface:= doSurfaceConversion(tmpSurface); + fpsTexture:= Surface2Tex(tmpSurface, false); + SDL_FreeSurface(tmpSurface) + end; + if fpsTexture <> nil then + DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture); + end; - if CountTicks >= 1000 then CountTicks:= 0; +if CountTicks >= 1000 then CountTicks:= 0; - // lag warning (?) - inc(SoundTimerTicks, Lag); -end; - +// lag warning (?) +inc(SoundTimerTicks, Lag); if SoundTimerTicks >= 50 then begin SoundTimerTicks:= 0; diff -r fd8c22a358de -r c247dee9e1c0 misc/libopenalbridge/openalbridge_t.h --- a/misc/libopenalbridge/openalbridge_t.h Fri Jul 30 13:36:03 2010 +0200 +++ b/misc/libopenalbridge/openalbridge_t.h Sat Jul 31 10:53:54 2010 +0200 @@ -1,74 +1,74 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include "al.h" - -#ifndef _OALB_INTERFACE_TYPES_H -#define _OALB_INTERFACE_TYPES_H - -enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT}; -typedef enum al_fade_enum al_fade_t; - - -// data type to handle which source source is playing what -#pragma pack(1) -typedef struct _al_sound_t { - const char *filename; // name of the sound file - ALuint buffer; // actual sound content - uint32_t source_index; // index of the associated source - ALboolean is_used; // tells if the element can be overwritten -} al_sound_t; -#pragma pack() - - -// data type for passing data between threads -#pragma pack(1) -typedef struct _fade_t { - uint32_t index; - uint16_t quantity; - al_fade_t type; -} fade_t; -#pragma pack() - - -// data type for WAV header -#pragma pack(1) -typedef struct _WAV_header_t { - uint32_t ChunkID; - uint32_t ChunkSize; - uint32_t Format; - uint32_t Subchunk1ID; - uint32_t Subchunk1Size; - uint16_t AudioFormat; - uint16_t NumChannels; - uint32_t SampleRate; - uint32_t ByteRate; - uint16_t BlockAlign; - uint16_t BitsPerSample; - uint32_t Subchunk2ID; - uint32_t Subchunk2Size; -} WAV_header_t; -#pragma pack() - - -#ifdef __CPLUSPLUS -} -#endif - -#endif /*_OALB_INTERFACE_TYPES_H*/ +/* + * OpenAL Bridge - a simple portable library for OpenAL interface + * Copyright (c) 2009 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include "al.h" + +#ifndef _OALB_INTERFACE_TYPES_H +#define _OALB_INTERFACE_TYPES_H + +enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT}; +typedef enum al_fade_enum al_fade_t; + + +// data type to handle which source source is playing what +#pragma pack(1) +typedef struct _al_sound_t { + const char *filename; // name of the sound file + ALuint buffer; // actual sound content + uint32_t source_index; // index of the associated source + ALboolean is_used; // tells if the element can be overwritten +} al_sound_t; +#pragma pack() + + +// data type for passing data between threads +#pragma pack(1) +typedef struct _fade_t { + uint32_t index; + uint16_t quantity; + al_fade_t type; +} fade_t; +#pragma pack() + + +// data type for WAV header +#pragma pack(1) +typedef struct _WAV_header_t { + uint32_t ChunkID; + uint32_t ChunkSize; + uint32_t Format; + uint32_t Subchunk1ID; + uint32_t Subchunk1Size; + uint16_t AudioFormat; + uint16_t NumChannels; + uint32_t SampleRate; + uint32_t ByteRate; + uint16_t BlockAlign; + uint16_t BitsPerSample; + uint32_t Subchunk2ID; + uint32_t Subchunk2Size; +} WAV_header_t; +#pragma pack() + + +#ifdef __CPLUSPLUS +} +#endif + +#endif /*_OALB_INTERFACE_TYPES_H*/