Author Topic: BASS_SFX v2.4.2.1 for winamp, sonique, bassbox, & WMP visual plugin support!  (Read 275062 times)


  • Posts: 8
Hi all
little question, why is bass_Sfx rendering eating so much memory?
I downloaded the last version of course.
Running the same application in Windows XP tooks 37 MB in RAM, the same program under Windows 7 (I didn't try on Vista) starts to eat hundreds MB.
the code is ok, I use Vb.Net on Vs2010 but i don't believe it's very important.
Maybe there is some issue in freeing memory?



  • Posts: 28

Sorry if this has already been posted but this thread is very long. :P

I have just downloaded the C# examples and I have gotten the plugins to work by moving some dlls and folders into the bin folder. However, I have a strange crash with the Winamp MilkDrop plugin. It starts fine, I give it focus and press F1 and the help text shows up fine. However, if I press Alt+Enter it tries to enter fullscreen. I say "tries" because the screen goes black but there's nothing more on it. If I press Esc or Alt+Enter to exit fullscreen the application crashes.

I notice that even when I put the milkdrop inside a PictureBox instead of it's own window it will be put inside a newly created window when fullscreen is exited. There's also another window called "Winamp..." something.

This happens on Windows 7 Ultimate 32-bit. Fullscreen visuals in Winamp works fine.


  • Posts: 180
I noticed that with this, the larger the window (using the Render method and a timer) the more CPU it uses. I had my CPU usage up to 83% (Core 2 Duo 1.87GHz) with a window size of 800x800  :-\
using sonique plugins by the way


  • Posts: 501
« Last Edit: 8 Jan '15 - 15:04 by EWeiss »


  • Posts: 24
Is it possible for the winamp karaoke plug-in to be used with BASS_SFX?





  • Guest
Could anyone still use the BASS_SFX in WPF (Windows Presentation Foundation)?


  • Posts: 2
So, what's wrong with plugin support?


  • Posts: 2
Could anyone still use the BASS_SFX in WPF (Windows Presentation Foundation)?
After several month I've returned to solving of this question.
Here is some fully working solution, but perhaps someone has more elegant solution. Or maybe this one can be optimized? I will discuss it with pleasure!
In short, the idea is: To render visualization plugin in memory and put content into Image.Source.

Code: [Select]
<UserControl x:Class="Project.soundVisualizer"
        <Image x:Name="visualizerImageControl" Width="800" Height="480" />
Code: [Select]
namespace Project
    public partial class soundVisualizer : UserControl
        private static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);

        private static extern IntPtr CreateCompatibleDC(IntPtr hdc);

        private static extern IntPtr SelectObject(IntPtr hdc, IntPtr bmp);

        private static extern IntPtr DeleteDC(IntPtr hDc);

        private static extern IntPtr DeleteObject(IntPtr hDc);

        private static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop);

        private const uint SRCCOPY = 0x00CC0020;
        int hSFX = 0;

        private DispatcherTimer animationTimer;

        public soundVisualizer()

            hSFX = BassSfx.BASS_SFX_PluginCreate("plugins\\rabbithole11.svp", IntPtr.Zero, (int)visualizerImageControl.Width, (int)visualizerImageControl.Height, 0); // Visualization plugin "rabbithole11.svp" is using here
            BassSfx.BASS_SFX_PluginSetStream(hSFX, ActiveStreamHandle); // ActiveStreamHandle - handle of Un4seen.Bass.Bass.BASS_StreamCreateFile

            animationTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle);
            animationTimer.Interval = TimeSpan.FromMilliseconds(42); // Approximate refresh rate is 24 fps
            animationTimer.Tick += new EventHandler(animationTimer_Tick);

            if (hSFX != -1)
        private void animationTimer_Tick(object sender, EventArgs e)
            if (hSFX != -1)
// Create an empty bitmap, Create graphics object to draw (in memory)
                System.Drawing.Bitmap bm = new System.Drawing.Bitmap((int)visualizerImageControl.Width,(int)visualizerImageControl.Height);
                System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bm);
                IntPtr ghDC = g.GetHdc();
                g.Dispose(); // Prevent memory leaks
// Render plugin content in memory
                BassSfx.BASS_SFX_PluginRender(hSFX, BassProcessor.ActiveStreamHandle, ghDC);
// Copy rendered device context content to bitmap
                IntPtr hMemDC = CreateCompatibleDC(ghDC);
                IntPtr hBitmap = CreateCompatibleBitmap(ghDC, (int)visualizerImageControl.Width, (int)visualizerImageControl.Height);
                SelectObject(hMemDC, hBitmap);
                BitBlt(hMemDC, 0, 0, (int)visualizerImageControl.Width, (int)visualizerImageControl.Height, ghDC, 0, 0, SRCCOPY);
                DeleteDC(hMemDC); // Prevent memory leaks
                bm.Dispose(); // Prevent memory leaks
                bm = System.Drawing.Image.FromHbitmap((IntPtr)hBitmap);
                DeleteObject(hBitmap); // Prevent memory leaks
