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

Knight_Rider

  • Posts: 131
well but i asked myself how it would be possible to use this plugin on a 64 bit os!

Patrice Terrier

  • Posts: 108
No problem to use them on a 64-bit OS as long as you compile the main application into 32-bit (then wow64 will take care of it).

...

Knight_Rider

  • Posts: 131
well, i tried that, but the problem is that i get the error message "es wurde versucht, eine datei im falschen format zu laden" (something like "you tried to load a file in the wrong format" in engl.) everytime i run anything that has to do with bass_sfx (f.e. bass_sfx_init).
get this problem even with the B_SFX VB.Net sample project files...

radio42

  • Posts: 4839
That simply means that are either trying to load 32-bit dlls from a 64-bit app or 64-bit dlls from a 32-bit app.
When you are changing you app to be a 32-bit app - you of course again need the 32-bit BASS dlls!

Knight_Rider

  • Posts: 131
ah thanks radio, i used the 64-bit bass dlls indeed :) but if i change them back to the 32-bit ones, the app crashes... what do i have to change that it will run as a 32-bit app?

Patrice Terrier

  • Posts: 108
Check the target platform of your compiler.

...

Knight_Rider

  • Posts: 131
well visual basic 2008 express edition doesn't seem to allow me changing this thing... it is set to "Any CPU"...

radio42

  • Posts: 4839
"Any CPU" means your app will automatically run as a 32-bit app on a 32-bit OS and as a 64-bit app on a 64-bit OS.
I don't use VSExpress myself, but normally you'll find the 'Target Platform' under the "Build" settings in the project properties.

If you really can not change it with VSExpress, I guess you might want to switch to a regular VS version?!

Knight_Rider

  • Posts: 131
yeah i tried to change it in the project properties ;)

well, no i guess not... as i'm only 16 and as the media player is just a fun project i guess that i'll have to live without visualization... it's a shame that it doesn't work on a 64-bit os with the express edition... and it really isn't possible to avoid this conflict? so many bass-addons are already 64-bit...

i00

  • Posts: 27
Well express is very limited ... there is an open source version of visual studio that u should be able to change it in though ... its called sharp develop ... i use it over express any day :) -

Advantages over express:
bin is only 20mb's or so
quicker to install
u can make services
deploy it for any cpu
supports all .Net languages :) - ie you don't have to download vb express / c# express ... etc ... supports them all ... and a few other languages ... with plugins ;)
Prob more

You could also change it in the vbproj file manually - open it in notepad - search for <PlatformTarget> and change it to x86:<PlatformTarget>x86</PlatformTarget>

Hope that helps
Kris

i00

  • Posts: 27
When I call the resize:

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

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

i00

  • Posts: 27
no prob...

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

Thanks
Kris

radio42

  • Posts: 4839
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

  • Posts: 27
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:

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

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

  • Posts: 10
my vb6 application crashes everytime i use BASS_SFX_PluginResize
i use sonique visualizations

james2k2

  • Posts: 29
<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 :)
« Last Edit: 29 Dec '09 - 23:03 by james2k2 »

aybe

  • Posts: 162
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.

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

  • Posts: 131
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

  • Posts: 162
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 :

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

  • Posts: 131
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

aybe

  • Posts: 162
Can you post the initialization code you're using ?

Thank you  ;D

stevenmmm

  • Posts: 131
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

  • Posts: 162
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

  • Guest
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.