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

Patrice Terrier

  • Posts: 108
I am speaking about the example code that is provided with Greg's demo (written in C++)
I can't get it to work by me.

smeesseman

  • Posts: 6
Here is some code C# which is actually working fine here:
Thanks for your help.  This is how my code is, exactly (well, it is now, the code I put in above was my first effort but since have changed it all to just about exactly what you listed).  For some reason though the PluginRender() calls start failing 30-40 seconds in to playing the visual though, visual stops updating, and all subsequent calls to BASS_SFX_PluginRender() fail.  If I free that SFX handle, and create a new one, it works again, but for the same specified time.  I think it has something to do with timers elsewhere in our app, but bass_vis worked without issue before, so I'm just wondering what could actually cause PluginRender() to return false all of a sudden?
You are the one who handles BASS.NET?  Nice to meet ya', I'm Scott, I work for David and Flux Media...
« Last Edit: 7 Apr '09 - 09:46 by smeesseman »

radio42

  • Posts: 4576
Hi Scott,

are you possibly using BASS_SFX_PluginRender with Winamp plugins - as you should only use BASS_SFX_PluginRender with Sonique, BassBox or WMP visual plugins.

RevG

  • Posts: 454
Greg,

I downloaded you BASS_SFX project to check how it works with BassBox plugins.

I have checked the SFXTest.exe located in the MFC\Bin folder.
I clicked on the Button "Create & Start", then i can see the "Oscilloscope" plugin in the small window located top left, but i can't hear anything nor see the animation playing.

I am using VISTA 64, and take this opportunity to inform you, that the BassBox plugins being Win32 DLLs, they can't be used from a 64-bit application.
C# VS does the wrong assumption (default) that it must create/work in 64-bit when compiled on a 64-bit computer, that is not yet the standard, thus better to switch the project to target the 32-bit mode.

But for the ultimate performance (real time application) it is better to use unmanaged code and the good unsafe pointers, after all we are programmers aren't we?  ;D

 

Wow, yes thank you. I tested on my vista 64 and it is producing the same results  ???
I am working now to find out what the problem is! I am indeed using 100% unmanaged code so I am not sure what is happening.

Cheers,
Greg

Patrice Terrier

  • Posts: 108
Quote
I am indeed using 100% unmanaged code
Then 100% of the code IS MANAGED BY YOU, that is what i call "programming" ;D ;D ;D

RevG

  • Posts: 454
Quote
I am indeed using 100% unmanaged code
Then 100% of the code IS MANAGED BY YOU, that is what i call "programming" ;D ;D ;D


Ah yes I totally agree with you!! In fact in my latest dj software I went with bare bones raw Win32 calls and you know what? My code was SO MUCH faster than even when I used *stupid MFC*!!! Raw Win32 is the way to go!!

I found the problem, I had a hard coded path to the royalty free music.mp3 instead of a relative path! I have uploaded the fixed project at the same link as in first post. http://www.cubesol.com/Files/BASS_SFX.zip

Cheers,
Greg

Patrice Terrier

  • Posts: 108
Quote
Raw Win32 is the way to go!!
Ah! Yes, they call it the flat API.
But i think you know my opinion already ;)

I shall test the new zip file and let you know.

...

Patrice Terrier

  • Posts: 108
Greg,

Yes, that does it.

Average CPU footprint is 40%, probably because of the loop animation you are using.
As a matter of comparison playing the same audio file with BassBox using the "Oscilloscope" running in full HD mode (1920 x 1080) i got an average of CPU 30%, that comes down to an average of 10% using the default size.

Good work anyway!!!

RevG

  • Posts: 454
Greg,

Yes, that does it.

Average CPU footprint is 40%, probably because of the loop animation you are using.
As a matter of comparison playing the same audio file with BassBox using the "Oscilloscope" running in full HD mode (1920 x 1080) i got an average of CPU 30%, that comes down to an average of 10% using the default size.

Good work anyway!!!


Yes also, in the example there is not only a BassBox plugin running, but also a windows media player plugin and a sonique plugin all playing simultaneously. If I run *only* oscilloscope at its current size I get  0% cpu :D

