Hide OGG/Vorbis support under OGG

This commit is contained in:
Yamagi Burmeister 2012-04-25 08:24:38 +00:00
parent fc32d16d42
commit 9d60a5de6a
10 changed files with 45 additions and 1 deletions

View file

@ -453,7 +453,9 @@ SCR_PlayCinematic(char *arg) {
/* make sure CD isn't playing music */
CDAudio_Stop();
#ifdef OGG
OGG_Stop();
#endif
cl.cinematicframe = 0;
dot = strstr(arg, ".");

View file

@ -825,7 +825,9 @@ void CL_Shutdown(void)
CL_WriteConfiguration ();
CDAudio_Shutdown ();
#ifdef OGG
OGG_Stop();
#endif
S_Shutdown();
VID_Shutdown();
}

View file

@ -291,7 +291,9 @@ void CL_Disconnect (void)
cls.connect_time = 0;
SCR_StopCinematic ();
#ifdef OGG
OGG_Stop();
#endif
CDAudio_Stop();
if (cls.demorecording)

View file

@ -839,6 +839,7 @@ void CL_ParseConfigString (void) {
if (cl.refresh_prepped) {
CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true);
#ifdef OGG
/* OGG/Vorbis */
if (atoi(cl.configstrings[CS_CDTRACK]) < 10) {
char tmp[3] = "0";
@ -847,6 +848,7 @@ void CL_ParseConfigString (void) {
} else {
OGG_ParseCmd(cl.configstrings[CS_CDTRACK]);
}
#endif
}
} else if (i >= CS_MODELS && i < CS_MODELS+MAX_MODELS) {

View file

@ -444,7 +444,9 @@ void SCR_BeginLoadingPlaque (void) {
S_StopAllSounds ();
cl.sound_prepped = false; /* don't play ambients */
CDAudio_Stop ();
#ifdef OGG
OGG_Stop();
#endif
if (cls.disable_screen)
return;

View file

@ -309,6 +309,7 @@ void CL_PrepRefresh (void) {
} else {
CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true);
#ifdef OGG
/* OGG/Vorbis */
if (atoi(cl.configstrings[CS_CDTRACK]) < 10) {
char tmp[3] = "0";
@ -317,6 +318,7 @@ void CL_PrepRefresh (void) {
} else {
OGG_ParseCmd(cl.configstrings[CS_CDTRACK]);
}
#endif
}
}

View file

@ -1000,7 +1000,9 @@ static menulist_s s_options_crosshair_box;
static menuslider_s s_options_sfxvolume_slider;
static menulist_s s_options_cdvolume_box;
static menulist_s s_options_cdshuffle_box;
#ifdef OGG
static menulist_s s_options_oggvolume_box;
#endif
static menulist_s s_options_quality_list;
static menulist_s s_options_console_action;
@ -1036,6 +1038,7 @@ static void ControlsSetMenuItemValues( void ) {
s_options_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10;
s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
#ifdef OGG
s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable");
cvar_t *ogg;
@ -1043,9 +1046,9 @@ static void ControlsSetMenuItemValues( void ) {
if(!strcmp(ogg->string, "random"))
s_options_cdshuffle_box.curvalue = 1;
else
s_options_cdshuffle_box.curvalue = 0;
#endif
s_options_quality_list.curvalue = !Cvar_VariableValue( "s_loadas8bit" );
s_options_sensitivity_slider.curvalue = ( sensitivity->value ) * 2;
@ -1095,6 +1098,7 @@ static void UpdateVolumeFunc( void *unused ) {
static void CDShuffleFunc(void *unused) {
Cvar_SetValue("cd_shuffle", s_options_cdshuffle_box.curvalue);
#ifdef OGG
cvar_t *ogg;
ogg = Cvar_Get("ogg_enable", "1", CVAR_ARCHIVE);
@ -1119,14 +1123,19 @@ static void CDShuffleFunc(void *unused) {
}
}
}
#endif
}
static void UpdateCDVolumeFunc( void *unused ) {
Cvar_SetValue( "cd_nocd", (float)!s_options_cdvolume_box.curvalue );
#ifdef OGG
Cvar_SetValue( "ogg_enable", 0 );
#endif
if (s_options_cdvolume_box.curvalue) {
#ifdef OGG
OGG_Shutdown();
#endif
CDAudio_Init();
if (s_options_cdshuffle_box.curvalue) {
@ -1141,6 +1150,7 @@ static void UpdateCDVolumeFunc( void *unused ) {
}
}
#ifdef OGG
static void UpdateOGGVolumeFunc( void *unused ) {
Cvar_SetValue( "ogg_enable", (float)s_options_oggvolume_box.curvalue );
Cvar_SetValue( "cd_nocd", 1 );
@ -1162,6 +1172,7 @@ static void UpdateOGGVolumeFunc( void *unused ) {
OGG_Shutdown();
}
}
#endif
extern void Key_ClearTyping( void );
static void ConsoleFunc( void *unused ) {
@ -1206,11 +1217,13 @@ static void Options_MenuInit( void ) {
0
};
#ifdef OGG
static const char *ogg_music_items[] = {
"disabled",
"enabled",
0
};
#endif
static const char *cd_shuffle[] = {
"disabled",
@ -1258,6 +1271,7 @@ static void Options_MenuInit( void ) {
s_options_cdvolume_box.itemnames = cd_music_items;
s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
#ifdef OGG
s_options_oggvolume_box.generic.type = MTYPE_SPINCONTROL;
s_options_oggvolume_box.generic.x = 0;
s_options_oggvolume_box.generic.y = 20;
@ -1265,6 +1279,7 @@ static void Options_MenuInit( void ) {
s_options_oggvolume_box.generic.callback = UpdateOGGVolumeFunc;
s_options_oggvolume_box.itemnames = ogg_music_items;
s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable");
#endif
s_options_cdshuffle_box.generic.type = MTYPE_SPINCONTROL;
s_options_cdshuffle_box.generic.x = 0;
@ -1354,7 +1369,9 @@ static void Options_MenuInit( void ) {
Menu_AddItem( &s_options_menu, ( void * ) &s_options_sfxvolume_slider );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdvolume_box );
#ifdef OGG
Menu_AddItem( &s_options_menu, ( void * ) &s_options_oggvolume_box );
#endif
Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdshuffle_box );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_quality_list );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_sensitivity_slider );

View file

@ -22,6 +22,8 @@
* =======================================================================
*/
#ifdef OGG
#ifndef CL_SOUND_VORBIS_H
#define CL_SOUND_VORBIS_H
@ -68,4 +70,5 @@ void OGG_SeekCmd(void);
void OGG_StatusCmd(void);
#endif
#endif

View file

@ -131,8 +131,10 @@ S_Init ( void )
Cmd_AddCommand( "stopsound", S_StopAllSounds );
Cmd_AddCommand( "soundlist", S_SoundList );
Cmd_AddCommand( "soundinfo", S_SoundInfo_f );
#ifdef OGG
Cmd_AddCommand( "ogg_init", OGG_Init );
Cmd_AddCommand( "ogg_shutdown", OGG_Shutdown );
#endif
if ( !SNDDMA_Init() )
{
@ -150,7 +152,9 @@ S_Init ( void )
Com_Printf( "sound sampling rate: %i\n", dma.speed );
S_StopAllSounds();
#ifdef OGG
OGG_Init();
#endif
}
Com_Printf( "------------------------------------\n\n" );
@ -189,7 +193,9 @@ S_Shutdown ( void )
num_sfx = 0;
sound_started = 0;
#ifdef OGG
OGG_Shutdown();
#endif
SNDDMA_Shutdown();
Cmd_RemoveCommand( "soundlist" );
@ -1229,8 +1235,10 @@ S_Update ( vec3_t origin, vec3_t forward, vec3_t right, vec3_t up )
Com_Printf( "----(%i)---- painted: %i\n", total, paintedtime );
}
#ifdef OGG
/* stream music */
OGG_Stream();
#endif
/* mix some sound */
if ( !sound_started )

View file

@ -27,6 +27,8 @@
* =======================================================================
*/
#ifdef OGG
#include <sys/time.h>
#include <errno.h>
@ -787,3 +789,5 @@ OGG_StatusCmd ( void )
}
}
# endif /* OGG */