• Welcome to Theos PowerBasic Museum 2017.

BassBox 64 (version 1.0)

Started by Patrice Terrier, January 23, 2014, 08:47:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

BB64 version 1.0

My plan is to make this one the successor of the 32-bit version of BassBox.

I have attached to this post, version 1.00 written in C++, with Visual Studio.

It is a combination of Bass.dll, AudioGenie3.dll, WinLIFT64.dll, and GDImage64.dll.

The whole interface is based on the GDImage animation capabilities.

In the long run i would like to let it work like my Galaxy NOTE 3 phablet, that was my source of inspiration.



Version 1.00 features:

  • Full support of drag and drop from the Explorer (with recursive folder search for valid audio files).
  • While playing, the flare animation can be used as seek pointer to move forward or backward within the song.
  • Boomer animation in the background, when there is no Cover Art image.
  • Icon animation.
  • Cover Art alphablending on the fly (using variable opacity).
  • Full Audiogenie3 support.
  • DWM compositing support.
  • Audio volume adjustment.
  • Background switching (left or right mouse click aside of the Cover Art image).
  • Mouse hover button to play/pause audio.
  • Auto hide mouse hover prev/next buttons to navigate the audio paylist (build from the folder recursive search).
  • 10-band equalizer.
  • Play in loop mode On/Off.
  • Keep player topmost On/Off.
  • OpenGL visual plugins (still in 32-bit)
  • Add/remove to favorite.
  • Play from favorite.
  • Current audio extension: MP3, OGG, and SoundTracker.


Note: The source code is provided to help those wanting to learn more about low level SDK programming in C++,
and to get the most of WinLIFT and GDImage.


You can download the freeware redistribution package from this link.

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

Patrice Terrier

#1
BUILD #4

The popup menu, is an advanced custom control based on the WinLIFT skPushButtonImage API,
and a mix of several GDImage API.

The menu auto/hides, as soon as you move the cursor out of it.

Command list:
- Add to favorites.
- Remove from favorites.
- Play favorites.
- Enable visual plugins.
- Equalizer settings.
- Play in loop mode.
- Keep player topmost.
- About.

A menu check box, shows the command that are currently active.

Parameters, are saved into the Windows TEMP/TMP folder under the name BB64.bin.
Favorites, are also saved into the Windows TEMP/TMP folder under the name BB64.fav.

Most of the OpenGL have been revisited to fit well inside of the new player.
Currently the plugins are still written in PowerBASIC (source code inside of the BBplugin folder).
For now, the BBP.exe OpenGL engine is also written in PowerBASIC.
WM_COPYDATA is used to perform IPC between 32 and 64-bit, under control of the main 64-bit loop animation.

The 32-bit OpenGL WS_EX_TOOLWINDOW is kept under the transparent 64-bit player, to render everything in DWM composited mode, resulting in a nice visual mixing of 2D and 3D altogether.

The ZIP file has been attached to the first post of this thread.

Note: The PowerBASIC source code of the BBP OpenGL engine, as well as several plugins is also provided altogether with the C++ VS2010 project.

plugins:
- BBP_Attractor.dll
- BBP_Beam.dll
- BBP_Bubble.dll
- BBP_Fahrenheit.dll
- BBP_Fireworks.dll
- BBP_Flares.dll
- BBP_Impulse.dll
- BBP_Matrix.dll
- BBP_Oscillo.dll
- BBP_Starmania.dll

To change of plugin, click with either the left or right mouse button on the background, when the plugin mode is On.

...

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

Patrice Terrier

BB64 is using WM_COPYDATA to perform IPC with the 32-bit BBP.exe OpenGL plugins

Here is the C++ 64-bit code
        if (gP.hzwp) {
            if (IsMenuChecked(IDC_PLUGIN, hCtrl)) {
                gBBP.nlevel = nLevel;
                //memset(&gBBP.getdata[0], 0, 1024);
                RtlMoveMemory(&gBBP.getdata[0], BassChannelGetData(gP.channel), 1024);
                gBBP.medialength = (DWORD) gP.medialength;
                gBBP.mediapos = (DWORD) gP.mediapos;
                //memset(&gBBP.wimdata[0], 0, 1024);
                RtlMoveMemory(&gBBP.wimdata[0], pInt, 1024);
                gCDS.dwData = 0; // OpenGL
                gCDS.cbData = sizeof(gBBP);
                gCDS.lpData = &gBBP;
                SendMessage(gP.hzwp, WM_COPYDATA, (WPARAM) gP.hwnd, (LPARAM) &gCDS);
            }
        }


