wpf custom control: audiowaveform rectangle with selection slider
I'm working on a c# wpf app in which I want to do something with audio. the irrklang audio library provides me with a pcm decoded 16 bit byte array.
I want to create a timeline control which shows the waveform along the timeline with an overlaying rectangle which the user can drag and click/drag the left and right side to increase or decrease the selection.
It is used to the trim the audio track. I would like the selected min and max to be databindable, the minimum and maximum value of the total track to be bindable.
To clarify here is an image mockup:
I'm not asking for a complete contro开发者_如何学运维l but tips and suggestions on how to tackle this are more than welcome. Perhaps solutions like this already exist but so far I haven't been able to find it.I think I need to tackle: the control (zooming, panning and changing the selection) and drawing the waveform in the control
Thanks in advance,
I think you should check out this codeplex project http://wpfsvl.codeplex.com/
Refer to Audio WaveForm Drawing Using WPF.
Something based upon WaveFileTrimmerControl.xaml would be useful, it uses related controls PolygonWaveFormControl.xaml & RangeSelectionControl.xaml (links are to the XAML but refer to the CS also). In any case it'd be a good starting point for building a control that exactly meets what you want.
You could override the render method and use primitives which will give possibly better performance; but like anything related to performance I'd try the above approach first which is almost certainly good enough.
精彩评论