コード例 #1
0
 private static void FFTErr(RESULT result)
 {
     if (RESULT.OK != result)
     {
         throw FMODPlayer.GetException("Unable to get fft", result);
     }
 }
コード例 #2
0
ファイル: FMODTrack.cs プロジェクト: Melamew/LMaML
 private static void WaveErr(RESULT result)
 {
     if (RESULT.OK != result)
     {
         throw FMODPlayer.GetException("Unable to get waveform", result);
     }
 }
コード例 #3
0
        /// <summary>
        /// Seeks to the specified offset (In milliseconds).
        /// </summary>
        /// <param name="offset">The offset.</param>
        public void Seek(double offset)
        {
            var result = fmodChannel.setPosition((uint)offset, TIMEUNIT.MS);

            if (RESULT.OK != result)
            {
                throw FMODPlayer.GetException("Unable to seek in this channel", result);
            }
        }
コード例 #4
0
        //private static uint GetLengthSamples(Sound fmodSound)
        //{
        //    return GetLength(fmodSound, TIMEUNIT.PCM);
        //}

        private static uint GetLength(Sound fmodSound, TIMEUNIT unit)
        {
            uint length = 0;
            var  result = fmodSound.getLength(ref length, unit);

            if (RESULT.OK != result)
            {
                throw FMODPlayer.GetException("Unable to get length of sound", result);
            }
            return(length);
        }
コード例 #5
0
        /// <summary>
        /// Creates the channel.
        /// </summary>
        /// <param name="system">The system.</param>
        /// <param name="sound">The sound.</param>
        /// <returns></returns>
        private static Channel CreateChannel(global::FMOD.System system, Sound sound)
        {
            Channel channel = null;
            var     result  = system.playSound(CHANNELINDEX.FREE, sound, true, ref channel);

            if (result != RESULT.OK)
            {
                throw FMODPlayer.GetException("Unable to play sound", result);
            }
            return(channel);
        }
コード例 #6
0
        private void Init()
        {
            float freq = 0f, volume = 0f, pan = 0f;
            var   prio   = 0;
            var   result = fmodSound.getDefaults(ref freq, ref volume, ref pan, ref prio);

            if (RESULT.OK != result)
            {
                throw FMODPlayer.GetException("Unable to get sound defaults", result);
            }
            SampleRate = freq;
        }
コード例 #7
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (isDisposed)
            {
                return;
            }
            isDisposed = true;
            var result = fmodChannel.stop();

            if (RESULT.OK != result && RESULT.ERR_INVALID_HANDLE != result)
            {
                throw FMODPlayer.GetException("Unable to stop FMOD channel", result);
            }
        }