コード例 #1
0
        private static FMOD.RESULT ChannelCallbackMethod(IntPtr channelRaw, FMOD.CHANNEL_CALLBACKTYPE type, IntPtr cmdData1, IntPtr cmdData2)
        {
            FMODChannel channel = FMODManager.Instance.GetSoundChannel(channelRaw.ToInt32());

            switch (type)
            {
            case FMOD.CHANNEL_CALLBACKTYPE.END:
                if (channel.SoundEnds != null)
                {
                    channel.SoundEnds(channel, null);
                }
                FMODManager.Instance.RemoveChannelMapping(channelRaw.ToInt32());
                break;

            case FMOD.CHANNEL_CALLBACKTYPE.VIRTUALVOICE:
                if (channel.GoesVirtual != null)
                {
                    channel.GoesVirtual(channel, null);
                }
                break;

            default:
                throw new NotImplementedException();
            }
            return(FMOD.RESULT.OK);
        }
コード例 #2
0
 public void SetChannelMapping(int id, FMODChannel channel)
 {
     if (channelMapping.ContainsKey(id))
     {
         System.Diagnostics.Debugger.Break();
     }
     channelMapping[id] = channel;
 }
コード例 #3
0
        public IChannelGlue PlaySound(ISoundGlue sound, bool paused, bool looping)
        {
            FMOD.Channel channel = null;
            var result = system.playSound(FMOD.CHANNELINDEX.FREE, (FMOD.Sound)sound.InnerSoundObject, paused, ref channel);

            if (result == FMOD.RESULT.ERR_NOTREADY)
                return null;

            FMODManager.ERRCHECK(result);
            var fmodChannel = new FMODChannel(channel, looping);
            return fmodChannel;
        }
コード例 #4
0
        public IChannelGlue PlaySound(ISoundGlue sound, bool paused, bool looping)
        {
            FMOD.Channel channel = null;
            var          result  = system.playSound(FMOD.CHANNELINDEX.FREE, (FMOD.Sound)sound.InnerSoundObject, paused, ref channel);

            if (result == FMOD.RESULT.ERR_NOTREADY)
            {
                return(null);
            }

            FMODManager.ERRCHECK(result);
            var fmodChannel = new FMODChannel(channel, looping);

            return(fmodChannel);
        }