BASS_SFX v2.4.2.1 for winamp, sonique, bassbox, & WMP visual plugin support!

Started by RevG,

i00

When I call the resize:

BASSAPI.BASS_SFX_PluginResize(hSFX, 200, 200)
The plugin no longer displays in the picture box... it's just black ... any ideas?

Thanks
Kris

Knight_Rider

thank you very very much, i00, editing the project file worked perfectly! :)

i00

no prob...

anyone got an answer to my resize sfx question ... 2 posts above?

Thanks
Kris

radio42

May be there should be seperate functions:
a) one set of functions for WinForms (like in previous BASS_SFX versions)
b) and one set of functions for WPF

What do you think?!

i00

I Posted this in another thread - but after no replies thought I'd post it here:

Hello all -

I program in VB.Net and get the following error occasionally when cleaning up after I have finished playing a media file ...
can anyone tell me what I am doing wrong - seems to be after an hour of playing or so ... so maybe I am not cleaning up correctly?
The error is:

System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>Jukebox.vshost.exe</AppDomain><Exception><ExceptionType>System.AccessViolationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</Message><StackTrace>   at BASSAPI.BASS_SFX_PluginFree(Int32 handle)
   at Main.Stop(Boolean CloseAlso)
   at Main.Finalize()</StackTrace><ExceptionString>System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at BASSAPI.BASS_SFX_PluginFree(Int32 handle)
   at Main.Stop(Boolean CloseAlso)
   at Main.Finalize()</ExceptionString></Exception></TraceRecord>

And the finialize and stop code are as follows (as you can see i added a comment to the line that is erroring):

   Protected Overrides Sub Finalize()
        [Stop](True)
        tmrVidUpdate.Dispose()
        tmrVidUpdate = Nothing
        If VideoObject IsNot Nothing Then
            RemoveHandler VideoObject.Resize, AddressOf Form_Resize
        End If
        MyBase.Finalize()
    End Sub

    Public Sub [Stop](Optional ByVal CloseAlso As Boolean = True) Implements Media_Player.iMediaGeneric.Stop
        BASSAPI.BASS_ChannelStop(hStream)
        If CloseAlso Then
            'close the file
            'Stop the vis
            tmrVidUpdate.Enabled = False
            BASSAPI.BASS_SFX_PluginStop(hSFX)
            BASSAPI.BASS_SFX_PluginFree(hSFX) ' ERRORING ON THIS LINE???
            BASSAPI.BASS_StreamFree(hStream)

            PlayState = Media_Player.MeidaPlayStates.NoFile
        Else
            'just stop it

            PlayState = Media_Player.MeidaPlayStates.Stopped
        End If
    End Sub

I can post more code if required

And I use BASS_SFX to display a visual also

Thanks in advance
Kris

xtremex_x

my vb6 application crashes everytime i use BASS_SFX_PluginResize
i use sonique visualizations

james2k2

<Message removed by me>
Reason: I realised that this had been covered previously and made changes to my code.

Thanks everybody :)
Posted on: 24 Dec '09 - 10:51
<Message removed by me>
Reason: I realised that this had been covered previously and made changes to my code.

Thanks everybody :)

aybe

Hi,

I can't make Winamp plugins working, (Win7/x64)

  • When using vis_avs.dll from BASS_SFX zip, the AVS window displays for one second, then application crash. (nothing is rendered for this visualization)
  • When copying vis_avs.dll from Winamp, the returned handle is always -1.

   
            _ptrHdc = GetDC(pictureBox9.Handle);
            _ptrAvs = BASS_SFX_PluginCreate("plugins\\vis_avs.dll", _ptrHdc, pictureBox9.Width, pictureBox9.Height, 0);
           
            if (!BASS_SFX_PluginSetStream(_ptrAvs,_ptrFile))
            {
                int code = BASS_SFX_ErrorGetCode();
            }


(I use PluginSetStream because it shows up the AVS window)

That works fine with other plugins, what's wrong ?

Thank you,  ;D

stevenmmm

O'm also having problems getting any winamp plugins to work (on XP).
Calling BASS_SFX_PluginCreate always returns -1, including when setting the parameters to 0.
Its fine for all other supported plugin types though

