Exemplo n.º 1
0
/*
============
S_Update

Called once each time through the main loop
============
*/
void S_Base_Update( void ) {
	int			i;
	int			total;
	channel_t	*ch;

	if ( !s_soundStarted || s_soundMuted ) {
//		Com_DPrintf ("not started or muted\n");
		return;
	}

	//
	// debugging output
	//
	if ( s_show->integer == 2 ) {
		total = 0;
		ch = s_channels;
		for (i=0 ; i<MAX_CHANNELS; i++, ch++) {
			if (ch->thesfx && (ch->leftvol || ch->rightvol) ) {
				Com_Printf ("%d %d %s\n", ch->leftvol, ch->rightvol, ch->thesfx->soundName);
				total++;
			}
		}
		
		Com_Printf ("----(%i)---- painted: %i\n", total, s_paintedtime);
	}

	// add raw data from streamed samples
	S_UpdateBackgroundTrack();

	// mix some sound
	S_Update_();
}
Exemplo n.º 2
0
/*
============
S_Base_Update

Called once each time through the main loop
============
*/
static void S_Base_Update( void ) {
	int			i;
	int			total;
	const channel_t	*ch;

	if ( !s_soundStarted || s_soundMuted ) {
//		Com_DPrintf ("not started or muted\n");
		return;
	}

	//
	// debugging output
	//
	if ( s_show->integer >= 2 ) {
		total = 0;
		ch = s_channels;
		for (i=0 ; i<MAX_CHANNELS; i++, ch++) {
			if (ch->thesfx && (ch->leftvol || ch->rightvol) ) {
				//Com_Printf ("%03d %d %d %s  dist %f (listener %f %f %f %d -> %d)\n", i, ch->leftvol, ch->rightvol, ch->thesfx->soundName, ch->entnum != listener_number ? (ch->fixed_origin ? Distance(listener_origin, ch->origin) : Distance(loopSounds[ch->entnum].origin, listener_origin))  :  -1.0, listener_origin[0], listener_origin[1], listener_origin[2], listener_number, ch->entnum);
				Com_Printf ("%d %d %s  dist %f %d -> %d %03d\n", ch->leftvol, ch->rightvol, ch->thesfx->soundName, ch->entnum != listener_number ? (ch->fixed_origin ? Distance(listener_origin, ch->origin) : Distance(loopSounds[ch->entnum].origin, listener_origin))  :  -1.0, listener_number, ch->entnum, i);
				total++;
			}
		}

		if (s_show->integer == 2) {
			Com_Printf ("----(%i)---- painted: %i\n", total, s_paintedtime);
		}
	}

	// add raw data from streamed samples
	S_UpdateBackgroundTrack();

	// mix some sound
	S_Update_();
}
Exemplo n.º 3
0
/*
============
S_Update

Called once each time through the main loop
============
*/
void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up)
{
	int			i;
	int			total;
	channel_t	*ch;
	channel_t	*combine;

	if (!sound_started)
		return;

	// if the laoding plaque is up, clear everything
	// out to make sure we aren't looping a dirty
	// dma buffer while loading
	if (cls.disable_screen)
	{
		S_ClearBuffer ();
		return;
	}

	// rebuild scale tables if volume is modified
	if (s_volume->modified)
		S_InitScaletable ();

	VectorCopy(origin, listener_origin);
	VectorCopy(forward, listener_forward);
	VectorCopy(right, listener_right);
	VectorCopy(up, listener_up);

	combine = NULL;

	// update spatialization for dynamic sounds	
	ch = channels;
	for (i=0 ; i<MAX_CHANNELS; i++, ch++)
	{
		if (!ch->sfx)
			continue;
		if (ch->autosound)
		{	// autosounds are regenerated fresh each frame
			memset (ch, 0, sizeof(*ch));
			continue;
		}
		S_Spatialize(ch);         // respatialize channel
		if (!ch->leftvol && !ch->rightvol)
		{
			memset (ch, 0, sizeof(*ch));
			continue;
		}
	}

	// add loopsounds
	S_AddLoopSounds ();

	//
	// debugging output
	//
	if (s_show->value)
	{
		total = 0;
		ch = channels;
		for (i=0 ; i<MAX_CHANNELS; i++, ch++)
			if (ch->sfx && (ch->leftvol || ch->rightvol) )
			{
				Com_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol, ch->sfx->name);
				total++;
			}
		
		Com_Printf ("----(%i)---- painted: %i\n", total, paintedtime);
	}

#ifdef OGG_SUPPORT
//	Com_DPrintf ("S_Update: calling S_UpdateBackgroundTrack\n");	// debug
	S_UpdateBackgroundTrack ();	//  Knightmare added
#endif

// mix some sound
	S_Update_();
}
Exemplo n.º 4
0
/*
============
S_Update

Called once each time through the main loop
============
*/
void S_Base_Update( void ) {
	int			i;
	vec3_t		origin;
	int			total;
	channel_t	*ch;

	if ( !s_soundStarted || s_soundMuted ) {
//		Com_DPrintf ("not started or muted\n");
		return;
	}

	// update spatialization for dynamic sounds
	if (respatialize) {
		respatialize = qfalse;

		ch = s_channels;
		for ( i = 0 ; i < MAX_CHANNELS ; i++, ch++ ) {
			if ( !ch->thesfx ) {
				continue;
			}

			// local and first person sounds will always be full volume
			if (ch->fullVolume) {
				ch->leftvol = ch->master_vol;
				ch->rightvol = ch->master_vol;
			} else {
				if (ch->fixed_origin) {
					VectorCopy( ch->origin, origin );
				} else {
					VectorCopy( loopSounds[ ch->entnum ].origin, origin );
				}

				S_SpatializeOrigin (origin, ch->master_vol, &ch->leftvol, &ch->rightvol);
			}
		}

		// add loopsounds
		S_AddLoopSounds ();
	}

	//
	// debugging output
	//
	if ( s_show->integer == 2 ) {
		total = 0;
		ch = s_channels;
		for (i=0 ; i<MAX_CHANNELS; i++, ch++) {
			if (ch->thesfx && (ch->leftvol || ch->rightvol) ) {
				Com_Printf ("%d %d %s\n", ch->leftvol, ch->rightvol, ch->thesfx->soundName);
				total++;
			}
		}
		
		Com_Printf ("----(%i)---- painted: %i\n", total, s_paintedtime);
	}

	// add raw data from streamed samples
	S_UpdateBackgroundTrack();

	// mix some sound
	S_Update_();
}