Пример #1
0
int MYWAVE::get_pos_ms()
{
    // convert the offset in samples into the offset in ms
    //return ((1000000 / voice_get_frequency(voice)) * voice_get_position(voice)) / 1000;

    if (voice_get_frequency(voice) < 100)
        return 0;
    // (number of samples / (samples per second / 100)) * 10 = ms
    return (voice_get_position(voice) / (voice_get_frequency(voice) / 100)) * 10;
}
Пример #2
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);
    }


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

}