webamp/packages/webamp-modern/assets/winamp_classic/scripts/wa2visualizer.m
Fathony Luthfillah 6a97db0a13
x2nie dev8 (Multi Skin Engines) (#1203)
* prettier

* typo

* bugfix: expect error on non supported skin format

* multiple instance, different gamma (colors)

* bugfix colortheme bg, cleanup

* prettier

* back to load single skin, del dead code

* del hack()

* trial to rename 'parse' -> skinengine_wal

* fully SkinEngine_Audio

* cleanup console warn.

* real switchSkin

* integrate WAL parser with plugable skinEngine.

* +KJofol !

* show Vis, Song,

* +WindowsMediaPlayer: Engine,Skins.

* load JS

* MMD3's header: movable

* +DialKnob

* +Button for down image that use global bmp

* preparing to Dock (layout name|mode)

* dock!

* undoc button

* +FloodLevel: kjofol seek. only ui/drag-mouse

* bugfix can't click

* +slider action.

* del dead code

* bugfix on switch kjofol skin

* call dispose() on switch skin

* bugfix Audion timer.

* bugfix loading skin*.zip, bugfix knob

* demo: loading .zip (unknown|ambiguous ext)

* just rename file

* wsz: failed to load wsz:(

* default Equalizer: missing #11,#12

* loading classic skin .wsz

* bugfix: don't stop when bitmap not found

* maximum viable.

* Replace the previous base with DeClassified

This commit aims to replace the base used for rendering Classic Skins in Webamp Modern with the latest commit of DeClassified

* added iso support for the EQ, update base skin

* working tooltips for the time display

* rename wsz_root to skin

for some reason this still doesnt make webamp modern render the skin it's given

* a bunch of things

* allow wsz_root to skin. (failed due missing files)

* prettier

* add but ignore. maybe soon be used

* temporary disabling "application.mi"

* reusing old classic code, that works

* + manifesto

* okay, lets use skin in correct way

* ren file

* redefining eq xml

* thumb background changes when mousemove

* +Pitch !

* set seek z-order to be not covering pitch.

* pitch: smooth audio effect during changes.

* bugfix normal pitch != 100%

* +Shade mode

* add objective-c syntaxt highlighter

* +Repeat, Shuffle

* Call & StrangeCall diff exploration

* +FileExtractor

* prettier.

* loading sonique for first time

* loading sonique for first time

* showing the main frame, + regional applied

* play,pause,stop

* play,pause,stop click images

* revert to using std|*.json

* show song duration (both enquee & addtrack)

* finding a correct bitrate

* +real metadata, +experiment bitRate

* show real song artist + title

* +showing real KBPS, real KHZ.

* track.id is not (can not be) required,
error on eqnueeefile()

* complete album art.

* bugfix volume onchanged

* del dead code

* lowercase key, to avoid misleading

* lowercase key, to avoid misleading

* speedup id3 parsing by Promise

* load another maki

* valid: uiRoot required for vm.

* move Track

* playlist text elipsis

* +scifi (sample skin)

* first attept to wrap text inside an irregular
shape

* reduce noise in html. => head/css.

* show cone gradient as Ring's preparation.

* show progress Ring

* both ring are now drawn.

* allow 270deg

* preparing real progress

* completing ui, no event yet

* bugfix mistaken mask

* allowing ring.action (+events)

* shuffle,repeat.

* eject

* switch to layout:NAV

* switch to layout:SMALL

* adding JetAudio support

* all bitmaps are loaded

* prevent 'undefined' id.

* show something visible :P

* preparing to load one tag with several meaning

* adding JetCowonAudio (old uib) support

* bugfix CORS issue of api.webampskins.org/graphql

* more window buttons

* add more sonique skin

* do list of ini content

* valid yarn build.

* sgf extractor

* sonique icon

* ignore 'extracted-*' folders

* add more sonique skin to load

* custom bitmap (just shown)

* just colorized

* maybe yes/no. colors is not confirmed

* not-found items (
taken from sonique install dir)

* load global png: via .ts

* show icons in circle buttons!

* exploring rgn (failed)

* can load from path (yeah, slow! :v)

* add freform/winamp

* add lineHeight to adjust font-size

* add border-bottom of menus

* prefix css (scrollbars)

* just commit, whatever.

* bugfix frequency position (not overlaped)

* +Menu ! (can only hover & mouse-down)

* still bugfix lineheight of titlebar's text

* show deprecated class

* show deprecated methods

* better on showing deprecated

* bugfix Menu.GUID

* force lowercase

* menus res

* set zero as a valid value of calcelation.

* completing Container props

* add more props, and also by retype (lowcase typo)

* pre-add

* +List, etc.

* addd more props

* rename _width -> _w & _height -> _h

* +onresize

* more detail message of too many similar error

* +ontextchanged

* log description on where the error come?

* avoid missing script id. (better debug)

* attaching WindowHolder

* my BigBento is just working (some hardcoded)

* add (my hacked) BigBento into selection.

* rename: _resizable -> _canResize. to avoid conflict
in Frame

* Frame.from = L

* a bit better. but not reflect on toggle click.

* reaching 71% of maki implementation

* mute frame border

* MUTE GRAPHQL ERROR CORS.

* dummy method: addSubMenu

* oke lah. lumayan

* implement windowholder for PL (only).

* correct align children: left & right.

* a bit better (assuring all key = lowercased)

* recompile some scripts

* bugfix thinger

* +MMD3 with thinger included (standalone)

* bugfix mono/stereo  get by text.display="songinfo"

* +winamp browser

* + Maki Explorer

* +fake implementation

* Big Bugfix: COnfig Item

* I understand, bud no found any mistake

* trial to compare string == insensitive

* trial to compare string != insensitive

* trial to case insensitive

* trial to compare string != insensitive

* bugfix triggering multi events

* set DEBUG, doesnt work :(

* more preserved guid

* mice down/up = work. but no visually.

* add undefined as fake

* implement fake Popup > open @mouse-hover

* bugfix: hover didn't work

* mute lint error

* bugfix xmlParam -> toLowerCase

* failed code to comment:

* allow bool as int

* mute console

* unhide text when not expanded | to find a text

* inpect "Class" in binary (distinct to other var)

* bugfix CORS cdn. , wait until user click demo.

* bugfix reading unicode char.

* Mad Apple Girl dancing

* Mad Apple Girl skin

* bad apple HD

* set back Text to be used by titlebar

* Completing missing classes (For better
 maki explorer / maki understanding)

* split editor to 2, for comparing up & down

* mark CLASS. by subclassing of vars identification

* Full speed animation

* add more maki: Application, File+XmlDoc

* add more maki: Application, File+XmlDoc

* more info when error (id of script)

* +global: application. +few methods

* +few methods.

* beautify (format doc), (typo)

* bugfix eris-lund: found a fatal error/program stop

* Class defintion (in maki file) is back supported.

* STUPID? mute ERROR. (don't stop)

* set back to very-simple logic

* implement alternateText

* bugfix a maki file loaded twice (multi)

* + trigger event in a class.

* mute console

* sorry, for hardcoded. ;p

* clean up uneeded dependency

* load very simple part: main.bmp + cbutton.bmp

* load main.shaded

* bitrates

* bitrates

* more classic skin

* + note & link, +full bitlist

* more classic items

* more progress.

* ++ various implementation, based on /progress

* *.WMZ region.txt is now ready !

* typo.

* integrate play/pause/stop statuses + mono|stereo

* network status

* change: wa.play.red => traffic.red (buffering)

* Volume + Pan

* EQ + PL buttons

* bugfix Text (char not found , too narrow
 bitmapfont)

* TIME text is clickable

* +Shuffle + Repeat

* better pseudo minus sign taken from "5" & "7" char

* pixel-perfect of Timer (text) of WInamp Modern.

* completing classic.player (container)

* completing VISCOLOR.txt parsing & applying values

* bugfix wrong parameter of vis

* Allow bitmap transparency by color (WMP)

* bugfix wrong parameter of vis

* Green Head is back running! (WMP)

* running WMP correctly

* running WMP correctly: background-color

* format from root dir

* format from root dir

* reduce lint complain

* del unknown file

---------

Co-authored-by: Fathony <fathony@smart-leaders.net>
Co-authored-by: Eris Lund <38136789+0x5066@users.noreply.github.com>
2023-02-23 08:41:17 -05:00

415 lines
No EOL
11 KiB
Matlab

/*---------------------------------------------------
-----------------------------------------------------
Filename: wa2visualizer.m
Version: 2.1
Type: maki
Date: 07. Okt. 2007 - 19:56 , May 24th 2021 - 2:13am UTC+1
Author: Martin Poehlmann aka Deimos, Eris Lund (0x5066), mirzi
E-Mail: martin@skinconsortium.com
Internet: www.skinconsortium.com
www.martin.deimos.de.vu
Note: Ripped from Winamp Modern, removed the VU Meter section
as it's not relevant just yet, this also includes
the option to set the Spectrum Analyzer coloring.
-----------------------------------------------------
---------------------------------------------------*/
#include "..\..\..\lib/std.mi"
Function refreshVisSettings();
Function setVis (int mode);
Function ProcessMenuResult (int a);
Global Group scriptGroup;
Global Vis visualizer;
Global PopUpMenu visMenu;
Global PopUpMenu pksmenu;
Global PopUpMenu anamenu;
Global PopUpMenu anasettings;
Global PopUpMenu oscsettings;
Global PopUpMenu stylemenu;
Global PopUpMenu fpsmenu;
Global Int currentMode, a_falloffspeed, p_falloffspeed, osc_render, ana_render, a_coloring, v_fps;
Global Boolean show_peaks, isShade;
Global layer trigger;
Global Layout thislayout;
Global Container main;
System.onScriptLoaded()
{
scriptGroup = getScriptGroup();
visualizer = scriptGroup.findObject("wa.vis");
trigger = scriptGroup.findObject("main.vis.trigger");
visualizer.setXmlParam("Peaks", integerToString(show_peaks));
visualizer.setXmlParam("peakfalloff", integerToString(p_falloffspeed));
visualizer.setXmlParam("falloff", integerToString(a_falloffspeed));
visualizer.setXmlParam("oscstyle", integerToString(osc_render));
visualizer.setXmlParam("bandwidth", integerToString(ana_render));
refreshVisSettings();
}
refreshVisSettings ()
{
currentMode = getPrivateInt(getSkinName(), "Visualizer Mode", 1);
show_peaks = getPrivateInt(getSkinName(), "Visualizer show Peaks", 1);
a_falloffspeed = getPrivateInt(getSkinName(), "Visualizer analyzer falloff", 3);
p_falloffspeed = getPrivateInt(getSkinName(), "Visualizer Peaks falloff", 2);
osc_render = getPrivateInt(getSkinName(), "Oscilloscope Settings", 1);
ana_render = getPrivateInt(getSkinName(), "Spectrum Analyzer Settings", 2);
a_coloring = getPrivateInt(getSkinName(), "Visualizer analyzer coloring", 0);
v_fps = getPrivateInt(getSkinName(), "Visualizer Refresh rate", 3);
visualizer.setXmlParam("Peaks", integerToString(show_peaks));
visualizer.setXmlParam("peakfalloff", integerToString(p_falloffspeed));
visualizer.setXmlParam("falloff", integerToString(a_falloffspeed));
visualizer.setXmlParam("oscstyle", integerToString(osc_render));
visualizer.setXmlParam("bandwidth", integerToString(ana_render));
if (a_coloring == 0)
{
visualizer.setXmlParam("coloring", "Normal");
}
else if (a_coloring == 1)
{
visualizer.setXmlParam("coloring", "Normal");
}
else if (a_coloring == 2)
{
visualizer.setXmlParam("coloring", "Fire");
}
else if (a_coloring == 3)
{
visualizer.setXmlParam("coloring", "Line");
}
if (osc_render == 0)
{
visualizer.setXmlParam("oscstyle", "Lines");
}
else if (osc_render == 2)
{
visualizer.setXmlParam("oscstyle", "Lines");
}
else if (osc_render == 1)
{
visualizer.setXmlParam("oscstyle", "Solid");
}
else if (osc_render == 3)
{
visualizer.setXmlParam("oscstyle", "Dots");
}
setPrivateInt(getSkinName(), "Oscilloscope Settings", osc_render);
if (ana_render == 0)
{
visualizer.setXmlParam("bandwidth", "Thin");
}
else if (ana_render == 1)
{
visualizer.setXmlParam("bandwidth", "Thin");
}
else if (ana_render == 2)
{
visualizer.setXmlParam("bandwidth", "wide");
}
setPrivateInt(getSkinName(), "Spectrum Analyzer Settings", ana_render);
if (v_fps == 0)
{
visualizer.setXmlParam("fps", "9");
}
else if (v_fps == 1)
{
visualizer.setXmlParam("fps", "9");
}
else if (v_fps == 2)
{
visualizer.setXmlParam("fps", "18");
}
else if (v_fps == 3)
{
visualizer.setXmlParam("fps", "35");
}
else if (v_fps == 4)
{
visualizer.setXmlParam("fps", "70");
}
setVis (currentMode);
}
trigger.onLeftButtonDown (int x, int y)
{
if (isKeyDown(VK_ALT) && isKeyDown(VK_SHIFT) && isKeyDown(VK_CONTROL))
{
if (visualizer.getXmlParam("fliph") == "1")
{
visualizer.setXmlParam("fliph", "0");
}
else
{
visualizer.setXmlParam("fliph", "1");
}
return;
}
if (isKeyDown(4) && isKeyDown(VK_SHIFT) && isKeyDown(VK_CONTROL))
{
if (visualizer.getXmlParam("flipv") == "1")
{
visualizer.setXmlParam("flipv", "0");
}
else
{
visualizer.setXmlParam("flipv", "1");
}
return;
}
currentMode++;
if (currentMode == 3)
{
currentMode = 0;
}
setVis (currentMode);
complete;
}
trigger.onRightButtonUp (int x, int y)
{
visMenu = new PopUpMenu;
pksmenu = new PopUpMenu;
anamenu = new PopUpMenu;
stylemenu = new PopUpMenu;
anasettings = new PopUpMenu;
oscsettings = new PopUpMenu;
fpsmenu = new PopUpMenu;
visMenu.addCommand("Visualization mode:", 999, 0, 1);
visMenu.addSeparator();
visMenu.addCommand("Off", 100, currentMode == 0, 0);
visMenu.addCommand("Spectrum analyzer", 1, currentMode == 1, 0);
visMenu.addCommand("Oscilliscope", 2, currentMode == 2, 0);
visMenu.addSeparator();
visMenu.addCommand("Modern Visualizer Settings", 998, 0, 1);
visMenu.addSeparator();
visMenu.addSubmenu(fpsmenu, "Refresh rate");
fpsmenu.addCommand("9fps", 800, v_fps == 0, 0);
fpsmenu.addCommand("18fps", 802, v_fps == 2, 0);
fpsmenu.addCommand("35fps", 803, v_fps == 3, 0);
fpsmenu.addCommand("70fps", 804, v_fps == 4, 0);
visMenu.addSubmenu(anasettings, "Spectrum analyzer options");
//anasettings.addCommand("Band line width:", 997, 0, 1);
//anasettings.addSeparator();
anasettings.addCommand("Normal style", 400, a_coloring == 0, 0);
anasettings.addCommand("Fire style", 402, a_coloring == 2, 0);
anasettings.addCommand("Line style", 403, a_coloring == 3, 0);
anasettings.addSeparator();
anasettings.addCommand("Peaks", 101, show_peaks == 1, 0);
anasettings.addSeparator();
anasettings.addCommand("Thin bands", 701, ana_render == 1, 0);
if(getDateDay(getDate()) == 1 && getDateMonth(getDate()) == 3){
anasettings.addCommand("乇乂丅尺卂 丅卄工匚匚", 702, ana_render == 2, 0);
}else{
anasettings.addCommand("Thick bands", 702, ana_render == 2, 0);
}
anasettings.addSeparator();
anasettings.addSubMenu(anamenu, "Analyzer falloff");
anamenu.addCommand("Slower", 300, a_falloffspeed == 0, 0);
anamenu.addCommand("Slow", 301, a_falloffspeed == 1, 0);
anamenu.addCommand("Moderate", 302, a_falloffspeed == 2, 0);
anamenu.addCommand("Fast", 303, a_falloffspeed == 3, 0);
anamenu.addCommand("Faster", 304, a_falloffspeed == 4, 0);
anasettings.addSubMenu(pksmenu, "Peaks falloff");
pksmenu.addCommand("Slower", 200, p_falloffspeed == 0, 0);
pksmenu.addCommand("Slow", 201, p_falloffspeed == 1, 0);
pksmenu.addCommand("Moderate", 202, p_falloffspeed == 2, 0);
pksmenu.addCommand("Fast", 203, p_falloffspeed == 3, 0);
pksmenu.addCommand("Faster", 204, p_falloffspeed == 4, 0);
//anasettings.addSubMenu(stylemenu, "Analyzer Coloring");
visMenu.addSubmenu(oscsettings, "Oscilliscope Options");
//oscsettings.addCommand("Oscilloscope drawing style:", 996, 0, 1);
//oscsettings.addSeparator();
oscsettings.addCommand("Dot scope", 603, osc_render == 3, 0);
oscsettings.addCommand("Line scope", 601, osc_render == 1, 0);
oscsettings.addCommand("Solid scope", 602, osc_render == 2, 0);
ProcessMenuResult (visMenu.popAtMouse());
delete visMenu;
delete pksmenu;
delete anamenu;
delete stylemenu;
delete anasettings;
delete oscsettings;
delete fpsmenu;
complete;
}
ProcessMenuResult (int a)
{
if (a < 1) return;
if (a > 0 && a <= 6 || a == 100)
{
if (a == 100) a = 0;
setVis(a);
}
else if (a == 101)
{
show_peaks = (show_peaks - 1) * (-1);
visualizer.setXmlParam("Peaks", integerToString(show_peaks));
setPrivateInt(getSkinName(), "Visualizer show Peaks", show_peaks);
}
else if (a >= 200 && a <= 204)
{
p_falloffspeed = a - 200;
visualizer.setXmlParam("peakfalloff", integerToString(p_falloffspeed));
setPrivateInt(getSkinName(), "Visualizer Peaks falloff", p_falloffspeed);
}
else if (a >= 300 && a <= 304)
{
a_falloffspeed = a - 300;
visualizer.setXmlParam("falloff", integerToString(a_falloffspeed));
setPrivateInt(getSkinName(), "Visualizer analyzer falloff", a_falloffspeed);
}
else if (a >= 400 && a <= 403)
{
a_coloring = a - 400;
if (a_coloring == 0)
{
visualizer.setXmlParam("coloring", "Normal");
}
else if (a_coloring == 1)
{
visualizer.setXmlParam("coloring", "Normal");
}
else if (a_coloring == 2)
{
visualizer.setXmlParam("coloring", "Fire");
}
else if (a_coloring == 3)
{
visualizer.setXmlParam("coloring", "Line");
}
setPrivateInt(getSkinName(), "Visualizer analyzer coloring", a_coloring);
}
else if (a >= 600 && a <= 603)
{
osc_render = a - 600;
if (osc_render == 0)
{
visualizer.setXmlParam("oscstyle", "lines");
}
else if (osc_render == 2)
{
visualizer.setXmlParam("oscstyle", "lines");
}
else if (osc_render == 1)
{
visualizer.setXmlParam("oscstyle", "solid");
}
else if (osc_render == 3)
{
visualizer.setXmlParam("oscstyle", "dots");
}
setPrivateInt(getSkinName(), "Oscilloscope Settings", osc_render);
}
else if (a >= 700 && a <= 702)
{
ana_render = a - 700;
if (ana_render == 0)
{
visualizer.setXmlParam("bandwidth", "thin");
}
else if (ana_render == 1)
{
visualizer.setXmlParam("bandwidth", "thin");
}
else if (ana_render == 2)
{
visualizer.setXmlParam("bandwidth", "wide");
}
setPrivateInt(getSkinName(), "Spectrum Analyzer Settings", ana_render);
}
else if (a >= 800 && a <= 804)
{
v_fps = a - 800;
if (v_fps == 0)
{
visualizer.setXmlParam("fps", "9");
}
else if (v_fps == 1)
{
visualizer.setXmlParam("fps", "9");
}
else if (v_fps == 2)
{
visualizer.setXmlParam("fps", "18");
}
else if (v_fps == 3)
{
visualizer.setXmlParam("fps", "35");
}
else if (v_fps == 4)
{
visualizer.setXmlParam("fps", "70");
}
setPrivateInt(getSkinName(), "Visualizer Refresh rate", v_fps);
}
}
setVis (int mode)
{
setPrivateInt(getSkinName(), "Visualizer Mode", mode);
if (mode == 0)
{
visualizer.setMode(0);
}
else if (mode == 1)
{
visualizer.setMode(1);
}
else if (mode == 2)
{
visualizer.setMode(2);
}
currentMode = mode;
}
// Sync Normal and Shade Layout
main.onBeforeSwitchToLayout(Layout oldlayout, Layout newlayout)
{
if (newlayout != thislayout)
{
return;
}
refreshVisSettings();
}