Exemplo n.º 1
0
 public void Play(bool onFlag)
 {
     // looping sounds don't get restarted
     if (looping)
     {
         if (onFlag)
         {
             if (!lastValue)
             {
                 buffer.SetCurrentPosition(1000);
                 buffer.Play(0, BufferPlayFlags.Looping);
             }
         }
         else
         {
             buffer.Stop();
         }
         lastValue = onFlag;
     }
     else
     {
         if (onFlag)
         {
             buffer.SetCurrentPosition(0);
             buffer.Play(0, BufferPlayFlags.Default);
         }
     }
 }
Exemplo n.º 2
0
 void PlaySound2(bool snd, int tags)
 {
     DSound.Buffer buffer;
     if (snd)
     {
         buffer = new DSound.Buffer(FLD_SND + "finish.wav", snddev);
         buffer.SetCurrentPosition((int)((1 - ((float)tags / MAX_TAGS)) * buffer.Caps.BufferBytes));
     }
     else
     {
         buffer = new DSound.Buffer(FLD_SND + "firstaid.wav", snddev);
         buffer.SetCurrentPosition((int)(((float)tags / MAX_TAGS) * buffer.Caps.BufferBytes));
     }
     buffer.Play(0, DSound.BufferPlayFlags.Default);
 }