• Welcome to Theos PowerBasic Museum 2017.

BassBox

Started by Patrice Terrier, October 08, 2007, 10:57:44 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Patrice Terrier

Jürgen,

Very important:
To handle the keyboard or mouse messages from within a plugin, you must process the %BBP_KEYBOARD and %BBP_MOUSE messages and NEVER subclass the main BassBox windowproc.

To learn how to do it, please look at these plugins:
Woofer, Spectrum, Laser beam, Genesis, Hal.
Use space bar to restore initial location, and the BBP_SetReg and BBP_GetReg API to save/restore parameters to/from registry.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Jürgen Huhn

#616
Hello Patrice!

Sorry!!

I did not spend enough time to study the Examples!

But now i think to know the way how to do it right.

I have removed the subclassing of the main BassBox windowproc!!

Also added the Function to save or restore the last used
BLENDING,LIGHTING and COLOR settings to the Registry..
Think, i did it right this time, because it works well.

Additional, i`ve cleaned up the code by removing all not used
Functions and changed the Version to 1.1.

I`m very happy about your help and support to make this little 
OpenGL-Demo a real BBplugin! "Thank you!!"

Regards,

Jürgen Huhn
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Jürgen Huhn

Hi..

By learning more about coding with Powerbasic, i created additional
BassBox plugin Examples based on the Code of JH_ImageCube BBplugin.

Also a new BBplugin:

JH_DancingCubes Version 1.0

I would like to share my work here, because these Examples are so simple and
easy to understand..

To get 300 little dancing Cube`s on the Screen, i've used the "JH_Cube" Function
with the Encounter.bbm file, that`s included in the BassBox Files.

On the Keyboard press B, L or double click the mouse Button`s to
switch blending or Light on and off...
Click the right mouse Button to switch the Background on and off.
Reset to defaults with the spacebar.

Read the Examples to create your own BBPlugin!!
The source Codes are included in the zip.

It`s also possible to render OpenGL and GDI together in the same Window...
Read the MSDN documentation for the use of the OpenGL API!!

Sorry for my bad English!

Regards,

Jürgen Huhn
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Jürgen Huhn

I have one more...

Really nice!
I`ve used existing and in the BassboxV2.5 included Textures, but i put all needed files into the zip..

This plugin is not ready yet, but the first testet Version.

Enjoy and reply if any Question!!


Jürgen Huhn
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Patrice Terrier

#619
Jürgen

That's a good surprise, i like this one!

Don't forget to include the source code of the plugin, when you post here ;)

I have reworked the BassCubeTexture.png to preserve the aspect of the logo, and it is attached to this post.

...


Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Jürgen Huhn

#620
Hello Patrice!

Thank you very much for reworking the BassCubeTexture.png!

This BassCubeTexture.png is really good!
Within my other Plugin`s, it look`s also very nice!!
I like it more as my own one and it fit`s much better into the Scene!

...Well done!!   :)

You post this nice Surprise the right Time, because i`ve just finished
the first final Version: "JH_StarDance V1.1.dll " this Weekend.
I hope you like it as well! It`s a bit different, more Light,
more colors on the Crome.jpg, faster color changing and more... see it!

Your "BassCubeTexture.png" gave me the Inspiration to render the BassBox-Logo
as a pumpin or pulsating Part of the Scene. Without changing your new BassCubeTexture.png!!
I've created a new Texture for this Effect... Named it "InfraBassCubeTex.png"

For All and to the BBPlugin:
The included JH_StarDance V1.1.dll was tested 42 Hours non stop running on 2 Systems under
WindowsXP with the small, but really great BassBox-V2.5 without any Problem!!
Both Systems with 4GB-Ram, NVidia-GeForce 8800-Ultra 750MB and Pentium-CPU,
DualCore 3,4Ghz EM64T and one with an extreme Edition P4HT 3.6Ghz.

