Hey guys :-)
I am about to implement a waveform to my application, and everything works fine, except for the fact that when I set the properties affecting the appearance of my waveform, the do not seem to apply and I get a blank picture. I am doing this in VB.Net:
Private MyWaveForm As New WaveForm
Private _WaveForm As Bitmap
MyWaveForm = New WaveForm("C:\Test.mp3")
MyWaveForm.ColorBackground = System.Drawing.Color.Black
InitializeWaveForm()
MyWavForm.RenderStart(True, BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_STREAM_PRESCAN Or BASSFlag.BASS_DEFAULT)
MyWaveForm.SyncPlayback(_stream)
While Not MyWaveForm.IsRendered
End While
_WaveForm = New Bitmap(MyWaveForm.CreateBitmap(TransformToPixels(Width) * Zoom, TransformToPixels(Height), -1, -1, True))
WaveFormSource = BitmapToImageSource(_WaveForm)
Now this is the problem:
Private Sub InitializeWaveForm()
MyWaveForm.ColorLeft = System.Drawing.Color.Aquamarine
MyWaveForm.ColorLeftEnvelope = System.Drawing.Color.Red
MyWaveForm.ColorMiddleLeft = System.Drawing.Color.Aquamarine
MyWaveForm.ColorRight = System.Drawing.Color.Aquamarine
MyWaveForm.DrawCenterLine = True
MyWaveForm.DrawEnvelope = False
MyWaveForm.DetectBeats = True
MyWaveForm.BeatLength = 1.0
MyWaveForm.BeatWidth = 1
MyWaveForm.DrawBeat = WaveForm.BEATDRAWTYPE.TopBottom
MyWaveForm.ColorBeat = System.Drawing.Color.Yellow
MyWaveForm.DrawMarker = WaveForm.MARKERDRAWTYPE.Line Or WaveForm.MARKERDRAWTYPE.Name Or MyWaveForm.MARKERDRAWTYPE.NamePositionMiddle
MyWaveForm.DrawWaveForm = WaveForm.WAVEFORMDRAWTYPE.Stereo
End Sub
When I call this, I get no picture at all and the application window gets stuck, otherwise I get the waveform in the default appearance...
There is ErrorCode 0 on all calls inside InitializeWaveForm().
EDIT: I found out about it: It's the While...End While loop. But when I skip that, the created bitmap shows nothing but the center line. I guess this is because its not done rendering....
How can I approach this? It's a WPF application and no WinForms app, so I guess I cannot use the callback function WAVEFORMPROC, because it requires a WinForms control...:
Public Sub New (
fileName As String,
proc As WAVEFORMPROC,
win As Control
)