ObjReader Community

Programming Art => Eye Candies => Topic started by: Patrice Terrier on December 02, 2016, 09:09:00 am

Title: DreamScene
Post by: Patrice Terrier on December 02, 2016, 09:09:00 am
This thread is to exposed a very special GDImage/WinLIFT companion, named ZWP (Zapsolution Window Plugin).

Its purpose is to provide an easy way to display OpenGL animations in the background, just like with the Vista Pro DreamScene (2007), but for a specific application. The animation itself could run in full sync mode with a playing audio file, creating a peak level FFT signal in real time.

Here is a DreamScene example, using the "Vortex" plugin:


The above screen shot, has been taken from a WinDev project, running in composited mode.
Compositing, means everything is rendered onto the Windows DirectDraw surface, using multiple transparent layers.
This is made possible by using the unique combination of GDImage and WinLIFT, because they are AERO compatible, since the introduction of DWM in Windows VISTA.

OpenGL animations
They are able to use any BassBox "Visual plugins", each one being a small OpenGL DLL producing a specific visual effect. They are working under control of ZWP, that is the link between the high level application and the low level plugins. It performs audio decoding, and sends messages to both the low level and the high level code.

The z-order of the DreamScene is always kept behind the main window, that must be skinned by WinLIFT to see it in variable opacity mode. The GDImage graphic control, is able to share the same image background than the skin theme, or to run in opaque or full transparent mode.

How to use the demo

The GDImage graphic control, comprise:
- A PNG animation, that could be zoomed and rotated, using the slider or the gauge button.
  (click with the right mouse button, on either the slider or the gauge, to restore default).
- A label text, matching the name of the active audio file.
- A progress spinner animation moving from the left to the right while playing audio.
Each of the above sprite objects, are reacting to the audio peak level, while playing.

The WinLIFT button controls:
- The "Vortex" radio button, to select the matching plugin.
- The "Laser beam" radio button, to select the matching plugin.
- The "PLAY" switch, to turn audio "On" or "Off".
- The "Transparent" switch, to turn the GDImage crystal mode "On" or "Off".
- The "Internet documentation" link, that would display this page.
- The "Clock" control.

About the supported audio format:
- Tracker: mod, umx, mtm, it, xm, s3m, mo3.
- Stream: mp3, ogg, wav, aif.
There are several audio files, provided into the "Audio" subfolder.
To select a specific one, use drag and drop from the Explorer onto the DreamScene window,
and of course feel free to use your own songs if you prefer.

More about the visual plugins.
They are written with OpenGL 2.00+, using specific set of textures (strored in the BBplugin\Texture subfolder).
Each of the visual effect is a mix of artwork and advanced programming, some of them have taken weeks of work to produce the final result. This technology has been created for the BassBox line of audio players. That means any BassBox plugin could be used with the DreamScene project.

What is it good for?
The DreamScene concept is great when you have to create presentation (or karaoke) on external display, with a mix of audio sensitive animations, overlayed text, and graphics.

What about the CPU being used?
While ZWP is very capable at decoding/playing audio files, it has a low memory impact, because the visual plugins are using the GPU rather than CPU. Most of the time (on an I7 computer) it uses between 2 and 3% of the whole CPU resource.

While Plugins are ideal for computer with low CPU resource, there is another {more demanding} companion named ZWM (Zapsolution Window Movie), that is able to play most video format using the CCCP codecs. The result will look exactly the same, except that you have a movie playing in the background rather than OpenGL animations.

Title: Let Her dance for you
Post by: Patrice Terrier on December 12, 2016, 09:30:27 pm
Here is the C++ 64-bit version.

With more features, and more visual plugins.
- New ComboBox to select the Visual plugin.dll.
- Audio files, can be selected from the new ComboBox, or by drag and drop.
- The frame animation speed is now based on the music tempo.
- The main animation has been unlocked to drag it to another location.
- New ZWP version sending the NM_PULSE notification to the main application.


The attached project source code is ready to use with Visual Studio 2015 Community.

All binaries are inside the x64\Release folder.

Title: Re: DreamScene
Post by: Patrice Terrier on December 13, 2016, 09:14:22 pm
The 64-bit version has been updated to fix/extend a couple of minor features.

