internal static void PlayAudioFromBuffer(MappedWaveChannel param) { param.WaveChannel.Position = param.LastPosition; //param.WaveChannel.Position = 0; if (!(waveOutDevice.PlaybackState == PlaybackState.Playing)) { waveOutDevice.Play(); } }
/// <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 }
internal static void StopAudioFromBuffer(MappedWaveChannel param) { param.WaveChannel.Position = param.WaveChannel.Length; }
internal static void PlayAudioFromBuffer(MappedWaveChannel param) { param.WaveChannel.Position = param.LastPosition; //param.WaveChannel.Position = 0; if (!(waveOutDevice.PlaybackState == PlaybackState.Playing)) waveOutDevice.Play(); }
/// <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 }