PanSlider Object - How to use?

Nov 13, 2012 at 7:04 PM

Hello,

I´ am currently programming a small "DJ Software" (Just for Fun) and I want to use a PanSlider for controlling the volume of the left and right speaker. Is it possible?

The "Pan_Changed"-Event is already running. But at this point I don´t what to do in the Event-Function to use the pan.

Does anybody have already use the PanSlider Object? A little Code excerpt would be very nice.

Best regards Moritz M. :)

Coordinator
Nov 14, 2012 at 6:01 AM

The PanSlider control is a very simple example control that returns values between -1.0 (left) and 1.0 (right), with 0.0 as centre.

You would use it in conjunction with any class in NAudio that has a Pan property. For example, PanningSampleProvider, or WaveChannel32. PanningSampleProvider lets to choose a panning law to use. Set up playback something like this

var file = new AudioFileReader(myFile);
var panningSampleProvider = new PanningSampleProvider(file);
var player = new WaveOut();
this.panSlider1.PanChanged += (s,a) => panningSampleProvider.Pan = panSlider1.Pan; player.Init(panningSampleProvider);

 

 

Nov 14, 2012 at 3:26 PM
Edited Nov 14, 2012 at 3:56 PM

Hello and Thanks!

 

I have already a IWavePlayer using a MeteringSampleProvider. So how can I use a MeteringSampleProvider and a PanningSampleProvider in the same Player? Does it work with Stereo Sound or just with Mono?

 

Moritz :)

 

Sorry for my bad English!

Coordinator
Nov 16, 2012 at 9:48 AM

You pipe them through each other. So pass the MeteringSampleProvider into the PanningSampleProvider (or the other way round, depending if you want to meter the sound before it is panned or not).

Mark