summaryrefslogtreecommitdiff
path: root/hge
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-07-10 13:47:24 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-07-10 13:47:24 +0000
commit32a2523dd5c51b31b31f5e43a7cebdb16e7f5e84 (patch)
treec69ce4a4009caf59916400957a6ae7f7e18c86ba /hge
parentd726aac2d9bac76f095ad6559d7dc30d97c3a97f (diff)
downloadbullet-lab-remix-32a2523dd5c51b31b31f5e43a7cebdb16e7f5e84.tar.xz
Dear Pre-Release Candidate version(RC-0).
CLR will collect multiplier +1's in range now. Multiplier +1's caught by player won't disappear now. Add/Move background transitions. Add volume control to options. This make the configuration file not compatible with older versions. Just delete it! Modify hge's API so that it can handle real volume and pan values. Volume value varys from 0 to 1, pan value varys from -1 to 1. Document...
Diffstat (limited to 'hge')
-rw-r--r--hge/CxImage/ximapng.cpp2
-rw-r--r--hge/hge_impl.h6
-rw-r--r--hge/sound.cpp26
3 files changed, 17 insertions, 17 deletions
diff --git a/hge/CxImage/ximapng.cpp b/hge/CxImage/ximapng.cpp
index 2e39d1b..db2f636 100644
--- a/hge/CxImage/ximapng.cpp
+++ b/hge/CxImage/ximapng.cpp
@@ -85,7 +85,7 @@ bool CxImagePNG::Decode(CxFile *hFile)
png_read_info(png_ptr, info_ptr);
png_uint_32 _width,_height;
- int _bit_depth,_color_type,_interlace_type/*,_compression_type,_filter_type*/;
+ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
#if PNG_LIBPNG_VER > 10399
png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
&_interlace_type,&_compression_type,&_filter_type);
diff --git a/hge/hge_impl.h b/hge/hge_impl.h
index 26cb850..bf42c2f 100644
--- a/hge/hge_impl.h
+++ b/hge/hge_impl.h
@@ -156,7 +156,7 @@ public:
virtual HEFFECT CALL Effect_Load(const char *filename, DWORD size=0);
virtual void CALL Effect_Free(HEFFECT eff);
virtual HCHANNEL CALL Effect_Play(HEFFECT eff);
- virtual HCHANNEL CALL Effect_PlayEx(HEFFECT eff, int volume=100, int pan=0, float pitch=1.0f, bool loop=false);
+ virtual HCHANNEL CALL Effect_PlayEx(HEFFECT eff, float volume=1.0, float pan=0.0, float pitch=1.0f, bool loop=false);
virtual HMUSIC CALL Music_Load(const char *filename, DWORD size=0);
virtual void CALL Music_Free(HMUSIC mus);
@@ -175,8 +175,8 @@ public:
virtual void CALL Stream_Free(HSTREAM stream);
virtual HCHANNEL CALL Stream_Play(HSTREAM stream, bool loop, int volume = 100);
- virtual void CALL Channel_SetPanning(HCHANNEL chn, int pan);
- virtual void CALL Channel_SetVolume(HCHANNEL chn, int volume);
+ virtual void CALL Channel_SetPanning(HCHANNEL chn, float pan);
+ virtual void CALL Channel_SetVolume(HCHANNEL chn, float volume);
virtual void CALL Channel_SetPitch(HCHANNEL chn, float pitch);
virtual void CALL Channel_Pause(HCHANNEL chn);
virtual void CALL Channel_Resume(HCHANNEL chn);
diff --git a/hge/sound.cpp b/hge/sound.cpp
index 9f6869c..9024652 100644
--- a/hge/sound.cpp
+++ b/hge/sound.cpp
@@ -217,23 +217,23 @@ HEFFECT CALL HGE_Impl::Effect_Load(const char *filename, DWORD size)
HCHANNEL CALL HGE_Impl::Effect_Play(HEFFECT eff)
{
- return Effect_PlayEx(eff, 100, 0, 1.0f, false);
+ return Effect_PlayEx(eff, 1.0f, 0, 1.0f, false);
}
-HCHANNEL CALL HGE_Impl::Effect_PlayEx(HEFFECT eff, int volume, int pan, float pitch, bool loop)
+HCHANNEL CALL HGE_Impl::Effect_PlayEx(HEFFECT eff, float volume, float pan, float pitch, bool loop)
{
if(hOpenAL)
{
const ALuint sid = get_source(); // find an unused sid, or generate a new one.
if (sid != 0)
{
- if (volume < 0) volume = 0; else if (volume > 100) volume = 100;
- if (pan < -100) pan = -100; else if (pan > 100) pan = 100;
+ if (volume < 0) volume = 0; else if (volume > 1.0) volume = 1.0;
+ if (pan < -1.0) pan = -1.0; else if (pan > 1.0) pan = 1.0;
alSourceStop(sid);
alSourcei(sid, AL_BUFFER, (ALint) eff);
- alSourcef(sid, AL_GAIN, ((ALfloat) volume) / 100.0f);
+ alSourcef(sid, AL_GAIN, volume);
alSourcef(sid, AL_PITCH, pitch);
- alSource3f(sid, AL_POSITION, ((ALfloat) pan) / 100.0f, 0.0f, 0.0f);
+ alSource3f(sid, AL_POSITION, pan, 0.0f, 0.0f);
alSourcei(sid, AL_LOOPING, loop ? AL_TRUE : AL_FALSE);
alSourcePlay(sid);
}
@@ -281,22 +281,22 @@ void CALL HGE_Impl::Stream_Free(HSTREAM stream){}
HCHANNEL CALL HGE_Impl::Stream_Play(HSTREAM stream, bool loop, int volume){return 0;}
-void CALL HGE_Impl::Channel_SetPanning(HCHANNEL chn, int pan)
+void CALL HGE_Impl::Channel_SetPanning(HCHANNEL chn, float pan)
{
- assert(pan >= -100);
- assert(pan <= 100);
+ if(pan>1.0)pan=1.0;
+ if(pan<-1.0)pan=-1.0;
if(hOpenAL)
{
- alSource3f((ALuint) chn, AL_POSITION, ((ALfloat) pan) / 100.0f, 0.0f, 0.0f);
+ alSource3f((ALuint) chn, AL_POSITION, pan, 0.0f, 0.0f);
}
}
-void CALL HGE_Impl::Channel_SetVolume(HCHANNEL chn, int volume)
+void CALL HGE_Impl::Channel_SetVolume(HCHANNEL chn, float volume)
{
if(hOpenAL)
{
- if (volume < 0) volume = 0; else if (volume > 100) volume = 100;
- alSourcef((ALuint) chn, AL_GAIN, ((ALfloat) volume) / 100.0f);
+ if (volume < 0) volume = 0; else if (volume > 1.0f) volume = 1.0f;
+ alSourcef((ALuint) chn, AL_GAIN, volume);
}
}