void CALL HGE_Impl::System_SetStateInt(hgeIntState state, int value) { switch(state) { case HGE_SCREENWIDTH: if(!pD3DDevice) nScreenWidth=value; break; case HGE_SCREENHEIGHT: if(!pD3DDevice) nScreenHeight=value; break; case HGE_SCREENBPP: if(!pD3DDevice) nScreenBPP=value; break; case HGE_SAMPLERATE: if(!hBass) nSampleRate=value; break; case HGE_FXVOLUME: nFXVolume=value; _SetFXVolume(nFXVolume); break; case HGE_MUSVOLUME: nMusVolume=value; _SetMusVolume(nMusVolume); break; case HGE_STREAMVOLUME: nStreamVolume=value; _SetStreamVolume(nStreamVolume); break; case HGE_FPS: if(VertArray) break; if(pD3DDevice) { if((nHGEFPS>=0 && value <0) || (nHGEFPS<0 && value>=0)) { if(value==HGEFPS_VSYNC) { d3dppW.SwapEffect = D3DSWAPEFFECT_COPY; d3dppW.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; d3dppFS.PresentationInterval = D3DPRESENT_INTERVAL_ONE; } else { d3dppW.SwapEffect = D3DSWAPEFFECT_COPY; d3dppFS.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; } //if(procFocusLostFunc) procFocusLostFunc(); _GfxRestore(); //if(procFocusGainFunc) procFocusGainFunc(); } } nHGEFPS=value; if(nHGEFPS>0) nFixedDelta=int(1000.0f/value); else nFixedDelta=0; break; } }
bool HGE_Impl::_SoundInit() { if(!bUseSound || hOpenAL) return true; bSilent=false; sidcount = 0; memset(sids, '\0', sizeof (sids)); System_Log("Starting OpenAL init"); ALCdevice *dev = alcOpenDevice(NULL); if (!dev) { System_Log("alcOpenDevice(NULL) failed, using no sound"); bSilent=true; return true; } ALint caps[] = { ALC_FREQUENCY, nSampleRate, 0 }; ALCcontext *ctx = alcCreateContext(dev, caps); if (!ctx) { alcCloseDevice(dev); System_Log("alcCreateContext(NULL) failed, using no sound"); bSilent=true; return true; } alcMakeContextCurrent(ctx); alcProcessContext(ctx); System_Log("OpenAL initialized"); System_Log("AL_VENDOR: %s", (char *) alGetString(AL_VENDOR)); System_Log("AL_RENDERER: %s", (char *) alGetString(AL_RENDERER)); System_Log("AL_VERSION: %s", (char *) alGetString(AL_VERSION)); System_Log("AL_EXTENSIONS: %s", (char *) alGetString(AL_EXTENSIONS)); hOpenAL = (void *) 0x1; // something non-NULL (!!! FIXME: this should eventually be a library handle). _SetFXVolume(nFXVolume); //_SetMusVolume(nMusVolume); //_SetStreamVolume(nStreamVolume); return true; }
void CALL HGE_Impl::System_SetStateInt(hgeIntState state, int value) { switch(state) { case HGE_SCREENWIDTH: //TODO: nScreenWidth=value; break; case HGE_SCREENHEIGHT: //TODO: nScreenHeight=value; break; case HGE_SCREENBPP: //TODO: nScreenBPP=value; break; case HGE_SAMPLERATE: if(!hBass) nSampleRate=value; break; case HGE_FXVOLUME: nFXVolume=value; _SetFXVolume(nFXVolume); break; case HGE_MUSVOLUME: nMusVolume=value; _SetMusVolume(nMusVolume); break; case HGE_STREAMVOLUME: nStreamVolume=value; _SetStreamVolume(nStreamVolume); break; case HGE_FPS: //TODO: nHGEFPS=value; if(nHGEFPS>0) nFixedDelta=int(1000.0f/value); else nFixedDelta=0; break; } }