Bass_SFX and visualisation in general

Started by IdiocyMachine,

IdiocyMachine

Hi all
i was lurking for manage some visualizations like sonique plugins or winamp etc...
I noticed time ago the existence of BASS_SFX that load\display\resize\dowhateveryouwant with the plugin you load.
I also noticed  that under windows 7 x86\x64 it likes so much eating hundreds MB of my poor ram.

My project is a player, you can jump from an effect to another with a click, but i think there's something wrong...
Let's see if some of you guys could help a poor soul like me :)

I'm working in .Net, and i know you aren't all .nt guys but I believe you can understand the code ( i reduced it a "bit")


'Form loaded, get the panel handle and freeing memory
hVisDC = GetDC(VideoPanel.Handle)
BassSfx.BASS_SFX_Free()
BassSfx.FreeMe()

'Loading audiofile, load effect
BassSfx.BASS_SFX_PluginFree(hSFX)
hSFX = BassSfx.BASS_SFX_PluginCreate(pathofmyeffectsvp, VideoPanel.Handle, VideoPanel.Width, VideoPanel.Height, BASSSFXFlag.BASS_SFX_DEFAULT)
 BassSfx.BASS_SFX_PluginSetStream(hSFX, AudioStream)

'Playing audiofile, render the effect
BassSfx.BASS_SFX_PluginRender(hSFX, AudioStream, hVisDC)

'Changing effect, freeing memory and load other effect and re-render
BassSfx.BASS_SFX_PluginFree(hSFX)
hSFX = BassSfx.BASS_SFX_PluginCreate(pathofmyeffectsvp, VideoPanel.Handle, VideoPanel.Width, VideoPanel.Height, BASSSFXFlag.BASS_SFX_DEFAULT)
 BassSfx.BASS_SFX_PluginSetStream(hSFX, AudioStream)
BassSfx.BASS_SFX_PluginStart(hSFX)


'stop the stream, freeing memory
 BassSfx.BASS_SFX_PluginStop(hSFX)
BassSfx.BASS_SFX_PluginFree(hSFX)



Now, it seems ok...i followed samples in the zip file i downloaded...playing 1\2 songs makes the application reach about 1-2 GB of ram...

How can I fix this, or better is there any better way to get some visualisation? BASS_SFX is stopped at february 2010... =(

Thanks all

EWeiss

der Schöpfer dieser library hat keinen Quelltext mehr gefunden zum Kopieren und Einfügen.
Deshalb hat dieser Kerl  aufgehört und hat kein Interesse mehr daran.

Du hast die Quelle dann ändere es selbst.
------------------------------------------------------------------------------------------
the creator of this library has not found a source more to copy and paste.
Why this guy stopped and no longer interested.

you has the source also fix it self.

greets



IdiocyMachine

Yeah, embedded visuals are cool in bass, but BASS_SFX let me load Sonique plugins and the issue is i nloading\unloading them.

Chorus

#5
Okay, I wrote my own codes and tried creating a visual which is 1000x700 and tested the memory consumption. It didnt go over 32mb to the end of the song

Here what it is:

Imports Un4seen.Bass
Public Class Form1
    Dim AudioStream, hSFX As Integer
    Dim hVisDC As IntPtr
    Dim WithEvents Timer1 As New Timers.Timer

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Try
            Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)
            AudioStream = Bass.BASS_StreamCreateFile("D:\a.mp3", 0, 0, BASSFlag.BASS_DEFAULT)
            Bass.BASS_ChannelPlay(AudioStream, False)
            AddOn.Sfx.BassSfx.BASS_SFX_Init(Process.GetCurrentProcess.Handle, Me.Handle)
            hSFX = AddOn.Sfx.BassSfx.BASS_SFX_PluginCreate("D:\a.svp", IntPtr.Zero, 1000, 700, AddOn.Sfx.BASSSFXFlag.BASS_SFX_DEFAULT)
            AddOn.Sfx.BassSfx.BASS_SFX_PluginSetStream(hSFX, AudioStream)
            AddOn.Sfx.BassSfx.BASS_SFX_PluginStart(hSFX)
            hVisDC = VideoPanel.CreateGraphics.GetHdc
            Timer1.Interval = 5
            Timer1.Start()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

    End Sub

    Private Sub Timer1_Tick() Handles Timer1.Elapsed

        Try
            AddOn.Sfx.BassSfx.BASS_SFX_PluginRender(hSFX, AudioStream, hVisDC)
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

    End Sub

    Private Sub VideoPanel_Click(sender As System.Object, e As System.EventArgs) Handles VideoPanel.Click

        Try
            Timer1.Stop()
            AddOn.Sfx.BassSfx.BASS_SFX_PluginStop(hSFX)
            AddOn.Sfx.BassSfx.BASS_SFX_PluginFree(hSFX)
            hSFX = AddOn.Sfx.BassSfx.BASS_SFX_PluginCreate("D:\a.svp", IntPtr.Zero, 1000, 700, AddOn.Sfx.BASSSFXFlag.BASS_SFX_DEFAULT)
            AddOn.Sfx.BassSfx.BASS_SFX_PluginSetStream(hSFX, AudioStream)
            AddOn.Sfx.BassSfx.BASS_SFX_PluginStart(hSFX)
            Timer1.Start()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

    End Sub

End Class

"VideoPanel" is a picturebox here and Form1 is a form :D

Let me know if this works for you! :)