Patrice Terrier

  • Posts: 108
Then it is perfect  :)

RevG

  • Posts: 454
Here is some code C# which is actually working fine here:
Thanks for your help.  This is how my code is, exactly (well, it is now, the code I put in above was my first effort but since have changed it all to just about exactly what you listed).  For some reason though the PluginRender() calls start failing 30-40 seconds in to playing the visual though, visual stops updating, and all subsequent calls to BASS_SFX_PluginRender() fail.  If I free that SFX handle, and create a new one, it works again, but for the same specified time.  I think it has something to do with timers elsewhere in our app, but bass_vis worked without issue before, so I'm just wondering what could actually cause PluginRender() to return false all of a sudden?
You are the one who handles BASS.NET?  Nice to meet ya', I'm Scott, I work for David and Flux Media...

Hi Scott,

I have been working on a .NET example using C#. It will be uploading it shortly. In the mean time here is some sample code that I have working that you could try out. It uses the picturebox control for all rendering  :D

Edit:
I have uploaded a new package now complete with Visual Studio 2005 C# .NET example.  http://www.cubesol.com/Files/BASS_SFX.zip


Code: [Select]
[DllImport("bass.dll")]
        public static extern bool BASS_Init(int device, uint freq, uint flag, IntPtr hParent, uint GUID);

        [DllImport("bass.dll")]
        public static extern int BASS_StreamCreateFile(bool mem, [MarshalAs(UnmanagedType.LPWStr)] String str, long offset, long length, long flags);

        [DllImport("bass.dll")]
        public static extern uint BASS_ErrorGetCode();

        [DllImport("bass.dll")]
        public static extern bool BASS_Free();

        [DllImport("bass.dll")]
        public static extern bool BASS_StreamFree(int stream);

        [DllImport("bass.dll")]
        public static extern bool BASS_ChannelPlay(int stream, bool restart);

        [DllImport("bass.dll")]
        public static extern bool BASS_ChannelStop(int stream);

        [DllImport("bass_sfx.dll")]
        public static extern bool BASS_SFX_Init(IntPtr hInstance, IntPtr hWnd);

        [DllImport("bass_sfx.dll")]
        public static extern int BASS_SFX_PluginCreate(string file, int width, int height);

        [DllImport("bass_sfx.dll")]
        public static extern bool BASS_SFX_PluginStart(int handle);

        [DllImport("bass_sfx.dll")]
        public static extern bool BASS_SFX_PluginSetStream(int handle, int stream);

        [DllImport("bass_sfx.dll")]
        public static extern bool BASS_SFX_PluginRender(int handle, int hStream, IntPtr hDC);

        int hStream = 0;
        int BASS_UNICODE = -2147483648;

        int hSFX = 0;
        int hSFX2 = 0;
        int hSFX3 = 0;

        IntPtr hVisDC = IntPtr.Zero;
        IntPtr hVisDC2 = IntPtr.Zero;
        IntPtr hVisDC3 = IntPtr.Zero;
       
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            hVisDC = m_oVisPanel.CreateGraphics().GetHdc();
            hVisDC2 = m_oVisPanel2.CreateGraphics().GetHdc();
            hVisDC3 = m_oVisPanel3.CreateGraphics().GetHdc();

            if (BASS_Init(-1, 44100, 0, this.Handle, 0))
            {
                BASS_SFX_Init(System.Diagnostics.Process.GetCurrentProcess().Handle, this.Handle);

                hStream = BASS_StreamCreateFile(false, "music\\Matrix.mp3", 0, 0, BASS_UNICODE);
                BASS_ChannelPlay(hStream, false);

                hSFX = BASS_SFX_PluginCreate("plugins\\sphere.svp", m_oVisPanel.Width, m_oVisPanel.Height); //sonique
                hSFX2 = BASS_SFX_PluginCreate("plugins\\blaze.dll", m_oVisPanel2.Width, m_oVisPanel2.Height); //windows media player
                hSFX3 = BASS_SFX_PluginCreate("BBPlugin\\oscillo.dll", m_oVisPanel3.Width, m_oVisPanel3.Height); //bassbox

                BASS_SFX_PluginStart(hSFX);
                BASS_SFX_PluginStart(hSFX2);
                BASS_SFX_PluginStart(hSFX3);
                timer1.Interval = 27;
                timer1.Enabled = true;
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (hSFX != -1)
                BASS_SFX_PluginRender(hSFX, hStream, hVisDC);
            if (hSFX2 != -1)
                BASS_SFX_PluginRender(hSFX2, hStream, hVisDC2);
            if (hSFX3 != -1)
                BASS_SFX_PluginRender(hSFX3, hStream, hVisDC3);
        }
