Beispiel #1
0
void digi_start_sound_object(int i)
{
	// start sample structures
	SoundObjects[i].channel =  -1;

	if ( SoundObjects[i].volume <= 0 )
		return;

	if ( Dont_start_sound_objects )
		return;

// -- MK, 2/22/96 -- 	if ( Newdemo_state == ND_STATE_RECORDING )
// -- MK, 2/22/96 -- 		newdemo_record_sound_3d_once( digi_unxlat_sound(SoundObjects[i].soundnum), SoundObjects[i].pan, SoundObjects[i].volume );

	// only use up to half the sound channels for "permanent" sounts
	if ((SoundObjects[i].flags & SOF_PERMANENT) && (N_active_sound_objects >= max(1, digi_max_channels / 4)))
		return;

	// start the sample playing

	SoundObjects[i].channel = digi_start_sound( SoundObjects[i].soundnum,
										SoundObjects[i].volume,
										SoundObjects[i].pan,
										SoundObjects[i].flags & SOF_PLAY_FOREVER,
										SoundObjects[i].loop_start,
										SoundObjects[i].loop_end, i );

	if (SoundObjects[i].channel > -1 )
		N_active_sound_objects++;
}
Beispiel #2
0
static void put_char_delay(const grs_font &cv_font, briefing *const br, const char ch)
{
	char str[2];
	int	w;

	str[0] = ch; str[1] = '\0';
	if (br->delay_count && (timer_query() < br->start_time + br->delay_count))
	{
		br->message--;		// Go back to same character
		return;
	}

	if (br->streamcount >= br->messagestream.size())
		return;
	br->messagestream[br->streamcount].x = br->text_x;
	br->messagestream[br->streamcount].y = br->text_y;
	br->messagestream[br->streamcount].color = *Current_color;
	br->messagestream[br->streamcount].ch = ch;
	br->streamcount++;

	br->prev_ch = ch;
	gr_get_string_size(cv_font, str, &w, nullptr, nullptr);
	br->text_x += w;

#if defined(DXX_BUILD_DESCENT_II)
	if (!EMULATING_D1 && !br->chattering) {
		br->printing_channel.reset(digi_start_sound(digi_xlat_sound(SOUND_BRIEFING_PRINTING), F1_0, 0xFFFF/2, 1, -1, -1, sound_object_none));
		br->chattering=1;
	}
#endif

	br->start_time = timer_query();
}
Beispiel #3
0
// Play the given sound number.
// Volume is max at F1_0.
void digi_play_sample( int soundno, fix max_volume )
{
	if ( Newdemo_state == ND_STATE_RECORDING )
		newdemo_record_sound( soundno );

	if (!digi_initialised) return;

        if (digi_xlat_sound(soundno) < 0 ) return;

	digi_start_sound(soundno, max_volume, F0_5);
}
Beispiel #4
0
void digi_play_sample( int soundno, fix max_volume )
{
	if ( Newdemo_state == ND_STATE_RECORDING )
		newdemo_record_sound( soundno );

	soundno = digi_xlat_sound(soundno);

	if (soundno < 0 ) return;

   // start the sample playing
	digi_start_sound( soundno, max_volume, 0xffff/2, 0, -1, -1, -1 );
}
Beispiel #5
0
// Play the given sound number.
// Volume is max at F1_0.
void digi_play_sample( int soundno, fix max_volume )
{
#ifdef NEWDEMO
	if ( Newdemo_state == ND_STATE_RECORDING )
		newdemo_record_sound( soundno );
#endif
	soundno = digi_xlat_sound(soundno);

	if (!digi_initialised) return;

	if (soundno < 0 ) return;

	digi_start_sound(soundno, max_volume, F0_5, 0, 0, 0, 0);
}
Beispiel #6
0
void digi_play_sample_3d( int soundno, int angle, int volume, int no_dups ) // Volume from 0-0x7fff
{
	no_dups = 1;

	if ( Newdemo_state == ND_STATE_RECORDING )		{
		if ( no_dups )
			newdemo_record_sound_3d_once( soundno, angle, volume );
		else
			newdemo_record_sound_3d( soundno, angle, volume );
	}

	if (!digi_initialised) return;
        if (digi_xlat_sound(soundno) < 0 ) return;

	if (volume < MIN_VOLUME ) return;
	digi_start_sound(soundno, volume, angle);
}
Beispiel #7
0
// Play the given sound number. If the sound is already playing,
// restart it.
void digi_play_sample_once( int soundno, fix max_volume )
{
	int i;

	if ( Newdemo_state == ND_STATE_RECORDING )
		newdemo_record_sound( soundno );

	if (!digi_initialised) return;

        if (digi_xlat_sound(soundno) < 0 ) return;

	LOCK();
        for (i=0; i < MAX_SOUND_SLOTS; i++)
          if (SoundSlots[i].soundno == soundno)
            SoundSlots[i].playing = 0;
	UNLOCK();
	digi_start_sound(soundno, max_volume, F0_5);
}
Beispiel #8
0
void SoundQ_process()
{
	if ( SoundQ_channel > -1 )	{
		if ( digi_is_channel_playing(SoundQ_channel) )
			return;
		SoundQ_end();
	}

	while ( SoundQ_head != SoundQ_tail )	{
		sound_q * q = &SoundQ[SoundQ_head];

		if ( q->time_added+MAX_LIFE > timer_query() )	{
			SoundQ_channel = digi_start_sound(q->soundnum, F1_0+1, 0xFFFF/2, 0, -1, -1, -1 );
			return;
		} else {
			// expired; remove from Queue
	  		SoundQ_end();
		}
	}
}
Beispiel #9
0
// Play the given sound number. If the sound is already playing,
// restart it.
void digi_play_sample_once( int soundno, fix max_volume )
{
	int i;

#ifdef NEWDEMO
	if ( Newdemo_state == ND_STATE_RECORDING )
		newdemo_record_sound( soundno );
#endif
	soundno = digi_xlat_sound(soundno);

	if (!digi_initialised) return;

	if (soundno < 0 ) return;

        for (i=0; i < MAX_SOUND_SLOTS; i++)
          if (SoundSlots[i].soundno == soundno)
            SoundSlots[i].playing = 0;
	digi_start_sound(soundno, max_volume, F0_5, 0, 0, 0, 0);

}
Beispiel #10
0
// Play the given sound number. If the sound is already playing,
// restart it.
void digi_play_sample_once( int soundno, fix max_volume )
{
 int i;

#ifdef NEWDEMO
   if ( Newdemo_state == ND_STATE_RECORDING )
    newdemo_record_sound( soundno );
#endif
   if (!digi_initialised)
    return;
   if (digi_xlat_sound(soundno) < 0 )
    return;

   for (i=0; i < MAX_SOUND_SLOTS; i++)
    if (SoundSlots[i].soundno == soundno)
     {
       DS_release_slot(i,1);
     }

  digi_start_sound(soundno, max_volume, F0_5);
}
Beispiel #11
0
void digi_play_sample_3d( int soundno, int angle, int volume, int no_dups )
{

	no_dups = 1;

	if ( Newdemo_state == ND_STATE_RECORDING )		{
		if ( no_dups )
			newdemo_record_sound_3d_once( soundno, angle, volume );
		else
			newdemo_record_sound_3d( soundno, angle, volume );
	}

	soundno = digi_xlat_sound(soundno);

	if (soundno < 0 ) return;

	if (volume < 10 ) return;

   // start the sample playing
	digi_start_sound( soundno, volume, angle, 0, -1, -1, -1 );
}
Beispiel #12
0
void digi_play_sample_looping_sub()
{
	if ( digi_looping_sound > -1 )
		digi_looping_channel  = digi_start_sound( digi_looping_sound, digi_looping_volume, 0xFFFF/2, 1, digi_looping_start, digi_looping_end, -1 );
}