Пример #1
0
        internal static void PlayAudioFromBuffer(MappedWaveChannel param)
        {
            param.WaveChannel.Position = param.LastPosition;
            //param.WaveChannel.Position = 0;

            if (!(waveOutDevice.PlaybackState == PlaybackState.Playing))
            {
                waveOutDevice.Play();
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filepath"></param>
        /// <param name="volume"></param>
        /// <returns></returns>
        public static int LoadSoundToBuffer(string filepath, float volume)
        {
#if WINDOWS
            WaveChannel32 channel = CreateInputStream(filepath, volume, true);

            if (channel == null)
            {
                return(-1);
            }

            buffer[bufferCount] = new MappedWaveChannel()
            {
                WaveChannel = channel, LastPosition = 0
            };

            bufferCount++;

            return(bufferCount - 1);
#elif WINRT
            return(-1);
#endif
        }
Пример #3
0
 internal static void StopAudioFromBuffer(MappedWaveChannel param)
 {
     param.WaveChannel.Position = param.WaveChannel.Length;
 }
Пример #4
0
        internal static void PlayAudioFromBuffer(MappedWaveChannel param)
        {
            param.WaveChannel.Position = param.LastPosition;
            //param.WaveChannel.Position = 0;

            if (!(waveOutDevice.PlaybackState == PlaybackState.Playing))
                waveOutDevice.Play();
        }
Пример #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="filepath"></param>
        /// <param name="volume"></param>
        /// <returns></returns>
        public static int LoadSoundToBuffer(string filepath, float volume)
        {
#if WINDOWS
            WaveChannel32 channel = CreateInputStream(filepath, volume, true);

            if (channel == null) return -1;

            buffer[bufferCount] = new MappedWaveChannel() { WaveChannel = channel, LastPosition = 0 };

            bufferCount++;

            return (bufferCount - 1);
#elif WINRT
            return -1;
#endif
        }
Пример #6
0
 internal static void StopAudioFromBuffer(MappedWaveChannel param)
 {
     param.WaveChannel.Position = param.WaveChannel.Length;
 }