« Last Edit: 7 Apr '09 - 20:34 by RevG »

w3k

  • Posts: 62
  BASS_SFX URL
  http://www.cubesol.com/Files/BASS_SFX.zip

Hi All,
   BASS_SFX Test for Delphi7 :D
« Last Edit: 8 Apr '09 - 12:37 by w3k »

RevG

  • Posts: 454
  BASS_SFX URL
  http://www.cubesol.com/Files/BASS_SFX.zip

Hi All,
   BASS_SFX Test for Delphi7 :D

Thank you so much for the Delphi source! I noticed that the sonique or bassbox plugins were not rendering on the paintbox controls. I got a copy of delphi and changed the source to use panel controls instead and now all works great. I hope you don't mind :)

Cheers,
Greg

w3k

  • Posts: 62
If the DSP plug-ins to support BASS_SFX it perfect ;D

RevG

  • Posts: 454
BASS_SFX now has example usage source code and header/include files for the following languages:

  • C/C++
  • MFC/C++
  • Delphi 7
  • Visual Studio .NET C#
  • Visual Studio .NET VB.NET
  • Visual Basic 6
  • PowerBasic 9

 :D

Cheers,
Greg

firemen

  • Posts: 151
it is very important!
Is there possibility at started plugin to specify the new sizes of height and width of destination window?


w3k
I copy your exe and dll in the folder of bin SFX

I can not understand, in your example works only blaze.
sphere.svp, oscillo.dll - black screen.

are there ideas?

RevG

  • Posts: 454
it is very important!
Is there possibility at started plugin to specify the new sizes of height and width of destination window?


w3k
I copy your exe and dll in the folder of bin SFX

I can not understand, in your example works only blaze.
sphere.svp, oscillo.dll - black screen.

are there ideas?

Firemen,

I am working on a resize function as we speak. Expect it to be there later today or tomorrow :)

Download the BASS_SFX.zip project and use the Delphi sample that exists in there. I have slightly modified w3k's source code so that all the plugins now work correctly. You will see that it uses panels now instead of a paintbox for rendering :)

Cheers,
Greg

firemen

  • Posts: 151
Thank you very much!

Excuse me, would not yet explain for what needed   BASS_SFX_PluginSetStream ?

RevG

  • Posts: 454
Thank you very much!

Excuse me, would not yet explain for what needed   BASS_SFX_PluginSetStream ?


BASS_SFX_PluginSetStream  is only currently useful for winamp plugins since winamp visuals draw to their own window. Later I might just remove the need for passing the HSTREAM handle to the BASS_SFX_PluginRender call and use exclusively BASS_SFX_PluginSetStream for all visuals. <-- probably the better way to do things :)

Cheers,
Greg
« Last Edit: 9 Apr '09 - 19:22 by RevG »

RevG

  • Posts: 454
v2.4.1.4 released with new call
BASS_SFX_PluginResize

All documentation, headers/includes, and libraries for all languages updated :)


Cheers,
Greg

bits

  • Posts: 44
RevG, I just updated our SVP renderer. In particular it was not allocating enough memory and therefore caused a handful visuals(Aorta, Spec N Hopp, Rabbit Hole 1.0 etc) to unreliably crash with access violations.
The change is regarding m_textureData.

RevG

  • Posts: 454
