示例#1
0
        public override void Play()
        {
            CheckChannel();

            //FMOD_Audio.CheckFMODResult();
            FMOD_Audio.CheckFMODResult(mChannel.setPaused(false));
        }
示例#2
0
        public FMOD_SoundBuffer(FMOD_Audio audio, string filename)
        {
            mAudio  = audio;
            mSystem = mAudio.FMODSystem;


            FMOD_Audio.CheckFMODResult(mSystem.createSound(filename, FMOD.MODE.DEFAULT, ref mSound));
        }
示例#3
0
        public FMOD_Music(FMOD_Audio audio, string filename)
        {
            mAudio  = audio;
            mSystem = mAudio.FMODSystem;

            FMOD.RESULT result = mSystem.createStream(filename,
                                                      FMOD.MODE.LOOP_NORMAL | FMOD.MODE.ACCURATETIME, ref mSound);

            CreateChannel();
        }
示例#4
0
        private void CheckChannel()
        {
            bool p = false;

            FMOD.RESULT result = mChannel.isPlaying(ref p);

            if (result == FMOD.RESULT.ERR_INVALID_HANDLE || p == false)
            {
                CreateChannel();
            }
            else
            {
                FMOD_Audio.CheckFMODResult(result);
            }
        }
示例#5
0
        private bool FmodInstalled()
        {
            try
            {
                FMOD_Audio audio = new FMOD_Audio();

                audio.Initialize();
                audio.Dispose();

                return(true);
            }
            catch (DllNotFoundException)
            {
                return(false);
            }
        }
示例#6
0
        public FMOD_SoundBufferSession(FMOD_Audio audio, FMOD_SoundBuffer buffer)
        {
            if (buffer == null)
            {
                throw new NullReferenceException();
            }

            mAudio  = audio;
            mBuffer = buffer;

            mSystem = mAudio.FMODSystem;
            mSound  = mBuffer.FMODSound;

            //CheckCreateChannel();
            CreateChannel();

            Volume = mBuffer.Volume;
        }
示例#7
0
        void Dispose(bool disposing)
        {
            if (mIsDisposed)
            {
                return;
            }

            if (disposing)
            {
                GC.SuppressFinalize(this);

                mSystem = null;
            }

            if (mAudio.IsDisposed == false)
            {
                mSound.release();
            }

            mAudio = null;
            mSound = null;

            mIsDisposed = true;
        }
示例#8
0
 private void CreateChannel()
 {
     FMOD_Audio.CheckFMODResult(
         mSystem.playSound(FMOD.CHANNELINDEX.FREE, mSound, true, ref mChannel));
 }
示例#9
0
 public override void Stop()
 {
     FMOD_Audio.CheckFMODResult(mChannel.setPaused(true));
     FMOD_Audio.CheckFMODResult(mChannel.setPosition(0, FMOD.TIMEUNIT.MS));
 }
示例#10
0
        public FMOD_SoundBuffer(FMOD_Audio audio, Stream inStream)
        {
            byte[] bytes = new byte[inStream.Length];

            inStream.Read(bytes, 0, (int)inStream.Length);
        }