Example #1
0
 private static void FFTErr(RESULT result)
 {
     if (RESULT.OK != result)
     {
         throw FMODPlayer.GetException("Unable to get fft", result);
     }
 }
Example #2
0
 private static void WaveErr(RESULT result)
 {
     if (RESULT.OK != result)
     {
         throw FMODPlayer.GetException("Unable to get waveform", result);
     }
 }
Example #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);
            }
        }
Example #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);
        }
Example #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);
        }
Example #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;
        }
Example #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);
            }
        }