- NM_PAUSE, new notification.
- USE_FRAME, to start animation from a specific frame.
- Hide the seek tracker when audio is not playing.
- ZWP module, has been updated to prepare for video  playback.
- Code cleanup.

Title: DreamScene 64-bit for WinDev 17+
Post by: Patrice Terrier on November 17, 2021, 02:45:57 pm
This 64-bit project is compatible with all WD versions ranging from 17 to 26.

It is the translation of the 32-bit project written in 2010.

This version uses structures whose alignment corresponds to 64-bit mode, to call a 32-bit process via the WM_COPYDATA message
which allows two applications to interact using IPC (Inter Process Communication) and the COPYDATASTRUCT structure.
Note that the alignment of COPYDATASTRUCT documented in WDAPI is not good, when using 64-bit mode in WinDev.

The application is based on the principle of "DreamScene" popularized with the Ultimate version of Windows VISTA.
However, instead of displaying a background based on a .wmv type video, which runs in a loop.
It is an OpenGL plugin which is used to interact with the GDImage animation and music played by the application.
We therefore have a dynamic "DreamScene" whose appearance changes completely depending on the music and the plugin used.

One can change music on the fly by using the drag and drop from explorer.
The supported audio formats are as follows:
.mp3 .ogg .wav .aif .cda .mo3 .it .xm .s3m .mtm .mod .umx

Programming style.
The project is based on the use of the Windows low level API (SDK) which is the same for all languages.
The WinDev "Main" window is hidden at runtime, it is only used to easily position the various controls
(button, switch, gauge, potentiometer, GDImage field, etc.).
The application is skinned on the fly with WinLIFT / GDImage to run in compound DWM mode, with varying opacity levels.

OpenGL plugins (BassBox)
These are small DLLs written in low level code that allow you to interact in real time with the music being played.

GDImage / WinLIFT
Are designed to work together in compound mode sharing the same Direct Draw surface.
A GDImage field is able to simultaneously use GDI32, GDIPLUS, DWM, OpenGL, in a single container.

Examples of use
Create interactive presentations on an external screen, display advertising spots, Karaoke, visual effects for DJs, etc.

C'est la tansposition en mode 64-bit d'un projet 32-bit écrit en 2010 avec GDImage 5.00 .

Cette version utilise des structures dont l'alignement correspond au mode 64-bit, pour appeler un process 32-bit via le message WM_COPYDATA
qui permet de faire dialoguer 2 applications en utilisant IPC (Inter Process Communication) et la structure COPYDATASTRUCT.
A noter que l'alignement de COPYDATASTRUCT documenté dans WDAPI n'est pas bon, dès lors qu'on utilise le mode 64-bit dans WinDev.

L'application est basée sur le principe de "DreamScene" popularisé avec la version Ultimate de Windows VISTA.
Cependant au lieu d'afficher un arrière plan basé sur une vidéo de type .wmv, qui tourne en boucle.
C'est un plugin OpenGL qui est utilisé pour interagir avec l'animation GDImage et la musique jouée par l'application.
On a donc un "DreamScene" dynamique dont l'aspect change totalement en fonction de la musique et du plugin utilisé.

On peut changer de musique à la volée en utilisant le tirer déplacer depuis l'explorateur.
Les formats audio supportés sont les suivants :
.mp3 .ogg .wav .aif .cda .mo3 .it .xm .s3m .mtm .mod .umx

Style de programmation.
Le projet est basé sur l'utilisation de l'API bas niveau de Windows (SDK) qui est la même pour tous les langages.
La fenêtre WinDev "Main", est masquée en exécution, elle ne sert que pour positionner facilement les différents champs
(bouton, interrupteur, jauge, potentiomètre, champ GDImage, etc.).
L'application est skinnée à la volée avec WinLIFT/GDImage pour fonctionner en mode DWM composé, avec des niveaux d'opacité variable.

Plugins OpenGL (BassBox)
Ce sont de petites DLL écrites en code bas niveau qui permettent d'interagir en temps réel avec la musique qui est jouée.

Sont conçus pour fonctionner ensemble en mode composé en partageant la même surface Direct Draw.
Un champ GDImage est capable d'utiliser simultanément GDI32, GDIPLUS, DWM, OpenGL, dans un conteneur unique.

Exemples d'utilisation
Créer des présentations interactives sur écran externe, afficher des spots publicitaires, Karaoke, effets visuels pour DJ, etc.