Пример #1
0
        public static void Mute(bool muted)
        {
            isMuted = muted;

            foreach (int c in channelIDs)
            {
                system.getChannel(c, ref channel);
                channel.setMute(muted);
            }
        }
        private void muteButton_Click(object sender, System.EventArgs e)
        {
            FMOD.RESULT result;
            bool        mute = false;

            if (channel != null)
            {
                result = channel.getMute(ref mute);
                ERRCHECK(result);
                result = channel.setMute(!mute);
                ERRCHECK(result);
            }
        }
Пример #3
0
        private bool PlayMusicCallback(FMOD.Sound sound)
        {
            FMOD.RESULT result;

            lock (syncMusicCallback)
            {
                bool isPlaying = false;
                manualMusicEnd = false;

                if (channel != null)
                {
                    channel.isPlaying(ref isPlaying);
                }
                else
                {
                    isPlaying = false;
                }

                if (isPlaying && channel != null)
                {
                    manualMusicEnd = true;
                    InfoLog.WriteInfo(DateTime.Now.ToString() + "   | Music is playing, Manual music end: " + manualMusicEnd, EPrefix.AudioEngine);
                    channel.setMute(true);
                    channel.stop();
                    channel = null;
                }
                else
                {
                    InfoLog.WriteInfo(DateTime.Now.ToString() + "   | Music is not playing, Manual music end: " + manualMusicEnd, EPrefix.AudioEngine);
                }

                result = system.playSound(FMOD.CHANNELINDEX.REUSE, sound, true, ref channel);
                if (result == FMOD.RESULT.OK && channel != null)
                {
                    channel.setVolume(volume);
                    channel.setCallback(FMOD.CHANNEL_CALLBACKTYPE.END, endPlayCallback, 0);
                    InfoLog.WriteInfo(DateTime.Now.ToString() + "   | Before Play music begin", EPrefix.AudioEngine);
                    channel.setPaused(false);
                }
            }

            InfoLog.WriteInfo(DateTime.Now.ToString() + "   | After Play music begin, result: " + result, EPrefix.AudioEngine);

            return(FMOD.ERROR.ERRCHECK(result));
        }