예제 #1
0
 public PlayParameters Suspend(float fadeoutTime = 0)
 {
     if (!AudioSystem.Active)
     {
         return(null);
     }
     if (fadeoutTime > 0)
     {
         fadeSpeed   = -1 / fadeoutTime;
         fadePurpose = FadePurpose.Suspend;
     }
     else
     {
         fadeSpeed  = 0;
         fadeVolume = 0;
         SuspendImmediate();
     }
     Volume = volume;
     return(new PlayParameters {
         Decoder = decoder,
         Group = Group,
         Pan = pan,
         Volume = volume,
         Pitch = pitch,
         Path = SamplePath,
         Priority = Priority,
         Looping = looping,
     });
 }
예제 #2
0
 public void Stop(float fadeoutTime = 0)
 {
     if (!AudioSystem.Active)
     {
         return;
     }
     if (fadeoutTime > 0)
     {
         fadeSpeed   = -1 / fadeoutTime;
         fadePurpose = FadePurpose.Stop;
     }
     else
     {
         fadeSpeed  = 0;
         fadeVolume = 0;
         StopImmediate();
     }
     Volume = volume;
 }
예제 #3
0
        private void FadeFinished()
        {
            switch (fadePurpose)
            {
            case FadePurpose.Play:
                break;

            case FadePurpose.Stop:
                StopImmediate();
                break;

            case FadePurpose.Pause:
                PauseImmediate();
                break;

            case FadePurpose.Suspend:
                SuspendImmediate();
                break;
            }
            fadePurpose = FadePurpose.None;
        }
예제 #4
0
 public void Resume(float fadeinTime = 0)
 {
     if (!AudioSystem.Active)
     {
         return;
     }
     if (decoder == null)
     {
         throw new InvalidOperationException("Audio decoder is not set");
     }
     if (fadeinTime > 0)
     {
         fadeVolume  = 0;
         fadeSpeed   = 1 / fadeinTime;
         fadePurpose = FadePurpose.Play;
     }
     else
     {
         fadeSpeed  = 0;
         fadeVolume = 1;
     }
     Volume = volume;
     PlayImmediate();
 }