• 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 1 Guest are viewing this topic.

Charles Pegge

Patrice, I am experimenting with lighting and shading in Bassbox. To make this work for the plugins it has been necessary to alter the pixel format definition (pfd) structure and introduce more opengl commands into the bassbox kernel. I think this sort of thing can only be done once on anOpengl context, so it cant be set by individual plugins, but being able to control lighting, alpha blending etc dramatically enhances what can be done by the plugins. I will send you my hacks ASAP, so you can decide  whether to incorporate them or not.

Patrice Terrier

Ok charles,

I will look at it, as soon as you send it to me ;).

So far I have been able to fix the GPF that could occure on XP, adding
PEEK$(ASCIIZ, So, 128) in GetTag.

(because the VC6 BassTag.DLL is returning an ASCIIZ PTR)
and using PEEK$ without the "ASCIIZ" clause, causes the GPF ...

Now I am going to bed, I shall send the fix tomorrow.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#92
Here is the version that fix the GPF that could occure on XP while reading ID3 tags

Here is the new GetTag function with the ASCIIZ clause:

'// Use BassTags.dll to decode the ID3 TAG for all supported audio files
FUNCTION GetTag(zItem AS ASCIIZ) AS STRING
    LOCAL So AS LONG, sItem AS STRING
    So = TAGS_Read(gnAudioChannel, zItem)
    IF So THEN FUNCTION = TRIM$(PEEK$(ASCIIZ, So, 128))
END FUNCTION


I did also a minor change into the WinMain section, there:
'         // Let the user know that he can play audio already
          IF IsWindowVisible(GetDlgItem(hMain, %ID_BTN_Play)) THEN
             CALL SetFocus(GetDlgItem(hMain, %ID_BTN_Play))
             CALL SetTimer(hMain, %BLINK_TIMER, 333, %NULL)
          END IF



QuotePatrice, I am experimenting with lighting and shading in Bassbox. To make this work for the plugins it has been necessary to alter the pixel format definition (pfd) structure and introduce more opengl commands into the bassbox kernel. I think this sort of thing can only be done once on an Opengl context, so it cant be set by individual plugins, but being able to control lighting, alpha blending etc dramatically enhances what can be done by the plugins. I will send you my hacks ASAP, so you can decide whether to incorporate them or not.

-- Charles, I did not get anything  ???

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

Charles Pegge

Patrice, I am getting good results but there is some instability caused by the lighting, which needs to be pinpointed. In the main program, I have only needed to change the pixel format definition so far. Everything else is in the plugin.

Another idea is to make the mouse and keyboard states available to the plugin. This could open all sorts of possibilities - such as the ability to react to a drag-and drop operation and create various interactive toys. Even games!

Patrice Terrier

#94
What I would like to do myself is to map a video hover a moving object as WPF does  ;)

The plugin model is already very flexible, thus we could easily add other messages like various WM_MOUSE messages, and assynchrone keyboard support as well (this is what I am doing already in GDImage).

In GDImage each sprite objet as a wealth of properties like these:

' Internal GDImage structure being used to store details about each sprite object.

  %METADATA_SIZE   = 2048 '//See it in GDImage.inc

  TYPE ZOBJECT
      hWnd        AS LONG
      objType     AS LONG
      metacount   AS LONG
      metadata    AS STRING * %METADATA_SIZE
      useFont     AS ASCIIZ * 128
      useSize     AS LONG
      fontFam     AS LONG
      curFont     AS LONG
      strFormat   AS LONG
      useARGB     AS LONG
      use3D       AS LONG
      x1          AS LONG ' x top coordinate
      y1          AS LONG ' y top coordinate
      x2          AS LONG ' object bound width
      y2          AS LONG ' object bound height
      visible     AS LONG
      order       AS LONG
      locked      AS BYTE
 
      ID          AS LONG
      Style       AS LONG
      Bitmap      AS LONG
      Region      AS LONG
      objLabel    AS STRING * 64
      xCapture    AS WORD
      yCapture    AS WORD
      opacity     AS BYTE ' PNG variable opacity
      scale       AS SINGLE '//2.10
      clone       AS LONG   '//2.10
      xP          AS WORD   '//2.11
      yP          AS WORD   '//2.11
      angle       AS WORD   '//2.11
      quality     AS BYTE   '//2.11
      flipmode    AS BYTE   '//3.00
      userotate   AS BYTE   '//3.00
      selected    AS BYTE   '//3.02
      hidden      AS BYTE   '//3.56
      reserved    AS STRING * 27' 28 ' 26
  END TYPE ' 2368 bytes
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#95
This version uses a new plugin's kernell.

BBP_TITLE has been changed to BBP_CREATE.

Now it is the responsability of the plugin's author to tell the kernell which rendering mode He will be using during the BBP_CREATE message:


    CASE %BBP_CREATE
         '// Retrieve plugin details
         BBP.Title    = "Magic diamond"
         BBP.Author   = "Patrice Terrier"
         BBP.Version  = MAKDWD(1, 0) '// Version 1.0"
         BBP.RenderTo = %BBP_OPENGL  '// or %BBP_GDIPLUS, or %BBP