I noticed in the next phase notes that there are some fixes coming for winamp 5 plugins, but has anyone been able to get any winamp plugins working?

aybe

Hi,

I think I was getting -1 when I wasn't using GetDc().

Somewhere in this forum I did read that, if you can't find it, here's the GetDc signature :

        [DllImport("User32.dll")]
        public static extern IntPtr GetDC(IntPtr hWnd);

The example I posted above works but crashes of course when it's a Winamp plugin.

We need to find out !  ;)

 :D

stevenmmm

in my case i was incorrectly trying to open an .avs file directly, when i should have been opening vis_avs.dll
it now works fine for me

aybe, i think for winamp plugins they open in their own fake winamp window so you shouldn't need to open a device context. I'm just passing in zeros for the BASS_SFX_PluginCreate parameters

stevenmmm

here you go:
hSFX = BASS_SFX_PluginCreate("vis_avs.dll", IntPtr.Zero, 1, 1, 0)

just a complete guess, but if you are using .NET on a 64 bit environment you might want to try setting the target build to 32 bit only rather than Any Cpu

aybe

Sorry that doesn't work either !
The project has been set to x86 already.

Could you share your vis_avs.dll ?

Thank you  :D

Lukas

I am trying to render the plugins to an in-memory bitmap instead of a control. I want to render these into my own UI system. However this does only work with WMP and Sonique plugins but not with Bassbox, which is very sad since Bassbox effects are very nice!

I modified the C# sample where I assign the in-memory bitmaps to the Image property of the PictureBoxes. So you can reproduce the problem easily. Please modify the Form1.cs as follows:


        Graphics graphics1; // these are needed as additional members of frmMain...
        Graphics graphics2;
        Graphics graphics3;

        private void frmMain_Load(object sender, EventArgs e)
        {
            int width = 192;
            int height = 192;
            int bpp = 24;
            int stride = width * bpp + 7 / 8;
            int numBytes = height * stride;
            System.Drawing.Imaging.PixelFormat format = System.Drawing.Imaging.PixelFormat.Format24bppRgb;

            // create in-memory bitmaps
            Image image1 = new Bitmap(width, height, stride, format, Marshal.AllocCoTaskMem(numBytes));
            Image image2 = new Bitmap(width, height, stride, format, Marshal.AllocCoTaskMem(numBytes));
            Image image3 = new Bitmap(width, height, stride, format, Marshal.AllocCoTaskMem(numBytes));

            // create graphics object from bitmaps
            graphics1 = Graphics.FromImage(image1);
            graphics2 = Graphics.FromImage(image2);
            graphics3 = Graphics.FromImage(image3);

            // assign bitmaps to PictureBox
            m_oVisPanel.Image = image1;
            m_oVisPanel2.Image = image2;
            m_oVisPanel3.Image = image3;

            // not needed, we use our own hdc in the timer method
            //hVisDC = m_oVisPanel.CreateGraphics().GetHdc();
            //hVisDC2 = m_oVisPanel2.CreateGraphics().GetHdc();
            //hVisDC3 = m_oVisPanel3.CreateGraphics().GetHdc();

            (... continue from here normally with BASS_Init as in sample!)
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            // get hdc for in-memory bitmaps (needs to be done every render pass)
            hVisDC = graphics1.GetHdc();
            hVisDC2 = graphics2.GetHdc();
            hVisDC3 = graphics3.GetHdc();

            // render to bitmaps
            bool success = false;
            if (hSFX != -1)
                success = BASS_SFX_PluginRender(hSFX, hStream, hVisDC);
            if (hSFX2 != -1)
                success = BASS_SFX_PluginRender(hSFX2, hStream, hVisDC2);
            if (hSFX3 != -1)
                success = BASS_SFX_PluginRender(hSFX3, hStream, hVisDC3);

            // release hdc
            graphics1.ReleaseHdc();
            graphics2.ReleaseHdc();
            graphics3.ReleaseHdc();

            // invalidate picture boxes to update the UI
            m_oVisPanel.Invalidate();
            m_oVisPanel2.Invalidate();
            m_oVisPanel3.Invalidate();
        }


