• 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

BassBox has been updated to version 1.11 (zip file is attached to the first post of this thread)

The new OSCILLOSCOPE control has been reworked for better audio card detection and to lower the CPU usage.
Note: this feature is disabled if your computer doesn't have a multiplex audio card.

The wave device detection now ignores "microphone" and looks only for multiplex line in.

...

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

Kent Sarikaya

Patrice, thanks it runs very smoothly now and no stutters when switching between plugins! Very nice. Thanks for the quick update!

Patrice Terrier

#317
Indeed, i could pass the wave buffer pointer (@pWaveHdr.lpData) to BBPlugin as i am doing with FFT.
Then we could use it to draw 256 points into the visual plugin for each frame, and/or mix it together with current peak and fft drawing.

I could also pass the whole duration and current elapsed time, to perform introduction or shutdown effects matching the active music being played.

Note: all drawings done in the oscilloscope are done with GDIPLUS, to be compatible with the VISTA DWM composited mode.
I could even draw the scope directly in "Blur" or "Crystal" mode.

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

Patrice Terrier

BassBox has been updated to version 1.20.

The OSCILLOSCOPE control has been rewritten, and now it doesn't requires anymore a multiplex audio card.
CPU usage has been further reduced, and the drawing of the oscillo curve is more accurate and independant of the volume level.

The BBPLUGIN structure has a new WIMdata member:

TYPE BBPLUGIN                   '// 256 bytes
    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).
    Lpeak        AS WORD        '// The left audio channel peak value (while in play mode).
    Rpeak        AS WORD        '// The right audio channel peak value (while in play mode).
    Title        AS ASCIIZ * 32 '// Plugin's name or title.
    Author       AS ASCIIZ * 64 '// Plugin's author name.
    Version      AS DWORD       '// LOWRD major, HIWRD minor.
    RenderTo     AS LONG        '// %BBP_GDIPLUS, %BBP_OPENGL, %BBP_DIRECTX.
    BackARGB     AS LONG        '// Default ARGB color background.
    FFTdata      AS DWORD       '// DWORD pointer to the FFT() AS SINGLE array.
    FFTsize      AS WORD        '// Size of the FFT array.

    WinMsg       AS LONG        '// True Windows message.
    wParam       AS LONG        '// wParam
    lParam       AS LONG        '// lParam
   
    WIMdata      AS DWORD       '// DWORD pointer to the wave MM_WIM_DATA.

    Reserved     AS ASCIIZ * 106'// Reserved for future extension.
END TYPE


I shall write a new visual plugin to show you how to use the WIMdata pointer.

The latest zip file is attached to first post of this thread.

...

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

Kent Sarikaya

Patrice it is working perfectly. Very nice to see the scope have nice waves on it. Thanks for making it work with the onboard sound processor!!

Kent Sarikaya

Thanks for the nice new plugin and example Patrice.  Looks and works great!

Patrice Terrier

#321
To decode WIMdata into your plugin use something like that:

         '// WIM MAGIC!
         '// BBP.WIMdata returns a pointer to an area of memory containing an array of 256 short integer.
         '// It is then mapped to the WIM() array where it can be accessed.
         DIM WIM(255) AS INTEGER
         FOR K = 0 TO 255: WIM(K) = PEEK(INTEGER, BBP.WIMdata + K * 4): NEXT
         '// Warning, Left and Right audio channels are mixed together, thus use step 4, to pick only one.

And to retrieve both channels (left and right) use something like this:

DIM WIM(0 TO 255, 1 TO 2) AS INTEGER
DIM K, Offset AS LONG
FOR K = 0 TO 255
      Offset = K * 4
      WIM(K, 1) = PEEK(INTEGER, BBP.WIMdata + Offset)
      Offset = Offset + 2
      WIM(K, 2) = PEEK(INTEGER, BBP.WIMdata + Offset)
NEXT

Note: In the "Oscilloscope" plugin demo and in the zOscillo control we display only the first 128 values.
...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Petr Schreiber

Thanks Patrice,

very hypnotizing!

First it GPFed, I thought that is Christmas surprise of my localised XPs, then I realised I need latest BassBox.
With that it works perfectly. Very smooth!


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

psch.thinbasic.com

Patrice Terrier

