Author Topic: Problems setting waveform properties  (Read 62 times)


  • Posts: 136
Problems setting waveform properties
« on: 22 Sep '22 - 14:12 »
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:

Code: [Select]
Private MyWaveForm As New WaveForm
    Private _WaveForm As Bitmap

MyWaveForm = New WaveForm("C:\Test.mp3")
                MyWaveForm.ColorBackground = System.Drawing.Color.Black


                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:

Code: [Select]
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...:

Code: [Select]
Public Sub New (
fileName As String,
win As Control
« Last Edit: 23 Sep '22 - 08:39 by kafffee »


  • Posts: 136
Re: Problems setting waveform properties
« Reply #1 on: 30 Sep '22 - 14:09 »
OK I got the solution on myself  :D

You had to use bass_fx.dll in order to detect and draw beat lines...

@Ian @ un4seen

I'm sure you have a reason why you haven't done this yet, but if not, you might want to think about indicating an error via Bass.BASS_ErrorGetCode that bass_fx.dll has to be loaded when using WaveForm.DetectBeats... just an idea  :)
« Last Edit: 30 Sep '22 - 14:40 by kafffee »