Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: JSP3 to SMP/JSsplitter wrapper (Read 857 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

JSP3 to SMP/JSsplitter wrapper

As explained here: https://hydrogenaud.io/index.php/topic,126743.msg1053169.html#msg1053169

It's technically possible to load JSP3 scripts into SMP/JSplitter with minimal effort as long as a translation layer is provided. This may be subject to change if marc changes the JSP3 methods or scripts at any point but right now some of the provided samples work fine with this method.

Why? Because some of the JSP3 samples have been updated compared to the SMP counterparts, so they may be preferred in some cases (if there is not a port to SMP by someone). Obviously, people may simply install JSP3 and done, but that is not possible unless you are running Win 10+ and foobar 2.1+. In any case, this library simply allows to have updated samples without any need of manually translating code.

Usage. Take the main JSP3 script and replace all pre-processor by includes:
Code: [Select]
// ==PREPROCESSOR==
// @name "Smooth Browser"
// @author "Br3tt aka Falstaff"
// @import "%fb2k_component_path%helpers.txt"
// @import "%fb2k_component_path%samples\smooth\common.js"
// @import "%fb2k_component_path%samples\smooth\inputbox.js"
// @import "%fb2k_component_path%samples\smooth\scrollbar.js"
// @import "%fb2k_component_path%samples\smooth\jssb.js"
// ==/PREPROCESSOR==

// https://jscript-panel.github.io/gallery/smooth-browser/

Note I'm using relative paths since SMP support them, but you may also use the same paths than above. Obviously, escape '\' as '\\':
Code: [Select]
'use strict';
window.DefinePanel('JS Smooth Browser', { author : 'Br3tt aka Falstaff & marc2003 & regorxxx' });
include('js\\jsptosmp.js');
include('js\\helpers.js');
include('js\\common.js');
include('js\\inputbox.js');
include('js\\scrollbar.js');
include('js\\jssb.js');
include('js\\jsptosmp_post.js');
//https://jscript-panel.github.io/gallery/smooth-browser/

jsptosmp.js must be added before any JSP code or helper loaded. It will patch anything below that point.
jsptosmp_post.js must be loaded after all JSP code or helper loaded. It will patch any callback defined up to that point.

That's all. No need to touch a single line of code.

Results:
JS Smooth Browser.js
X
JS Smooth Playlist.js
X
JS Smooth Playlist Manager.js
X

There is a proof of concept sample on the zip file. The 3 JS Smooth scripts.

Warning:
  • This is WIP.
  • Samples attached work fine but applying the same library to other samples may throw errors. Specially for complex scripts. Use at your own responsibility.
  • Many methods have not been implemented yet.
  • Any method not covered yet in the wrapper will simply crash the panel when used by the original script.
  • Just discovered properties and method names are not case sensitive in JSP. Therefore some code valid in JSP3 is considered an error on standard JS (and thus SMP/JSplitter).
  • I have taken a lot of liberties patching methods. Some JSP methods are essentially request I made for SMP or code I implemented in some way in my scripts, so I simply used my helpers to cover them. Other methods can be emulated with promises, curl.exe (web downloads), activeX objects,  etc. I will try to document all that on the library.
  • String drawing methods are the most difficult to patch since there are non equivalent features on GDI (smp) and DW (JSP3), therefore I again took some liberty to apply font styles, weights, etc. All methods related to layouts, font TF, flags and SVG are missing. Only layouts can be somewhat emulated along flags (at least the code part).

DON'T REQUEST ANYTHING. REPORTS ABOUT CRASHES ARE WELCOME THOUGH (I probably know them anyway).

Re: JSP3 to SMP/JSsplitter wrapper

Reply #1
I don't understand how to use it with JSsplitter
> jsptosmp.js must be added before any JSP code or helper loaded. It will patch anything below that point.
> jsptosmp_post.js must be loaded after all JSP code or helper loaded. It will patch any callback defined up to that point.

Wouldn't it be enough to simply select JSpplitter Configuration > FIle >*.js?

JS Smooth Browser.js
JS Smooth Playlist Manager.js
JS Smooth Playlist.js



Smooth Browser (JS Smooth Browser)

The right click is for JSsplitter, and it is inconvenient that there is no "Panel properties..."
That is one of the inconveniences of JSsplitter.


SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JSP3 to SMP/JSsplitter wrapper

Reply #2
This is for JSP3 samples, which has nothing to do with whatever JSplitter samples offer.

Re: JSP3 to SMP/JSsplitter wrapper

Reply #3
> Why? Because some of the JSP3 samples have been updated compared to the SMP counterparts, so they may be preferred in some cases (if there is not a port to SMP by someone). Obviously, people may simply install JSP3 and done, but that is not possible unless you are running Win 10+ and foobar 2.1+. In any case, this library simply allows to have updated samples without any need of manually translating code.

I don't really understand the reason or advantage of displaying JSP3 script as SMP/JSsplitter. JSsplitter can display other Panels and can be displayed overlapping with SMP. It is easier to use if you display it as JSP3 script. You can also right-click and select "Edit properties...".
For those of you using 32-bit SKin, would it be more convenient to unify to SMP?
Well, I don't understand it at my level.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JSP3 to SMP/JSsplitter wrapper

Reply #4
Obviously, people may simply install JSP3 and done, but that is not possible unless you are running Win 10+ and foobar 2.1+.

While it's true the current version does have these increased system requirements, the last version compatible with windows 7/fb2k 1.6.6+ was updated exactly one month ago.

I announce this in the main component thread and download links are provided on the documentation landing page and main release page.

https://github.com/jscript-panel/release/releases/tag/legacy

I did drop a clanger with the previous release where it didn't load on windows 7 and it went unnoticed for quite some time because a dependency update broke compatibility and I lazily released it without testing.

The latest version is absolutely verified as working...



While this version it not getting new features, I'm still open to fixing bugs if they're reported.

Re: JSP3 to SMP/JSsplitter wrapper

Reply #5
I see. Since the legacy version is somewhat locked on features, I presume the scripts are older versions (?).

To be honest is was just that I wanted to try it and lets see what could be done. I'm sure most people will either use the native component or just stick to JSsplitter or use both at the same time. But find it interesting to just be able to copy the samples and make them work.

There is one thing I noticed so far using the library, Smooth browser caches the album covers as jpg. And have noticed the images saved by SMP are 3 to 4 times larger in file size than the ones at JSP3 (even after I resize them to 300 px as your component does). Is that improvement on image handling from DW or you are just saving them on lower quality?

Re: JSP3 to SMP/JSsplitter wrapper

Reply #6
Not really sure about the JPG quality. I use the Windows Imaging Component as opposed to Gdiplus in SMP/old JSP.

I use whatever the default is and I think it's 75 on a scale of 0-100 but cannot be 100% sure.

I do implement proper quality settings in another component I maintain (foo_cover_utils) but this code didn't make it in to JSP3.

edit: just remembered, SMP saves as PNG by default so if you've been omitting the type, that will happen. You must supply SaveAs with "image/jpeg". File extension alone is not enough.

 

Re: JSP3 to SMP/JSsplitter wrapper

Reply #7
Your component don't specify the type and I forgot to patch that method for images so it just keep using png with .jpg extension as you said. Funny Foobar load those files fine, but tried to open them in photoshop and error. Changed extension to .png and fine.

Fixed and also as result performance improved a lot, thanks!

Latest version. Fixed that bug and fully patched console, fb and plman. Tomorrow I will revise and finish the other namespaces.
Quote
   - Known limits: (anything not mentioned works fine)
      + console:
         - console.GetLines not supported, returns []
         - console.ClearBacklog not supported, does nothing
      + fb:
         - fb.CustomVolume not supported, returns -1
         - fb.AddLocationsAsync not supported, returns taskId = -1
         - fb.GetActiveDSPs not supported, returns []
         - fb.EnableAdvancedLogging not supported, does nothing
         - fb.GetAudioChunk not supported, returns null
         - fb.IsLibraryInitialised not supported, returns true
      + plman:
         - plman.FindByGUID only supported on JSplitter, returns -1 on SMP
         - plman.GetGUID only supported on JSplitter, returns -1 on SMP