Пример #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);
    }


}
void cSoundPlayer::destroySound(int voice, bool force) {
	if (maximumVoices < 0) return;
	if (voice < 0) return;
	if (voices[voice] < 0) return;

	if (force) {
		deallocate_voice(voices[voice]);
	} else {
		release_voice(voices[voice]);
	}

	for (int i = 0; i < maximumVoices; i++) {
		if (voices[i] == voice) {
			voices[i] = -1;
			break;
		}
	}
}
Пример #3
0
void FreePlayerAnimation(struct Animation *Anim)
{
   int c;

   if (Anim) {
      c = 3;
      while (c--)
         destroy_bitmap(Anim->Animation[c]);
      destroy_bitmap(Anim->Still);
      destroy_bitmap(Anim->Slow);
      destroy_bitmap(Anim->Medium);
      destroy_bitmap(Anim->Fast);

      if (Anim->SkateVoice >= 0) {
         voice_stop(Anim->SkateVoice);
         release_voice(Anim->SkateVoice);
      }

      free(Anim);
   }
}