RevG, I just updated our SVP renderer. In particular it was not allocating enough memory and therefore caused a handful visuals(Aorta, Spec N Hopp, Rabbit Hole 1.0 etc) to unreliably crash with access violations.
The change is regarding m_textureData.

Thank you very much for notifying me about the update.  :)

Cheers,
Greg

firemen

  • Posts: 151
thank you, all works!

Yet it would be not bad to do:

BASS_SFX_PluginCreate(
   char* strPath,
   HWND hWnd,
   _rect TRect
);


BASS_SFX_PluginResize(
   HSFX handle,
   _rect TRect
);
 
 ;)
« Last Edit: 12 Apr '09 - 18:17 by firemen »

Patrice Terrier

  • Posts: 108
Greg,

I have downloaded your "ClubDj ProVJ", very impressive piece of work!
with a very nice skinned interface as i like them...

I have also checked the EXE demo provided with the BASS_SFX zip.
and i found very instructive to compare the size of the resulting EXE that are doing almost the same thing  :)

I think that the BASS_SFX's PowerBASIC interface could be posted on the Josť Roca's forum, either in the BassBox forum, or in the Header section forum.

PS: is it possible to get some insight on how you are doing the skinning of the scollbars?




RevG

  • Posts: 454
Greg,

I have downloaded your "ClubDj ProVJ", very impressive piece of work!
with a very nice skinned interface as i like them...

I have also checked the EXE demo provided with the BASS_SFX zip.
and i found very instructive to compare the size of the resulting EXE that are doing almost the same thing  :)

I think that the BASS_SFX's PowerBASIC interface could be posted on the Josť Roca's forum, either in the BassBox forum, or in the Header section forum.

PS: is it possible to get some insight on how you are doing the skinning of the scollbars?

Hi Patrice!

Thank you for the kind words! It took me a very long time in order to build the "skin engine" for ProVJ. I am the one and only developer for all my dj software products so you can imagine what a struggle it was :p I am big believer in sharing knowledge so I can tell you that I gave up on "skinning the scrollbars" and decided to hide them and then create my own graphics that look like scrollbars which in turn send messages to the treectrl or listctrl for scrolling. This ended up working great, but it was a huge and complex task. It took me 6 months of part time work to perfect it.

Since it took me so long I decided to help others out and I have written an article on this http://www.codeproject.com/KB/list/skinlist.aspx. This article is old, not up to date, and the coding is bad and also in MFC, but it still is basically the same technique I use in ProVJ. I can send you the updated code for how to do all of this if you want, just PM me.  If you have any specific questions for me please don't hestitate to ask me via this forum or pm if you wish :)

Basically this is what I do
Code: [Select]
//first you must hide the scrollbars using the following code
InitializeFlatSB(m_hListWnd);
FlatSB_EnableScrollBar(m_hListWnd, SB_BOTH, ESB_DISABLE_BOTH);

//now that the scrollbars are hidden you need to create your own using
//graphics which is a whole other task

//once you have your own graphical scrollbars created you
//must now write functions to scroll the list programatically in
//response to user input on your custom made scrollbars

//I have not included the code to create the graphic scrollbars or the code to programmatically
//scroll the listctrl/treectrl because there is a ton of code for all that. If you would like the code
//for this PM me and I will send you the raw code.


As a side note I have wrapped up my skin engine into a dll which I plan to release for sale to developers. I only have to finish the documenation which is a huge task. I will notify everyone via the un4seen forums in case anyone is interested. The cool part about the dll skin engine is that it uses an xml file and tga/bmp file to create the skin with built in "on the fly" changing of skins and it internally uses 100% win32 API so it will work with almost any windows programming langugage. The only bad part is that it is almost only useful for new projects as you have to design your software with the use of the "skin engine" in mind since it has its own controls and API.

Also, regarding the different file sizes of the demos in BASS_SFX, I was actually look at this as well when I was making it. It was very interesting to see the different file sizes that each programming language produced! I will upload the powerbasic header to the bassbox forums today :D

Cheers,
Greg