Allow audio setup to be defined at compile time.
This commit is contained in:
parent
4c0d1ab808
commit
1279acafa9
|
@ -44,3 +44,4 @@ build/*
|
||||||
# Misc
|
# Misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
/.errors
|
||||||
|
|
16
src/defs.h
16
src/defs.h
|
@ -30,6 +30,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define FIXED_RESOLUTION 0
|
#define FIXED_RESOLUTION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef AUDIO_FREQUENCY
|
||||||
|
#define AUDIO_FREQUENCY 44100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef AUDIO_CHANNELS
|
||||||
|
#define AUDIO_CHANNELS 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef AUDIO_CHUNKSIZE
|
||||||
|
#define AUDIO_CHUNKSIZE 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef AUDIO_MIX_CHANNELS
|
||||||
|
#define AUDIO_MIX_CHANNELS 64
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _(string) getTranslatedString(string)
|
#define _(string) getTranslatedString(string)
|
||||||
|
|
||||||
#define PI 3.14159265358979323846
|
#define PI 3.14159265358979323846
|
||||||
|
|
|
@ -85,13 +85,13 @@ void initSDL(void)
|
||||||
|
|
||||||
SDL_ShowCursor(0);
|
SDL_ShowCursor(0);
|
||||||
|
|
||||||
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) == -1)
|
if (Mix_OpenAudio(AUDIO_FREQUENCY, MIX_DEFAULT_FORMAT, AUDIO_CHANNELS, AUDIO_CHUNKSIZE) == -1)
|
||||||
{
|
{
|
||||||
printf("Couldn't initialize SDL Mixer\n");
|
printf("Couldn't initialize SDL Mixer\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mix_AllocateChannels(64);
|
Mix_AllocateChannels(AUDIO_MIX_CHANNELS);
|
||||||
|
|
||||||
Mix_Volume(-1, app.soundVolume * MIX_MAX_VOLUME / 10);
|
Mix_Volume(-1, app.soundVolume * MIX_MAX_VOLUME / 10);
|
||||||
Mix_VolumeMusic(app.musicVolume * MIX_MAX_VOLUME / 10);
|
Mix_VolumeMusic(app.musicVolume * MIX_MAX_VOLUME / 10);
|
||||||
|
|
Loading…
Reference in New Issue