And here is the PowerBASIC 32-bit counterpart:
    case WM_COPYDATA:
         ptCDS = lParam
         select case long (@ptCDS.dwData)
         case 0:
              ptBBP = @ptCDS.lpData
              nlevel = @ptBBP.nlevel
              medialength = @ptBBP.medialength
              mediapos = @ptBBP.mediapos
              getdataPTR = VARPTR(getdata(0))
              wimdataPTR = VARPTR(wimdata(0))
              MEMORY COPY VARPTR(@ptBBP.getdata(0)), getdataPTR, 1024
              MEMORY COPY VARPTR(@ptBBP.wimdata(0)), wimdataPTR, 1024
              RenderOpenGL(hWnd, nLevel, medialength, mediapos, getdataPTR, wimdataPTR)
         case 1:
              gnParent = wParam
              '//if (IsWindow(gnParent)) THEN SetParent(hWnd, gnParent)
              ptBBP = @ptCDS.lpData
              gnCodeID = @ptBBP.gdimageID
         case 2:
              ptBBP = @ptCDS.lpData
              MEMORY COPY VARPTR(@ptBBP.plugin), VARPTR(szFile), 260
              'MoveMemory(VARPTR(szFile), VARPTR(@ptBBP.plugin), 260)
              if (BBP_LoadPlugin(hWnd, szFile)) then ' Make sure that a different plugin has been selected
                  BBP.Msg          = BBP_INIT
                  BBP.ParentWindow = hWnd
                  BBP.DC           = GetDC(BBP.ParentWindow)
                  BBP.RC           = glRC
                  BBP.BackARGB     = 0
                  if (BBP_Plugin(BBP) = BBP_SUCCESS) then
                      ResizeGLwindow(hWnd)
                  end if
                  ReleaseDC(BBP.ParentWindow, BBP.DC)
              end if
         case 3:
              DestroyWindow(hWnd)             
         end select
         function = 1: EXIT function


WM_COPYDATA allows us to pass any kind of data encapsulated within a structure.

Very handy.

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

Patrice Terrier

While working on BB64 i learned that indeed ALL Windows handles are still DWORD in 64-bit, only pointers are using 64-bit, all other handles are kept unchanged.

That was a discovery, at least for myself.  8)

...

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

Mike Stefanik

Quote from: Patrice Terrier on February 27, 2014, 02:49:23 PM
While working on BB64 i learned that indeed ALL Windows handles are still DWORD in 64-bit, only pointers are using 64-bit, all other handles are kept unchanged.

Actually, that's not quite right. Object handles in 64-bit Windows are 64 bits wide, it's just that only the lower 32 bits are significant. The upper 32 bits will always be zero, which it makes it generally safe to cast them to 32-bit integers without a loss of data. Note, however, that this only applies to handles that reference kernel objects and not all 'H' types are actually handles to a kernel object. Some, like HIMAGELIST and HPROPSHEETPAGE are not object handles, they're actually pointers and truncating them to 32-bits will break your program. You have a lot of rope here with which to hang yourself; exercise caution.

In terms of C/C++, you should avoid directly casting a HANDLE type (which is defined as a void pointer) to a DWORD. Use the HandleToULong and ULongToHandle macros which safely performs the conversion and makes it clear in your code exactly what you're doing. And this really only should be done in the context of IPC, where you need to exchange a handle between 64-bit and 32-bit processes. Internally, you should always use the polymorphic ULONG_PTR or DWORD_PTR types to declare an integer that is guaranteed to be wide enough to store a handle or pointer.
Mike Stefanik
sockettools.com

Patrice Terrier

#5
Mike,

Yes, it is exactly what i am doing using the polymorphic LONG_PTR.

But you can see, that only the lower 32 bits are significant, with functions like FindWindow, and when the API are defined with HWND WINAPI then you can be confident that it returns a DWORD.

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

Patrice Terrier

The first post of this thread has been updated with a link to the freeware EXE redistribution package.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

The freeware redistribution package has been updated. The new EXE is here.

Changes:
- New waiting status indicator.
- New horizontal volume slider.

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