Hello!
I have a big Problem with BASS_CDG. First of all everything works. But when I start the CDG Playback, the memory consumption rises from 18MB to over 400MB in small steps. I have found out that the Problem is in the Timer Event in this row:
bmptemp = BassCdg.BASS_CDG_GetCurrentBitmap(mMP3Stream)
Here is my Code:
BassInitialisation:
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)
StartPlayback:
Dim PlugIn As Integer = 0
Dim PlugInFX As Integer = 0
If mMP3Stream <> 0 Then Bass.BASS_StreamFree(mMP3Stream)
PlugIn = Un4seen.Bass.Bass.BASS_PluginLoad("bass_cdg.dll")
'set this to enable user drawing
BassCdg.BASS_CDG_SetConfig(Un4seen.Bass.AddOn.Cdg.BASSCDGConfig.BASS_CDG_USERDRAW, 1)
If PlugIn <> 0 Then
' Create the CDG Stream
mMP3Stream = Bass.BASS_StreamCreateFile(tbFileName.Text, 0, 0, BASSFlag.BASS_UNICODE)
'Make mCDGForm -> A Form to Display the CDG
ShowCDGForm()
'and finally play the stream
Bass.BASS_ChannelPlay(mMP3Stream, False)
'!!! Start the Timer to Display the Bitmaps in UserDrawMode
Timer1.Enabled = True
End If
...and here the TimerCode:
If mMP3Stream <> 0 Then
Dim bmptemp As IntPtr
Dim bmpdb As Bitmap
'Bild in Bitmap umwandeln und vertikal spiegeln
bmptemp = BassCdg.BASS_CDG_GetCurrentBitmap(mMP3Stream)
bmpdb = System.Drawing.Image.FromHbitmap(bmptemp)
bmpdb = System.Drawing.Image.FromHbitmap(BassCdg.BASS_CDG_GetCurrentBitmap(mMP3Stream))
bmpdb.RotateFlip(RotateFlipType.RotateNoneFlipY)
PictureBox1.Image = bmpdb
mCDGFormPic.Image = bmpdb
'Free
bmpdb = Nothing
bmptemp = Nothing
End If
I have no Idea what I can do now. The Problem exists in 64 and x86 Mode. The memory rises even if I shrink the Timer-Code to the problem row "BASS_CDG_GetCurrentBitmap". When I delete this row I have no memory problems.
Please help..
Vinvent Vega