예제 #1
0
        public FModMediaPlayer()
        {
            myopen = new FMOD.FILE_OPENCALLBACK(OPENCALLBACK);
            myclose = new FMOD.FILE_CLOSECALLBACK(CLOSECALLBACK);
            myread = new FMOD.FILE_READCALLBACK(READCALLBACK);
            myseek = new FMOD.FILE_SEEKCALLBACK(SEEKCALLBACK);

            FMOD.RESULT result;

            uint version = 0;

            result = FMOD.Factory.System_Create(ref system);
            ErrorCheck(result, "System_Create");

            result = system.getVersion(ref version);
            ErrorCheck(result, "system.getVersion");

            if (version != FMOD.VERSION.number)
                throw new ArgumentOutOfRangeException("version", version, "Unexpected version");

            result = system.init(MAX_CHANNELS, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ErrorCheck(result, "system.init");

            result = system.setFileSystem(myopen, myclose, myread, myseek, null, null, 2048);
            ErrorCheck(result, "system.setFileSystem");

            channel_callback = channelCallbackHandler;
        }
예제 #2
0
        public void Play()
        {
            if (endCallback == null)
            {
                endCallback = new FMOD.CHANNEL_CALLBACK(soundEndCallback);
            }

            channel.setCallback(FMOD.CHANNEL_CALLBACKTYPE.END, endCallback, 0);

            FMOD.RESULT result = channel.setPaused(false);
            SoundManager.CheckResults(result);
        }
예제 #3
0
        public Music(FMOD.System system, ISynchronizeInvoke invoker, bool isInitialized)
        {
            this.system        = system;
            this.invoker       = invoker;
            this.isInitialized = isInitialized;

            if (isInitialized && system == null)
            {
                isInitialized = false;
            }

            musicType      = MusicType.Peace;
            manualMusicEnd = false;
            isMuted        = false;

            endPlayCallback = new FMOD.CHANNEL_CALLBACK(endPlayCallbackFunction);
        }
예제 #4
0
파일: Sound.cs 프로젝트: corefan/yad2
        public Sound(FMOD.System system, ISynchronizeInvoke invoker, bool isInitialized)
        {
            this.system        = system;
            this.invoker       = invoker;
            this.isInitialized = isInitialized;

            if (isInitialized && system == null)
            {
                isInitialized = false;
            }

            misc   = new FMOD.Sound[Enum.GetValues(typeof(MiscSoundType)).Length];
            houses = new Dictionary <short, FMOD.Sound[]>();

            sequentialPlayList = new List <HouseSoundType>();
            endPlayCallback    = new FMOD.CHANNEL_CALLBACK(endPlayCallbackFunction);

            isMuted = false;
        }
예제 #5
0
 public SoundInstance(FMOD.Channel channel, Sound sound)
 {
     Sound   = sound;
     Channel = channel;
     //We have to hold a reference or the GC will collect and crash everything
     _callback = (channelPtr, controlType, callbackType, data1, data2) =>
     {
         if (callbackType == FMOD.CHANNELCONTROL_CALLBACK_TYPE.END)
         {
             _ended = true;
             Sound.Player.ActiveSoundInstanceQueue.Remove(this);
             if (_endedCallback != null)
             {
                 _endedCallback(this);
             }
         }
         return(FMOD.RESULT.OK);
     };
     FMOD.Error.Check(Channel.setCallback(_callback));
 }
        public void Play()
        {
            if (endCallback == null)
            {
                endCallback = new FMOD.CHANNEL_CALLBACK(soundEndCallback);
            }

            channel.setCallback(FMOD.CHANNEL_CALLBACKTYPE.END, endCallback, 0);

            FMOD.RESULT result = channel.setPaused(false);
            SoundManager.CheckResults(result);
        }