Пример #1
0
void try_sample_backwards(int sample_index, int x, int y, int volume, int priority, int freq)
{
    if (!snd_data)
       return;

    SAMPLE *s = (SAMPLE *)(snd_data[sample_index].dat);
    int voice = allocate_voice(s);

    if (!playfield->visible(x,y))
    {
      volume /= 2;
      priority /= 2;
    }
    
    if (voice >=0)
    {
         voice_set_volume(voice,volume);
         voice_set_priority(voice,priority);
         voice_set_frequency(voice, voice_get_frequency(voice) * freq / 1000);
         voice_set_playmode(voice, PLAYMODE_BACKWARD);
         voice_start(voice);
         release_voice(voice);
    }


}
Пример #2
0
void try_loop(short *voice, int sample_index, int x, int y, int volume, int priority, int freq)
{
    if (!snd_data)
       return;

    SAMPLE *s = (SAMPLE *)(snd_data[sample_index].dat);

    if (*voice <0)
    {
        *voice = allocate_voice(s);
         if (*voice >= 0)
         {
            voice_start(*voice);
            voice_set_frequency(*voice, voice_get_frequency(*voice) * freq / 1000);
         }
    }

    if (playfield && !playfield->visible(x,y))
    {
      volume /= 2;
      priority /= 2;
    }
    
    if (*voice >=0)
    {
         voice_set_volume(*voice,volume);
         voice_set_priority(*voice,priority);
         voice_set_playmode(*voice, PLAYMODE_LOOP);
    }

}
Пример #3
0
void _apeg_audio_set_speed_multiple(APEG_LAYER *layer, float multiple)
{
	if(layer->audio.stream)
	{
		int newfreq = (float)layer->stream.audio.freq * multiple;
		int voice = layer->audio.voice;

		if(newfreq > 0)
		{
			voice_set_frequency(voice, newfreq);
			voice_start(voice);
		}
		else
			voice_stop(voice);
	}
}