#323
BassBox has been update to version 1.21, the zip file is attached to the first post of this thread and the screen shot has been updated.

The new plugin "Oscilloscope" has been reworked to show you how to use the new members of the BBPLUGIN structure:


  • BBP.WIMdata
  • BBP.MediaLength
  • BBP.MediaPos

The "Oscilloscope" displays both the left and right audio channels, and it uses MediaLength and MediaPos to change the effect based on the media progression (search for "percent" in the source code).


                   '// Draw left channel
                   CALL glPushMatrix()
percent = (BBP.MediaPos * 100) / BBP.MediaLength
IF percent > 99 THEN PulseAngle = 0
IF percent < 33 OR percent > 66 THEN
   CALL glRotatef(-PulseAngle, 1.0, 0.0, 0.0)
ELSE
   CALL glRotatef(-PulseAngle, 0.0, 1.0, 0.0)
END IF
                      CALL glTranslatef(0.0, -0.25, 0.0)
                      CALL glbegin(%GL_LINES)
                      FOR K = 0 TO 127
                          '// color range must fit between 0-32
                          ColorRange = 17 + (vf(K, stt, 1) / 0.09375)
                          IF Multiplan > 0 THEN ColorRange = ColorRange \ 2
                          RGBColor = LevelColr(ColorRange)
                          CALL glColor4ub(BBP_GetRValue(RGBColor), _
                                          BBP_GetGValue(RGBColor), _
                                          BBP_GetBValue(RGBColor), _
                                          Fading)
                          CALL glvertex3f(-UseSize + UseSize * K / 64, vf(K, stt, 1), zS)
                          CALL glvertex3f(-UseSize + UseSize *(K + 1) / 64, vf(K + 1, stt, 1), zS)
                      NEXT
                      CALL glEnd()
                   CALL glPopMatrix()

                   '// Draw right channel
                   CALL glPushMatrix()
IF percent < 33 OR percent > 66 THEN
   CALL glRotatef(PulseAngle, 1.0, 0.0, 0.0)
ELSE
   CALL glRotatef(PulseAngle, 0.0, 1.0, 0.0)
END IF
                      CALL glTranslatef(0.0, 0.25, 0.0)
                      CALL glbegin(%GL_LINES)
                      FOR K = 0 TO 127
                          '// color range must fit between 0-32
                          ColorRange = 17 + (vf(K, stt, 2) / 0.09375)
                          RGBColor = LevelColr(ColorRange)
                          CALL glColor4ub(BBP_GetRValue(RGBColor), _
                                          BBP_GetGValue(RGBColor), _
                                          BBP_GetBValue(RGBColor), _
                                          Fading)
                          CALL glvertex3f(-UseSize + UseSize * K / 64, vf(K, stt, 2), zS)
                          CALL glvertex3f(-UseSize + UseSize *(K + 1) / 64, vf(K + 1, stt, 2), zS)
                      NEXT
                      CALL glEnd()
                   CALL glPopMatrix()



The new members, MediaLength and MediaPos, are very handy to synchronized the effects with the current played media. See in the example how I am changing the orientation based on the elapsed time.
Also very useful to perform introduction or close sequence.

The "Oscilloscope" fading effects are based on Charles Pegge's "Cartesian array".

I have added two new static controls to display the media length and elapsed time in HH:MM:SS.

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

Patrice Terrier

#324
Make sure you use the latest BassBox version 1.21 from 12-24-2007.

Because the BBPLUGIN structure has changed, and the latest "Oscilloscope" plugin demo shows you, how to use the left and right audio channels altogether and the media length to perform additional effects.

See also the 2 new static controls over the player's navigate buttons.

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

Kent Sarikaya

The waves are dancing very nicely!!  I like the new additions to the plugin Patrice, thanks as always!!

Patrice Terrier

BassBox has been updated to version 1.22, with the new plugin "Man of Vitruve".

The latest ZIP file is attached to the first post of this thread.

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

Petr Schreiber

Hi Patrice,

thanks a lot for new update.
I wonder where you get time to work on such a perfect additions!


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

psch.thinbasic.com

Kent Sarikaya

Patrice, that is wonderful. I felt like I was in space watching a laser light show and "the man" being projected on a small nebula. Thanks!

Patrice Terrier

#329
Kent, Petr,

I always appreciate your faithful comments, thank you.

...


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