// Convert System.Drawing.Bitmap to System.Windows.Media.Imaging.BitmapImage
                MemoryStream ms = new MemoryStream();
                bm.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
                BitmapImage bImg = new BitmapImage();
                bImg.StreamSource = new MemoryStream(ms.ToArray());
                visualizerImageControl.Source = bImg;
« Last Edit: 22 Dec '11 - 04:24 by Balagun »


  • Posts: 933
Seems BASS_SFX doesn't support 32bit channels for Sonique plugins.
Is it possible to add a little code to if channel is 32bit convert the sample data to 16bit before passing it to Sonique plugins?


  • Posts: 15
Hi dev,
There's a bug in BASS_SFX library, thats to the Napalm for pointing out the bug.
At line 179 in BASS_SFX.cpp you have used delete m_aryPlugins[0]; don't you think that it must be like delete m_aryPlugins[ i ]; ?

Here is the correct code :
Code: [Select]
#pragma region BASS_SFX_Free
for(int i=0;i<m_nPluginCount-1; i++)
if(m_aryPlugins[i]!= NULL)
delete m_aryPlugins[i];
m_aryPlugins[i] = NULL;

return FALSE;
#pragma endregion


  • Posts: 933
Okay, here's my first C++ code ever: ;D

BASS_SFX for mixer source channels - a version of BASS_SFX to be used with channels that have buffering enabled and are plugged into a mixer - specially for ASIO/WASAPI usage.
Also added support for 32bit float channels (note that the data is handled as max. stereo).

Not much tested, please tell me if you find some bugs.

Download: BASS_SFX for mixer source
Source code: BASS_SFX for mixer source channels

Note that you also need the API files from the first post to use it.
« Last Edit: 25 Jan '13 - 15:18 by 3delite »


  • Posts: 129
i'm really pleased you did this and it works really well in my testing using WASAPI. Thanks for that.

If you are planning to spend more time on it there are a couple of problems i am aware of (already existing problems):
- the bassbox plugins just refuse to display on one of my machines (all my pc's are very vanilla)
- on some users pc's the winamp milkdrop visualiser crashes (works fine for me in all cases)


  • Posts: 19
I have a problem with bass_sfx.
The command:
Code: [Select]
hSFX = BASS_SFX_PluginCreate(Application.StartupPath & "\Visualizations\" & My.Settings.Visualizations, m_oVisPanel.Handle, m_oVisPanel.Width, m_oVisPanel.Height, 0)
At compiling returns hSFX=1 and everything is OK
Running exe from "bin/release" folder of returns hSFX=1 and everything is OK
If I copy the whole folder to any other directory returns hSFX=-1 and the m_oVisPanel is black!

Can anyone help me please?


  • Posts: 933
Thank you stevenmmm!

I'll see the issues you wrote if I have time.

weril: no idea sorry, 1 thing you could try is test the same path string with a FileExists() function, to see if the path is correct.

A little update (2 versions):

1. BASS_SFX for mixer source channels with fallback to normal
- If BASS_Mixer_ChannelGetData() returns -1 (that is the channel isn't useable with BASS_Mixer_ChannelGetData() - not plugged into a mixer/no buffering enabled) then the normal BASS_ChannelGetData() is called.
Made this version so you can use it with a mixer source channel and also with a normal channel like HRECORD too.
- Added 32bit float clipping correction (if sample value falls outside byte range it is capped).
- Note that it is statically linked to BASSMix.dll.
DLL: BASS_SFX for mixer source channels with fallback to
Source: BASS_SFX for mixer source channels with fallback to normal

2. BASS_SFX for mixer source channels and WASAPI with fallback to normal
- Same as above but with WASAPI support.
- If you want to use with (visualize) WASAPI output, specify 1 as channel handle.
- Note that it is statically linked to BASSWASAPI.dll
DLL: BASS_SFX for mixer source channels and WASAPI with fallback to
Source: BASS_SFX for mixer source channels and WASAPI with fallback to normal


  • Posts: 19
Thank you but unfortunately "file.exists(...) = true" for all occasions.  :'(


  • Posts: 19
Thank you but unfortunately "file.exists(...) = true" for all occasions.  :'(

I found the reason of my problem.
It seems that BASS_SFX plugin doesn't work when the .svp file's address has greek characters.


  • Posts: 6
How do you set the text that appears and wobbles about in Milkdrop? (there used to be BASS_WA_SetSongTitle)


  • Posts: 15
HI,RevG , What is the latest edition of  BASS_SFX project ? Do you intend to continue to update it? I hope that . Thank you!