The kernell will use BBP.RenderTo to reset OpenGL, while switching from one plugin to another, and before it sends the BBP_INIT message.


'// Reset OpenGL plugin
SUB BBP_Reset()
    LOCAL BBP AS BBPLUGIN
    BBP.Msg = %BBP_CREATE
    CALL BBP_Plugin(BBP)
    IF BBP.RenderTo = %BBP_OPENGL THEN
       CALL glDisable(%GL_BLEND)
       CALL glDisable(%GL_TEXTURE_2D)
       CALL glDisable(%GL_DEPTH_TEST)
    END IF
END SUB


This is to avoid previous settings from one plugin to impact the others, for example with textures or blending mode etc.



I have added a new visual plugin that is very realistic...


It is an adaptation of a Delphi code written by Jan Horn (http://www.sulaco.co.za), the hard thing was to find a good way to synchronize the effect with audio. I hoppe you will like the result.

...

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

Petr Schreiber

Beautiful Patrice!,

really nice and very smooth.

Just one question - which plugin sources use for Bass plugin creation now ?
Is First BassBox plugin (insight) still way to go ?

Thanks,
Petr
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Patrice Terrier

#97
QuoteJust one question - which plugin sources use for Bass plugin creation now ?

The changes mainly concerned BassBox itself, the plugins themselves are almost same.
Just use the lattest BBPlugin.inc and tell BassBox that your plugin is for OpenGL using BBP_RenderTo during the BBP_CREATE message.

Quotereally nice and very smooth.
It looks even better when played full screen, I am using a dual monitor display and while BassBox is playing full screen on the 22", I feel like in a night club ;)

Try Firework with different type of audio files and see how it reacts to them, I would like to have more like this one  :)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Kent Sarikaya

Very nice Patrice, I like the fireworks!!

Charles Pegge

Patrice,
Your new version has resolved the instability I was getting with the shaded polyhedra I am working on. And I am using your current Pixel Format Definition without any mods. There is a minor problem which happens when switching from fireworks to polyhedra. The polyhedra take on a fireworks texture!
I think this is a texture problem since my current model does not enable or disable textures, but does specify tex coordinates, so it is evidently grabbing onto the fireworks for some reason.

My visiting nine year old IT consultants think BassBox is very cool  8)

Charles Pegge


I've resolved the above problem - in my plugin:

BBP.RenderTo = %BBP_OPENGL  '// or %BBP_GDIPLUS, or %BBP_DIRECTX 

But BassBox was generating a GPF whenever it was terminated with my plugin. I traced the problem down to the %WM_DESTROY procedure in BassBox.bas and I think the safest fix is to ensure the Plugin is detached before the other resources are taken down and the Window destroyed.

    CASE %WM_DESTROY

'        // Detached active plugin
         CALL BBP_LoadPlugin("")


...




Charles Pegge

One curious effect:
If you press the Alt key, the child controls on the BassBox are replaced with blank white spaces. This persists until a refresh is forced by covering BassBox with another window and then exposing it again. But After this is done, the Alt key effect does not re-occur.

Patrice Terrier

#102
Charles,

QuoteIf you press the Alt key, the child controls on the BassBox are replaced with blank white spaces.

I am very glad you found this one!
(because I had the same problem on XP with PhotoComposer, that is a commercial project)

As usual VISTA and XP do not react the same, in such case.
When pressing ALT key first time (and only the first time)
VISTA just redraw a doted line arround the control that has the focus,
while XP redraw all the child controls using the current XP style hover our nice skinned buttons.

Until I post a new patch, here is the fix:

In zSkin.inc add the constant: %WM_UPDATEUISTATE = &H0128 

then in the zImageButProc procedure add the %WM_UPDATEUISTATE message like this:


    CASE %WM_UPDATEUISTATE
'        // Avoid the defaut procedure to paint standard button window hover our skinned control
         EXIT FUNCTION


That should solve the problem.

This is another good example showing that we must always check with different Windows version.
With Windows never assume that something working fine on a version will work the same on another ;)

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

Patrice Terrier

#103
This patch comprises the changes to fix the ALT key problem reported by Charles,
plus a few more backgrounds to play with  :)

See below the attached BassPatch30.zip

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

Charles Pegge

#104
This is an update for Plugin003.

It includes PLUGIN003.DLL and source code PLUGIN003a.bas and a folder containing a full set of Opengl INCLUDEs with MACROised constants. All of these go in the BBPLUGIN folder, overwriting the current PLUGIN003.DLL only.

As you will see, shading makes a big difference to the solidity of the polyhedra

I eventually traced the source of the instability I've encountered over the past few days to an Array boundary error in the lighting setup function. One of those bugs that lurk undetected in the code only to make their presence felt several programs later, causing strange and seemingly unrelated bugs.

The next stage is to introduce modulation of the lighting rather than the color of the objects, to get more subtle effects.