I put a Help.txt, the new "BassCubeTexture.png" and "InfraBassCubeTex.png", the SourceCode,
the JH_ImageCubeA.INC,JH_StarDance V1.1.dll, the Star.PNG, the Chrome.jpg and
the infraredsky.jpg into the package.
Also the OldBassCubeTexture.png, to switch back to it by double click on the middle Mousebutton.
Take another Texture if you don`t like this, rename it to OldBassCubeTexture.png or
change the SourceCode..
Read the Help.txt how to use the Functions!

For the first time, it`s all..
Do you have a Problem or Question, please Reply to this post! 
Sorry for my English..

Enjoy your Music with one more BBPlugin,

Regards and thank`s to Patrice Terrier,

Jürgen Huhn
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Jürgen Huhn

#621
I have reworked the SourceCode today and modified
the Magic Color Section for the Crome-Texture!
Also adjusted the InfraBassCubeTex.png a bit to get better pulsing Effect!..
Here is the Update..
;)
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Patrice Terrier

Jürgen,

Very nice work, thank you for your contribution!

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Jürgen Huhn

Patrice,

i`m just in the Beginning to use Powerbasic, normally i use C++ for programming the OpenGL.
I`ve learned so much about advanced SDK programming with PowerBasic, most out of your Board
and from your shared Examples how to do it with the OpenGL and the GDI graphic library.

I found no other Forum with a Board like yours!!

Also i get your fantastic BassBox with a real openGL-Window... Very fast and usefull!!
I was happy about your reworking the BassCubeTexture.png and your Support on the
Way to this BBPlugin.
What shall i say?

When i get something, i want to give something back!!

That`s why i made this 2.50 BBplugin!!

It`s a Gift to you and if you like, put it into your BassBox 2.50 Package.

It`s not tested on Vista, but i think that`s no Problem.
Let me now if something wrong, i fix it!!

Next i have to install Vista and move my System to it!

Have a nice Day..

Jürgen Huhn

.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Patrice Terrier

#624
Jürgen,

As you have seen, BassBox doesn't use any third party OpenGL addon nor any other encapsulation except the DirectSound Bass.dll from Ian Luck.

For everything else, it is just plain low level SDK flat API, hence the speed and the size of the resulting EXE.

The good thing about this forum is:
what you will learn here could be use with any Windows programming language, because the core API is the only common denominator to all of them  :)

They are also a few OpenGL gurus here: Petr Schreiber and Charles Pegge (the ASM guy).

And i would like to give a special dedicace to José Roca and his wonderful work in making this forum one of the most valuable SDK programming resource place hover the Internet.


Added:
QuoteIt`s not tested on Vista, but i think that`s no Problem.
As long as you respect the BBPlugin specs, then you will not encounter any problem with VISTA, and BassBox.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Jürgen Huhn

#625
Hi Patrice..

For sure, i`ve used only the openGL and respected the BBPlugin 2.50 Specifications!
It`s exactly the Reason why i think, that`s running on Vista without any Problem..
And then, your BassBox is enhanced for Vista..

To avoid flickering or more Frames per Second as the Frequence of Display Device,
the BBPlugin enables V-Sync by using the pointer wglSwapIntervalEXT..
Because the EXE is running so fast With my GeForce 8800-Ultra that i ask me,
what`s going on with a GeForce 9xxx!? It`s Pretty cool!

I realised, What i learn here could be use with any Windows programming language
and that`s possible to translate most of my C++ codes to the fast SDK-Style.

Thank`s a lot for your confirmation!!

I saw the great OpenGL-Examoles from Petr Schreiber and Charles Pegge, but i didn`t
found the Time to go deeper into the Work of them.

I will do that as soon as it`s possible..

And José Roca and his wonderful work is absolute incredible!!

Deep Respect!!

Enough Reasons for me to say, this Forum is the Best i found in the Net!!

Thank you to the hole Forum Team!

... :) :)
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Greg Ellis

#626
Hey guys,

I am trying to add in support for BassBox plugins into my visual fx library. I have translated the structure from the BBPlugin.inc to c++ and I have come up with the code below. All plugins work except for anything that uses WIMData. My code crashes on the call to BBProc with BBP_RENDER for any plugins that use the WIMData, otherwise all works great.

