Esempio n. 1
0
 private void PlaySound(SoundChannel soundChannel, bool paused)
 {
     if ((soundChannel != null) && (soundChannel.Sound != null))
     {
         soundChannel.WaitOnFade();
         Channel channel = null;
         if (soundChannel.Channel == null)
         {
             this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.FREE, soundChannel.Sound, paused, ref channel));
             soundChannel.Channel = channel;
         }
         else
         {
             bool flag = false;
             soundChannel.Channel.getPaused(ref flag);
             if (flag)
             {
                 if (!paused)
                 {
                     soundChannel.Channel.setPaused(false);
                 }
             }
             else
             {
                 this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.REUSE, soundChannel.Sound, paused, ref channel));
                 soundChannel.Channel = channel;
             }
         }
     }
 }
Esempio n. 2
0
 public void Stop(SoundChannel soundChannel, int fadeDuration)
 {
     if (((soundChannel != null) && (soundChannel.Channel != null)) && ((fadeDuration != 0) && soundChannel.IsPlaying))
     {
         soundChannel.ImmediateFade(fadeDuration);
         soundChannel.WaitOnFade();
         soundChannel.Channel.stop();
         soundChannel.CancelFades();
     }
 }
Esempio n. 3
0
 public void Stop(SoundChannel soundChannel, int fadeDuration)
 {
     if (soundChannel != null && soundChannel.Channel != null)
     {
         // Sound has to be playing for the volume to be set (fmod rule)
         if (fadeDuration != 0 && soundChannel.IsPlaying)
         {
             soundChannel.ImmediateFade(fadeDuration);
             soundChannel.WaitOnFade();
             soundChannel.Channel.stop();
             soundChannel.CancelFades();
         }
     }
 }
Esempio n. 4
0
        private void PlaySound(SoundChannel soundChannel, bool paused)
        {
            if (soundChannel == null || soundChannel.Sound == null)
            {
                return;
            }

            // Wait for any fade on this channel to finish
            soundChannel.WaitOnFade();

            // Has it ever been run?
            Channel channel = null;

            if (soundChannel.Channel == null)
            {
                // Never run before
                ERRCHECK(m_system.playSound(FMOD.CHANNELINDEX.FREE, soundChannel.Sound, paused, ref channel));
                soundChannel.Channel = channel;
            }
            else
            {
                // Has been run before
                // Is the channel paused?
                bool isPaused = false;
                soundChannel.Channel.getPaused(ref isPaused);
                if (isPaused)
                {
                    // Paused, unpause it
                    if (!paused)
                    {
                        soundChannel.Channel.setPaused(false);
                    }
                }
                else
                {
                    // Not paused, channel was stopped
                    ERRCHECK(m_system.playSound(FMOD.CHANNELINDEX.REUSE, soundChannel.Sound, paused, ref channel));
                    soundChannel.Channel = channel;
                }
            }
        }
Esempio n. 5
0
 private void PlaySound(SoundChannel soundChannel)
 {
     if (soundChannel.Sound != null)
     {
         soundChannel.WaitOnFade();
         Channel channel = null;
         if (soundChannel.Channel == null)
         {
             this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.FREE, soundChannel.Sound, false, ref channel));
             soundChannel.Channel = channel;
         }
         else if (soundChannel.Paused)
         {
             soundChannel.Paused = false;
         }
         else
         {
             this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.REUSE, soundChannel.Sound, false, ref channel));
             soundChannel.Channel = channel;
         }
     }
 }
Esempio n. 6
0
        private void PlaySound(SoundChannel soundChannel, bool paused)
        {
            if(soundChannel == null || soundChannel.Sound == null) return;

            // Wait for any fade on this channel to finish
            soundChannel.WaitOnFade();

            // Has it ever been run?
            Channel channel = null;
            if(soundChannel.Channel == null) {
                // Never run before
                ERRCHECK(m_system.playSound(FMOD.CHANNELINDEX.FREE, soundChannel.Sound, paused, ref channel));
                soundChannel.Channel = channel;
            } else {
                // Has been run before
                // Is the channel paused?
                bool isPaused = false;
                soundChannel.Channel.getPaused(ref isPaused);
                if (isPaused) {
                    // Paused, unpause it
                    if (!paused) {
                        soundChannel.Channel.setPaused(false);
                    }
                } else {
                    // Not paused, channel was stopped
                    ERRCHECK(m_system.playSound(FMOD.CHANNELINDEX.REUSE, soundChannel.Sound, paused, ref channel));
                    soundChannel.Channel = channel;
                }
            }
        }
Esempio n. 7
0
 public void Stop(SoundChannel soundChannel, int fadeDuration)
 {
     if(soundChannel != null && soundChannel.Channel != null) {
         // Sound has to be playing for the volume to be set (fmod rule)
         if(fadeDuration != 0 && soundChannel.IsPlaying ) {
             soundChannel.ImmediateFade(fadeDuration);
             soundChannel.WaitOnFade();
             soundChannel.Channel.stop();
             soundChannel.m_ptimer.Stop();
             soundChannel.CancelFades();
         }
     }
 }
Esempio n. 8
0
 private void PlaySound(SoundChannel soundChannel, bool paused)
 {
     if ((soundChannel != null) && (soundChannel.Sound != null))
     {
         soundChannel.WaitOnFade();
         Channel channel = null;
         if (soundChannel.Channel == null)
         {
             this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.FREE, soundChannel.Sound, paused, ref channel));
             soundChannel.Channel = channel;
         }
         else
         {
             bool flag = false;
             soundChannel.Channel.getPaused(ref flag);
             if (flag)
             {
                 if (!paused)
                 {
                     soundChannel.Channel.setPaused(false);
                 }
             }
             else
             {
                 this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.REUSE, soundChannel.Sound, paused, ref channel));
                 soundChannel.Channel = channel;
             }
         }
     }
 }
Esempio n. 9
0
 private void PlaySound(SoundChannel soundChannel)
 {
     if (soundChannel.Sound != null)
     {
         soundChannel.WaitOnFade();
         Channel channel = null;
         if (soundChannel.Channel == null)
         {
             this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.FREE, soundChannel.Sound, false, ref channel));
             soundChannel.Channel = channel;
         }
         else if (soundChannel.Paused)
         {
             soundChannel.Paused = false;
         }
         else
         {
             this.ERRCHECK(this.m_system.playSound(CHANNELINDEX.REUSE, soundChannel.Sound, false, ref channel));
             soundChannel.Channel = channel;
         }
     }
 }
Esempio n. 10
0
 public void Stop(SoundChannel soundChannel, int fadeDuration)
 {
     if (((soundChannel != null) && (soundChannel.Channel != null)) && ((fadeDuration != 0) && soundChannel.IsPlaying))
     {
         soundChannel.ImmediateFade(fadeDuration);
         soundChannel.WaitOnFade();
         soundChannel.Channel.stop();
         soundChannel.CancelFades();
     }
 }