}
}
- OPENAL_SetFrequency(channels[stream_menutheme], 22050);
+ OPENAL_SetFrequency(channels[stream_menutheme]);
if (entername) {
inputText(displaytext[0], &displayselected);
fireSound();
flash();
if (musictoggle) {
- OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+ OPENAL_SetFrequency(OPENAL_ALL);
emit_stream_np(stream_menutheme);
pause_sound(leveltheme);
}
}
//play menu theme
if (musictoggle && (mainmenu == 1 || mainmenu == 2)) {
- OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+ OPENAL_SetFrequency(OPENAL_ALL);
emit_stream_np(stream_menutheme);
pause_sound(leveltheme);
}
if (Input::isKeyPressed(SDL_SCANCODE_V) && debugmode) {
freeze = !freeze;
if (freeze) {
- OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+ OPENAL_SetFrequency(OPENAL_ALL);
}
}
if (Input::isKeyPressed(consolekey) && debugmode) {
console = !console;
if (console) {
- OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+ OPENAL_SetFrequency(OPENAL_ALL);
} else {
freeze = 0;
waiting = false;
static int oldwinfreeze;
if (winfreeze && !oldwinfreeze) {
- OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+ OPENAL_SetFrequency(OPENAL_ALL);
emit_sound_np(consolesuccesssound);
}
if (winfreeze == 0)
envsound[j] = envsound[numenvsounds];
}
}
- if (slomo)
- OPENAL_SetFrequency(OPENAL_ALL, slomofreq);
- else
- OPENAL_SetFrequency(OPENAL_ALL, 22050);
+ OPENAL_SetFrequency(OPENAL_ALL, slomo);
if (tutoriallevel == 1) {
XYZ temp;
if (tutorialstage >= 51)
if (distsq(&temp, &Person::players[0]->coords) >= distsq(&temp, &temp2) - 1 || distsq(&temp3, &Person::players[0]->coords) < 4) {
OPENAL_StopSound(OPENAL_ALL); // hack...OpenAL renderer isn't stopping music after tutorial goes to level menu...
- OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+ OPENAL_SetFrequency(OPENAL_ALL);
emit_stream_np(stream_menutheme);
#include "Sounds.h"
#include "Game.h"
+extern float slomofreq;
+
// NOTE:
// FMOD uses a Left Handed Coordinate system, OpenAL uses a Right Handed
// one...so we just need to flip the sign on the Z axis when appropriate.
return true;
}
-AL_API signed char OPENAL_SetFrequency(int channel, int freq)
+AL_API signed char OPENAL_SetFrequency(int channel, bool slomo)
{
if (!initialized)
return false;
if (channel == OPENAL_ALL) {
for (int i = 0; i < num_channels; i++)
- OPENAL_SetFrequency(i, freq);
+ OPENAL_SetFrequency(i, slomo);
return true;
}
if ((channel < 0) || (channel >= num_channels))
return false;
- if (freq == 8012)
- // hack
- alSourcef(impl_channels[channel].sid, AL_PITCH, 8012.0f / 44100.0f);
+ if (slomo)
+ alSourcef(impl_channels[channel].sid, AL_PITCH, ((ALfloat) slomofreq) / 44100.0f);
else
alSourcef(impl_channels[channel].sid, AL_PITCH, 1.0f);
return true;
AL_API void OPENAL_Close();
AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr);
- AL_API signed char OPENAL_SetFrequency(int channel, int freq);
+ AL_API signed char OPENAL_SetFrequency(int channel, bool slomo = false);
AL_API signed char OPENAL_SetVolume(int channel, int vol);
AL_API signed char OPENAL_SetPaused(int channel, signed char paused);
AL_API void OPENAL_SetSFXMasterVolume(int volume);