private void AngleSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { _offsetX = GetXPercent(e.NewValue); EllipseRedrow(_offsetY, _offsetX); //_generator.SetHorizontalPosition(e.NewValue); lock (_lockAudio) { if (_audioPlayer != null) { _audioPlayer.SetHorizontalPosition((int)AngleSlider.Value); } } if (ApplyConvolution.IsChecked == true) { lock (_lockAudio) { if (_audioPlayer != null) { _audioPlayer.SetConvolutionFunctions(GetFileStream(Channel.Left), GetFileStream(Channel.Right)); } } ReadSoundBytes(ConvolutionResourseReader.GetSoundPath((int)ElevationSlider.Value, (int)AngleSlider.Value, Channel.Left), Channel.Left); ReadSoundBytes(ConvolutionResourseReader.GetSoundPath((int)ElevationSlider.Value, (int)AngleSlider.Value, Channel.Right), Channel.Right); label.Content = ($"{ElevationSlider.Value} ---- {AngleSlider.Value}"); } }
private void Convolution_Checked(object sender, RoutedEventArgs e) { IsConvolution = true; lock (_lockAudio) { if (_audioPlayer != null) { _audioPlayer.SetConvolutionFunctions(GetFileStream(Channel.Left), GetFileStream(Channel.Right)); _audioPlayer.SetConvolutionMode(_isConvolutionOn); } } label.Content = ($"{ElevationSlider.Value} ---- {AngleSlider.Value}"); ReadSoundBytes(ConvolutionResourseReader.GetSoundPath((int)ElevationSlider.Value, (int)AngleSlider.Value, Channel.Left), Channel.Left); ReadSoundBytes(ConvolutionResourseReader.GetSoundPath((int)ElevationSlider.Value, (int)AngleSlider.Value, Channel.Right), Channel.Right); }
private NativeFileStream GetFileStream(Channel channel) => new NativeFileStream (ConvolutionResourseReader.GetSoundPath((int)ElevationSlider.Value, (int)AngleSlider.Value, channel), NativeFileMode.Open, NativeFileAccess.Read);