Sound device not compulsory
This commit is contained in:
parent
b85c29dee4
commit
6bbc5328fc
@ -99,7 +99,7 @@ int GRAV_G2;
|
|||||||
int GRAV_B2;
|
int GRAV_B2;
|
||||||
|
|
||||||
extern int legacy_enable;
|
extern int legacy_enable;
|
||||||
|
extern int sound_enable;
|
||||||
extern int kiosk_enable;
|
extern int kiosk_enable;
|
||||||
|
|
||||||
extern int sys_pause;
|
extern int sys_pause;
|
||||||
|
13
src/main.c
13
src/main.c
@ -82,6 +82,8 @@ void play_sound(char *file)
|
|||||||
Uint32 dlen;
|
Uint32 dlen;
|
||||||
SDL_AudioCVT cvt;
|
SDL_AudioCVT cvt;
|
||||||
|
|
||||||
|
if (!sound_enable) return;
|
||||||
|
|
||||||
/* Look for an empty (or finished) sound slot */
|
/* Look for an empty (or finished) sound slot */
|
||||||
for ( index=0; index<NUM_SOUNDS; ++index ) {
|
for ( index=0; index<NUM_SOUNDS; ++index ) {
|
||||||
if ( sounds[index].dpos == sounds[index].dlen ) {
|
if ( sounds[index].dpos == sounds[index].dlen ) {
|
||||||
@ -167,6 +169,7 @@ int FPSB = 0;
|
|||||||
int MSIGN =-1;
|
int MSIGN =-1;
|
||||||
//int CGOL = 0;
|
//int CGOL = 0;
|
||||||
//int GSPEED = 1;//causes my .exe to crash..
|
//int GSPEED = 1;//causes my .exe to crash..
|
||||||
|
int sound_enable;
|
||||||
|
|
||||||
sign signs[MAXSIGNS];
|
sign signs[MAXSIGNS];
|
||||||
|
|
||||||
@ -1209,9 +1212,12 @@ int main(int argc, char *argv[])
|
|||||||
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
SDL_PauseAudio(0);
|
else
|
||||||
|
{
|
||||||
|
sound_enable = 1;
|
||||||
|
SDL_PauseAudio(0);
|
||||||
|
}
|
||||||
#ifdef MT
|
#ifdef MT
|
||||||
numCores = core_count();
|
numCores = core_count();
|
||||||
#endif
|
#endif
|
||||||
@ -2797,7 +2803,8 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
|
|||||||
}
|
}
|
||||||
else if(strcmp(console2, "sound")==0 && console3)
|
else if(strcmp(console2, "sound")==0 && console3)
|
||||||
{
|
{
|
||||||
play_sound(console3);
|
if (sound_enable) play_sound(console3);
|
||||||
|
else strcpy(console_error, "Audio device not available - cannot play sounds");
|
||||||
}
|
}
|
||||||
else if(strcmp(console2, "load")==0 && console3)
|
else if(strcmp(console2, "load")==0 && console3)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user