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

Patrice Terrier

What if Texture() is not a global array  :)

Does there is an OpenGL function to retrieve existing textures without using a global array ?
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Petr Schreiber

#46
Hi Patrice,

you can test if index is used textured "name" using glIsTexture( indexHere ).

On all implementations I have seen, first call to
Quote
glGenTextures 2, Textures(0)
will result in Textures(0) = 1, Textures(1) = 2.

But this is sadly not guaranteed by specification.

I will check for more info.


Petr

P.S. Good OpenGL reference is http://www.opengl.org/sdk/docs/man/
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Charles Pegge

Patrice, I checked through my opengl projects and found that I have never used glDeleteTexture. It has never caused any trouble to other applications or itself. So I presume these are taken care of at the end of the GL context. But I have not used large numbers of textures, at any one time so far.

I find dynamic strings are good for holding the pixel images as they are so disposable.


Petr Schreiber

Charles,

not releasing textures using glDeleteTextures caused quite noticable leaks on Win9x/ME systems, so better to not ignore it :)
I did not do it too in my 3D editor for example, but after few run/close cycles it could lead to very suspicious behaviour of system.


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

psch.thinbasic.com

Petr Schreiber

Patrice,

do you think it would be possible to drop directory on the player window and it would add the media files according to automatic search ? :-[
I like this feature a lot in WinAmp - but there I have to choose directory in classic way, not so nice as just throwing files on window :)


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

psch.thinbasic.com

Charles Pegge


I have taken your advice to heart Petr, and patched the glDeleteTextures into my shutdown procedure. And that link is very useful. No excuses for ignorance now :)

To do a fully fledged plugin for Bassbox, we will need to have setup, play and shutdown notification, so that the plugin can manage its own list items and textures. But there are huge possibilities. You could for example, have an interactive plugin with simple games, something related to the rhythm of the music

Patrice Terrier

I didn't use myself glDeleteTexture and have never had troubles until a C# programmer start changing them in sequence in GDImage and found that is causes memory leak.


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

Patrice Terrier

Quote
do you think it would be possible to drop directory on the player window and it would add the media files according to automatic search ?

Petr,

Do you mean droping a whole directory, that could have embedded subfolders, and peform recursive search to find if there are audio files in them?
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#53
Charles

what are the parameters you will need to call the plug-ins, or perhaps we could define a BBPLUGIN structure like this:

TYPE BBPLUGIN
      bbParentWindow AS LONG
      bbDC AS LONG
      bbRC AS LONG
      bbLeftPeak AS WORD
      BBRightPeak AS WORD
      etc.
END TYPE

Note:
I could add new features like internet streaming.
I could do also audio capture in realtime of any sound beeing played on the computer (requires a multiplex audio board) and display the audio wave graphicaly.
And what about a multichannel audio mixer ;)

Audio capture screen shot:

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

Kent Sarikaya

All I can say is this is cool stuff, as I sit back and watch you gurus do magic!

Petr Schreiber

#55
Quote
Petr,

Do you mean droping a whole directory, that could have embedded subfolders, and peform recursive search to find if there are audio files in them?

Exactly. I know it could take some time, but I have music organised in subfolders under one "Music" folder, so this way I could throw directory on BassBox, and then do some coding while listening to music with no more care :)

Internet streaming sounds very nice as well as realtime capture!

Regarding glDeleteTextures - I didn't new they exist at all for long time, then I started to check behaviour of my app ;D


Bye,
Petr

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

psch.thinbasic.com

Charles Pegge

Patrice,

I think a DLL plugin would be ideal. Something BassBox could recognise if it was dropped into the plugins folder.

Using your data structure BassBoxData, The DLL functions could look like this:

WhatAreYou() as long

Setup(BassBoxData)

PlayFrame(BassBoxData)

Shutdown(BassBoxData)

As an  experiment, I should be able to decouple my Viewer Software from the Windows loop and turn it into such a DLL.


Patrice Terrier

Charles

I shall come back to you tomorrow, now it is too late :-[
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

Here is my suggestion to create plugins for BassBox:


MACRO CONST = MACRO

CONST BB_INIT    = %WM_CREATE
CONST BB_PAINT   = %WM_PAINT
CONST BB_DESTROY = %WM_DESTROY

CONST BB_SUCCESS = 0
CONST BB_ERROR   = -1

TYPE BBPLUGIN
    Msg          AS LONG        '// The plugin's message (see above constant list)
    ParentWindow AS LONG        '// The parent window handle
    DC           AS LONG        '// The parent window DC (while in play mode)
    RC           AS LONG        '// The parent OpenGL RC (while in play mode)
    LeftPeak     AS WORD        '// The left audio channel peak value (while in play mode)
    RightPeak    AS WORD        '// The right audio channel peak value (while in play mode)
    Title        AS ASCIIZ * 32 '// Plugin's name or title.
    Author       AS ASCIIZ * 32 '// Plugin's author name
    Version      AS DWORD       '// LOWRD major, HIWRD minor
END TYPE

'// Use a dedicated "bbp" DLL extension: MyPlugin.bbp to ease the plugin's detection
'// Use a generic "BBPLUGIN" folder that would store all the bbp plugins,
'// each one could have its own embedded subfolders inside of "BBPLUGIN" to store local resources.

'// The main exported plugin's function would be bbProc, like this:
FUNCTION bbProc ALIAS "bbProc" (BYREF BB AS BBPLUGIN) EXPORT AS LONG
    LOCAL nRet AS LONG
    nRet = BB_SUCCESS
    SELECT CASE LONG BB.Msg
    CASE BB_INIT
         '// Do your code initialisation there
         BB.Title   = "My BB plugin"
         BB.Author  = "My Name"
         BB.Version = MAKDWRD(1, 0) '// Version 1.0"
    CASE BB_PAINT
         '// Draw the scene there using BB.LeftPeak and BB.RightPeak
    CASE BB_DESTROY
         '// Free up your resources there
    CASE ELSE
        nRet = BB_ERROR
    END SELECT
    FUNCTION = nRet
END FUNCTION
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge


Yes I think this will work very well Patrice. I was just wondering whether other audio data as well as left and right peak might be available. I dont know what MS audio offers us, but frequency spectral info would be very interesting to visualise.

And can we assume that GDIplus will always be online in BassBox as well as Opengl?