It would be great if you could look into this issue. The bitmap dc should behave just like any other dc. I don't know if you are doing something fancy with them in the Bassbox adapter code, but none of the Bassbox plugins work with this code.

Please note that currently all plugins except for Sonique return false on the render call, even with the normal sample code where everything works great. Seems like a bug to me, but it has nothing to do with my problem.

Lukas

It's great to have the sources at hand, thanks so much for your work Greg!!  8)

I debugged into it and played around a while. Finally I found out that I need a different PixelFormat descriptor for the creation of the OpenGL context. I will try to create a working solution which includes an additional flag that enables both BassBox and Sonique (in OpenGL mode) to render to a bitmap instead of a window DC. The vSync also needs to be disabled for bitmap rendering. I will post the code when I have it ready and cleaned up!

Cryptit

Hello Greg,

at first thanks a lot for this plugin and the additional sourcecode.

Anyway, there are a few problems and missing functionality compared to Bass_Vis. Emil did a great job on this Visualization Plugin, sadly he stopped the work on it.

So at the moment we have one Bass24 supported Vislib, but still missing functionality like embedded Winamp windows, Config Dialogs (like BassVis_Config), Clicks on the DC etc.

Also there are minor problems with Bass_SFX_PluginResize, rendering to bitmaps and lot of other wishes :D

Some of us are programmers, but not many have the knowledge about these kind of byteshifting and opengl-magic. So i personally hope that you're able to extend the functionallity of this lib also in the near future.

Well, have seen your last post on 3rd December, so hopefully you got a good start into the new year :)

Cryptit

RevG

Quote from: CryptitHello Greg,

at first thanks a lot for this plugin and the additional sourcecode.

Anyway, there are a few problems and missing functionality compared to Bass_Vis. Emil did a great job on this Visualization Plugin, sadly he stopped the work on it.

So at the moment we have one Bass24 supported Vislib, but still missing functionality like embedded Winamp windows, Config Dialogs (like BassVis_Config), Clicks on the DC etc.

Also there are minor problems with Bass_SFX_PluginResize, rendering to bitmaps and lot of other wishes :D

Some of us are programmers, but not many have the knowledge about these kind of byteshifting and opengl-magic. So i personally hope that you're able to extend the functionallity of this lib also in the near future.

Well, have seen your last post on 3rd December, so hopefully you got a good start into the new year :)

Cryptit

Hi

I definitely have some work to do in regards to winamp plugins and other bug fixes / improvements. I will do my best to get these problems/features sorted out. It is a busy time of year for me right with taxes and many other things, but I will make time for these improvements. :)

Cheers,
Greg

luke

Hey Greg,

I have successfully solved the Bitmap issue. With this fix it is possible to render Sonique, Bassbox and part of the WMP plugins to bitmap. Sadly some of the WMP plugins use the window handle to directly draw to the window surface instead of using the passed DC, these cannot be used. But the others work fine. This will also enable usage of BASS_SFX in WPF environment, I read some questions about that here.

I also fixed some other smaller issues. I am away now for a few days but after that I will contact you and send you the new sources.

It would be really great if you could get embedded WinAmp plugins to work properly!! At least the most important ones like AVS and perhaps Milkdrop. Somehow this must be possible, it was working with BassVis too. The WinAmp plugins are really the best and most efficient ones out there and steadily there are new effects being developed for AVS and Milkdrop. Would be really great to be able to utilize them!

Cheers

Guest

Quoteit was working with BassVis too
YES !!
i have hard work on it and not used stolen source code without permission of other USER
i will be warn do copy/paste any of my source (translate, decompile) or other in to SFX then you has a great problem.
They do not live in a legal vacuum.

JA !!
Ich habe hart und lange daran gearbeitet und verwende keinen gestohlenen Quelltext anderer Authoren ohne deren einwilligung.
Ich will dich warnen kopiere/füge/übersetze/dekompiliere keinen Quelltext von meiner Anwendung und verwende sie in SFX dann hast du ein großes problem.
Sie leben nicht in einem Rechtsfreien Raum.