So I thought it was probably due to an error in my structure translation, maybe a wrong datatype since if I am off by even 1 byte for any datatype before the WIMData then that could cause this crash. However I wrote code to do sizeof() on each member of the struct and it all adds up to 256 bytes which is correct based on the documentation in the header. Everything looks to be in the right order too, however my eyes are now square from starring at this code lol.

So now I am left wondering what I have done wrong. Has anyone else ever translated this struct over to c++? Can anyone here confirm that my structure looks correct for c++?

Thanks,
Greg



typedef struct _BBPLUGIN
{
    long Msg;
    HWND ParentWindow;
    HDC DC;
    HGLRC RC;
    WORD LeftPeak;
    WORD RightPeak;
    char Title[32];
    char Author[64];
    DWORD Version;
    long RenderTo;
    long BackARGB;
    DWORD FFTdata;
    WORD FFTsize;

    long WinMsg;
    long wParam;
    long lParam;
   
    DWORD WIMdata;
    DWORD MediaLength;
    DWORD MediaPos;

    char Reserved[98];
}BBPLUGIN;

Patrice Terrier

Greg,

So far i can't see any error in the BBPLUGIN structure.

However there is a problem with the code you sent me about WIMdata.

Quotelong nLevel = BASS_ChannelGetLevel(hStream);
long lPeak, rPeak;
lPeak = SolvePeak(LOWORD(nLevel), 128);
rPeak = SolvePeak(HIWORD(nLevel), 128);

/*
global variables
===========
float bb_fft[256];
short bb_data[1024];
*/

BASS_ChannelGetData(hStream, bb_fft, BASS_DATA_FFT512);
BASS_ChannelGetData(hStream, bb_data, 2048);

bbPlugin.ParentWindow = m_hWnd;
bbPlugin.DC = hDC;
bbPlugin.RC = m_glRC;
bbPlugin.LeftPeak = lPeak;
bbPlugin.RightPeak = rPeak;
bbPlugin.FFTdata = (DWORD)bb_fft;
bbPlugin.FFTsize = 256;
bbPlugin.WIMdata = (DWORD)bb_data;
bbPlugin.MediaLength = BASS_ChannelGetLength(hStream, 0);
bbPlugin.MediaPos = BASS_ChannelGetPosition(hStream, 0);

bbPlugin.Msg = BBP_RENDER;
bbProc(&bbPlugin);

The BBP.WIMdata is a memory pointer to the 4-bit real fft[0:255] array,
the size of the reserved memory holding the array being:  1024 (4-bit real x 256 = 1024),
yours is 2048

search MSDN or Google for MM_WIM_DATA

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Greg Ellis

#628
Hi!

Ya, I changed my code to this so that it was just like BassBox, but I still have the same crash so that's why I assumed my structure was incorrect, but it must be something else. I have been stepping through the code in powerbasic to check the state of all the variables and it looks the same as mine. I will keep tracing through until I uncover my error :)

Thanks,
Greg


float bb_data[256];

BASS_ChannelGetData(hStream, bb_data, 1024);


Greg Ellis

Hey Guys,

I got it figured out. The struct needs to be compiled with 1 byte alignment to match up with powerbasic compiler. In case anyone needs to know you can do that as follows:


#pragma pack(push, 1)
typedef struct _BBPLUGIN
{
    long Msg;
    HWND ParentWindow;
    HDC DC;
    HGLRC RC;
    WORD LeftPeak;
    WORD RightPeak;
    char Title[32];
    char Author[64];
    DWORD Version;
    long RenderTo;
long BackARGB;
    DWORD FFTdata;
    WORD FFTsize;

    long WinMsg;
    long wParam;
    long lParam;
   
    DWORD WIMdata;
    DWORD MediaLength;
    DWORD MediaPos;

    char Reserved[98];
}BBPLUGIN;
#pragma pack(pop)