A
aweaver6142
Guest
Hi,
I have been really struggling to create a master system volume visualization that either isn't terribly slow (using a progressBar) or doesn't completely block my program (using NAUDIO). Microsoft seems capable of making them real time and animate quickly. (just look at the sound applet in the control panel)
Does anyone have any idea what control Microsoft is using to create this?
here was my attempt:
var capture = new WasapiLoopbackCapture();
capture.DataAvailable += OnDataAvailable;
capture.StartRecording();
void OnDataAvailable(object sender, WaveInEventArgs args)
{
float max = 0;
var buffer = new WaveBuffer(args.Buffer);
for (int index = 0; index < args.BytesRecorded / 4; index++)
{
var sample = buffer.FloatBuffer[index];
if (sample < 0) sample = -sample;
if (sample > max) max = sample;
double level = 100 * max;
uiContext.Send(x => progressBar.Value = level, null);
}
The problem(s) with the code above is that the progressbar update takes forever so it is always behind and also when you close the Window it keeps running forever.
Continue reading...
I have been really struggling to create a master system volume visualization that either isn't terribly slow (using a progressBar) or doesn't completely block my program (using NAUDIO). Microsoft seems capable of making them real time and animate quickly. (just look at the sound applet in the control panel)
Does anyone have any idea what control Microsoft is using to create this?
here was my attempt:
var capture = new WasapiLoopbackCapture();
capture.DataAvailable += OnDataAvailable;
capture.StartRecording();
void OnDataAvailable(object sender, WaveInEventArgs args)
{
float max = 0;
var buffer = new WaveBuffer(args.Buffer);
for (int index = 0; index < args.BytesRecorded / 4; index++)
{
var sample = buffer.FloatBuffer[index];
if (sample < 0) sample = -sample;
if (sample > max) max = sample;
double level = 100 * max;
uiContext.Send(x => progressBar.Value = level, null);
}
The problem(s) with the code above is that the progressbar update takes forever so it is always behind and also when you close the Window it keeps running forever.
Continue reading...