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: foo_wave_seekbar (Read 797224 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: foo_wave_seekbar

Reply #1950
OK I'm back with more script requests for this wonderful plugin :)

I've made a visual to show my ideas:
http://i.imgsafe.org/bf1c9bc.png

The ideas are as follows:
1. Revert the top and bottom halves to equal height (I prefer it to look symmetrical)
2. Is it possible to have the playback time follow along the playhead?
3. Switch around the colors so that the bottom half is more transparent, making it look like a shadow or reflection at the bottom
4. Can the playhead line be a solid rectangle instead of faded? And can there be a 1 pixel gap at the top and bottom?
5. Finally (and most importantly) can a grid be overlayed over the whole thing? This will give it a sense of texture, detail and fine waveforms, instead of just looking like a big solid block of color.

Re: foo_wave_seekbar

Reply #1951
I'm going to post my suggestions in-line with the quotes below, but anything that requires development work on the component itself is way out of scope, as I don't touch this code anymore for reasons outlined earlier in the thread.

> 1. Revert the top and bottom halves to equal height (I prefer it to look symmetrical)

Just tune some numbers in the effect.

> 2. Is it possible to have the playback time follow along the playhead?

With a bunch of work if you had arbitrary texture support in the shader or parametric letters, but not really.

> 3. Switch around the colors so that the bottom half is more transparent, making it look like a shadow or reflection at the bottom

Just tune some numbers in the effect.

> 4. Can the playhead line be a solid rectangle instead of faded? And can there be a 1 pixel gap at the top and bottom?

Just tune some logic in the effect.

> 5. Finally (and most importantly) can a grid be overlayed over the whole thing? This will give it a sense of texture, detail and fine waveforms, instead of just looking like a big solid block of color.

Just tune some logic and numbers in the effect.
Stay sane, exile.

Re: foo_wave_seekbar

Reply #1952
here's some posts in this thread that might lead to what you want.

https://hydrogenaud.io/index.php/topic,77490.msg677800.html#msg677800
https://hydrogenaud.io/index.php/topic,77564.msg677896.html#msg677896
https://hydrogenaud.io/index.php/topic,77490.msg700690.html#msg700690
https://hydrogenaud.io/index.php/topic,77490.msg701045.html#msg701045
https://hydrogenaud.io/index.php/topic,77490.msg705002.html#msg705002
https://hydrogenaud.io/index.php/topic,77490.msg705262.html#msg705262
https://hydrogenaud.io/index.php/topic,63984.msg829077.html#msg829077
https://hydrogenaud.io/index.php/topic,63984.msg829849.html#msg829849
https://hydrogenaud.io/index.php/topic,77490.msg834712.html#msg834712
https://hydrogenaud.io/index.php/topic,77490.msg837702.html#msg837702
https://hydrogenaud.io/index.php/topic,77490.msg907084.html#msg907084
https://hydrogenaud.io/index.php/topic,77490.msg916190.html#msg916190

But I can tell you upfront that having a grid overlay and playback time showing is not possible.

Can't help you with the other things as I have no clue about Pixel Shader programming and have still not managed to get it to show how I want it myself (and given the answer above mine, it don't look like I ever will be. Like there seems to be a way to have an image as background, and to have it dump the full bar as screenshot but so far not found out how)

Re: foo_wave_seekbar

Reply #1953
You can do the grid effect by using the x pixel coordinate as a lookup into a table of intensities, like:

Code: [Select]
float imap[4] = { 0.3, 0.7, 1.0, 0.7 };
int idx = pixel_x % 4;
float grid_intensity = imap[idx];
color *= grid_intensity;

For the vertical fade component of this, multiplying this with (1.0-abs(y)) or something ought to kind of work.
I've not written D3D9-era HLSL in ages, so take things with a fistful of salt.

When it comes to arbitrary textures my mind is failing but I think that functionality was removed at some point in time due to not being used and being annoying to work with in the code. Screenshots may or may not be in there still, with a hidden command or something. That was a one-off feature for someone.
Stay sane, exile.

Re: foo_wave_seekbar

Reply #1954
Thank you both for your help. I'm afraid I know nothing of this scripting language, so I am entirely at the mercy of other people here.

Re: foo_wave_seekbar

Reply #1955
like you I'm barely out of the gate and can just manage juggling numbers, which most times does weird unexpected things to the colors and other times by sheer luck comes close to what I hoped, but when it comes to stuff, like putting that Grid code Zao posted in a place where it'll do something meaningful ... he he :) that's already beyond me...

Re: foo_wave_seekbar

Reply #1956
Thank you both for your help. I'm afraid I know nothing of this scripting language, so I am entirely at the mercy of other people here.
Code: [Select]
texture tex : WAVEFORMDATA;

sampler sTex = sampler_state
{
Texture = (tex);
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;

AddressU = Clamp;
};

struct VS_IN
{
float2 pos : POSITION;
float2 tc : TEXCOORD0;
};

struct PS_IN
{
float4 pos : SV_POSITION;
float2 tc : TEXCOORD0;
};


float4 backgroundColor : BACKGROUNDCOLOR;
float4 highlightColor : HIGHLIGHTCOLOR;
float4 selectionColor : SELECTIONCOLOR;
float4 textColor : TEXTCOLOR;
float cursorPos : CURSORPOSITION;
bool cursorVisible : CURSORVISIBLE;
float seekPos : SEEKPOSITION;
bool seeking : SEEKING;
float4 replayGain : REPLAYGAIN; // album gain, track gain, album peak, track peak
float2 viewportSize : VIEWPORTSIZE;
bool horizontal : ORIENTATION;
bool flipped : FLIPPED;
bool shade_played : SHADEPLAYED;
float3 track_magnitude : TRACKMAGNITUDE;

PS_IN VS( VS_IN input )
{
PS_IN output = (PS_IN)0;

float2 half_pixel = float2(1,-1) / viewportSize;
output.pos = float4(input.pos - half_pixel, 0, 1);

if (horizontal)
output.tc = float2((input.tc.x + 1.0) / 2.0, input.tc.y);
else
output.tc = float2((-input.tc.y + 1.0) / 2.0, input.tc.x);

if (flipped)
output.tc.x = 1.0 - output.tc.x;

return output;
}

float4 bar( float pos, float2 tc, float4 fg, float4 bg, float width, bool show )
{
float dist = abs(pos - tc.x);
float4 c = (show && dist < width)
? lerp(fg, bg, smoothstep(0, width, dist))
: bg;
return c;
}

float4 evaluate( float2 tc, float cursorPos )
{
// alpha 1 indicates biased texture
float4 minmaxrms = tex1D(sTex, tc.x);
minmaxrms.rgb -= 0.5 * minmaxrms.a;
minmaxrms.rgb *= 1.0 + minmaxrms.a;

if (replayGain.g != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.g) / 25) * 1.6; //use track gain
} else if (replayGain.r != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.r) / 25) * 1.6; //use album gain
}

float below = tc.y - minmaxrms.r;
float above = tc.y - minmaxrms.g;
float factor = min(abs(below), abs(above));
bool outside = (below < 0 || above > 0);
bool inside_rms = abs(tc.y) <= minmaxrms.b;
bool played = cursorPos < tc.x;
float4 inside_color = played ? textColor : highlightColor;
float4 bgColor = backgroundColor;


float4 wave = outside
? bgColor
: inside_color
;

return saturate(wave);
}

float4 reflect_evaluate( float2 tc, float cursorPos)
{
float baseline = -1.0/9.0;
float low_unscale = 3.0/3.7;
float high_unscale = 3.0/3.7;
bool mirrored = tc.y < baseline;
if (mirrored) {
tc.y = baseline - tc.y;
tc.y = tc.y * low_unscale;
}
else {
tc.y = tc.y - baseline;
tc.y = tc.y * high_unscale;
}
float mag = max(-track_magnitude.r, track_magnitude.g);
if (mag > 0.95) {
tc.y = lerp(0, mag/0.95, tc.y);
}
float boost = mirrored ? 1.1 : 1.4;
float gradient = lerp(0.7, 1.0, tc.y);
return boost * gradient * evaluate(tc, cursorPos);
}

float4 PS( PS_IN input ) : SV_Target
{
float dx, dy;
if (horizontal) {
dx = 1/viewportSize.x;
dy = 1/viewportSize.y;
}
else {
dx = 1/viewportSize.y;
dy = 1/viewportSize.x;
}
float seekWidth = 2.5 * dx;
float positionWidth = 3.0 * dx;

float4 c0 = reflect_evaluate(input.tc, cursorPos);
c0 = bar(cursorPos, input.tc, selectionColor, c0, positionWidth, cursorVisible);
c0 = bar(seekPos, input.tc, selectionColor, c0, seekWidth, seeking );
return c0;
}

technique Render9
{
pass
{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_2_0 PS();
}
}

Not exactly what you wanted... but it's something :D
| QAAC ~ 192 kbps |

Re: foo_wave_seekbar

Reply #1957
Not exactly what you wanted... but it's something :D
Hey that's great, thank you! :) It achieves 1 and 3 of my requests.

I also found I could make the waveform more central by changing the line:
float baseline = -1./9.0;
to
float baseline = -0/9.0;

Though changing this code is all guesswork. None of the codes people post here have any comments in them so it's hard to know what does what. I can't even understand my own code without comments, let alone someone else's!

Re: foo_wave_seekbar

Reply #1958
Yep, although after a while you do get a slight feel for what some parts of the code do or which parts to ignore.

And my own tinkering gave me the surprise of my life yesterday. I suspected there was a possibility but never saw anyone mention this.
I've managed to do something that makes the vertical bar stay static in the middle and have the wave seekbar  scroll to left (with about the same speed as the spectogram.)

I changed this
Code: [Select]
	if (horizontal)
output.tc = float2((input.tc.x + 1) / 2 , input.tc.y);
to this
Code: [Select]
	if (horizontal)
output.tc = float2((input.tc.x + cursorPos*22.5 ) / 22.5, input.tc.y);

this makes the vertical bar very wide so to compensate I changed this
Code: [Select]
	float positionWidth = 2.5 * dx;
to this
Code: [Select]
	float positionWidth = (2.5/20) * dx;
The speed of the scroll can be altered by changing the divisors in the if (horizontal) part. This doesn't affect the vertical bar width much so changing the divisor for the positionWidth too isn't always needed when fiddling with scrollspeed .

Caveat. The resolution of the bar doesn't change to match, the number of samples remains the same for the total length. But hey :) it's still fun to see.

EDIT: I also noticed that there's a difference between Default UI and Columns UI in that to get the same scroll speed in the Default UI, a much lower divisor needed to be used (I went down to about 12.5 to get the same speed as my spectrogram)

Re: foo_wave_seekbar

Reply #1959
couldn't edit anymore but found that scrollspeed with a given divisor is also related to the duration of the track. I don't know if it is possible to compensate for this as I have no idea if the track length is available as variable here

Re: foo_wave_seekbar

Reply #1960
teaser  ;)

Re: foo_wave_seekbar

Reply #1961
^Really nice teaser, Just_Addict!
Any plans of publishing the fx 'playbook'? I suppose that the grayscale bar is a JS thingy?

Re: foo_wave_seekbar

Reply #1962
There we go, beauty in the hands of the somewhat competent  :))
Stay sane, exile.

Re: foo_wave_seekbar

Reply #1963
^Really nice teaser, Just_Addict!
Any plans of publishing the fx 'playbook'? I suppose that the grayscale bar is a JS thingy?
Thank you, and yes, that is the plan. I went out with the wish to try and combine the various effects I found in this and the 'other' topic that it's gotten to the point it might need a little documentation with screenshots to show what it all can look like... as there's by now a fair number of combinations possible, even some that I didn't actually plan for but that just happened in certain combinations.

And that grayscale bar is actually just title formatting in a Columns UI "Item Details" panel. I found some CUI progress bar formatting scripts in the forum that got me going and this came out of it. It'll also be included when I have the fx file ready as I saw someone asking if it were possible to have the elapsed time showing at the vertical bar... so thought I might as well include it as alternative

There we go, beauty in the hands of the somewhat competent  :))
Wow, thanks! :) I consider that a big compliment coming from you.

Re: foo_wave_seekbar

Reply #1964
I seem to be having a problem with some components.  I'm using foo_wave_seekbar with foo_sid.  It is very cool that wave_seekbar will display an image for sid files.  My machine is quite old, I'm running a dual core AMD Opteron @2.4Ghz with PC3200 RAM.  I was getting long pauses during playback running the two together unless the playback buffer was turned all the way up.  So I figured I would take advantage of the feature that will render waves manually.  I assigned the computer to render the 67000+ sid tracks from HVSC.  This went well for almost a month until I started getting crashes.  I would change foo_wave_seekbar.dll file extension.  Load foobar then close foobar normally.  Put the dll extension back and everything chugged along fine for a week until this method stopped working.  Now whenever I load foo_wave_seekbar.dll foobar crashes within a minute of loading.  My wavecache.db file is 1,054,801,920 bytes.  Perhaps it is to large or there is a corrupt file?  Any thoughts?  Most of the wave forms for the sid collection have been rendered.  It appeared about 90% completed.  I'm quite bummed out it came so close.  I suppose I'm asking to much.

Thank you for all the hard work coding this great plugin!

Re: foo_wave_seekbar

Reply #1965
The database should not be a limiting factor, it should be paged intelligently by the sqlite3 code. I've seen multi-gigabyte databases in the wild many years ago.

foo_wave_seekbar remembers the jobs it has yet to finish in a table in the database, so it will attempt to scan them in the background as it runs.

If I had to guess, you've either got a corrupt file, or you've by means of herculean effort triggered some bug in my job scheduling. The crash dump is a bit unhelpful in that regard as there's no smoking gun remaining in the crashing thread.
Stay sane, exile.

Re: foo_wave_seekbar

Reply #1966
You could try the unreleased 0.2.45.4 version, there may be some changes (like the anti-corruption one) that may mitigate the problem.
Stay sane, exile.

Re: foo_wave_seekbar

Reply #1967
At first there were a couple crashes.  But now system is up and running!  Still scanning and most of the SID files have waveforms!  I took out the msvcp120.dll and msvcr120.dll files when I was having the crashes.  I put them back in and everything is good!  Coincidence maybe?  I'll report back if I get any other hangups or when the SID files are fully processed. Thanks You Rock!!!

Re: foo_wave_seekbar

Reply #1968
I've made a build of foo_sid myself and reproduced some crashes with tracks from the HVSC and foo_wave_seekbar.
Essentially, there seems to be a small window of time when initializing the SID decoder in multiple threads concurrently where it may stomp on itself. Small changes in timing or system load may change how/if this happens on your system.
Stay sane, exile.

Re: foo_wave_seekbar

Reply #1969
I'm going to go out on a limb and say that libsidplayfp uses too much modern C++ for MSVC 2010 to compile properly. I'm not going to bother installing newer Visual Studio just to fix this, so anyone else is welcome to take over this pile of sludge, or switch back to a more ancient SID player, perhaps one that's actually usable on old computers, because this current one probably barely achieves real time on that Opteron.

Re: foo_wave_seekbar

Reply #1970
Working great until I came home this evening.  Crashed.  But came right back after starting foobar normally.  Changed the number of concurrent scanning threads from two to one afterwards as a precaution.

Re: foo_wave_seekbar

Reply #1971
The library that foo_sid builds upon appears to be fundamentally unsafe to use in multiple threads, and there appears to be some serious effort needed to unscrew that. At best, a developer can mitigate the problem by serializing the scary parts, but it's not trivial to reliably identify them all.

Whenever there's a scan while playing a sid you run the risk of a crash if timing ends up just right/wrong.

In your scenario, you kind of would want a mode where nothing is automatically scanned and you get to scan things yourself when not playing.
Stay sane, exile.

Re: foo_wave_seekbar

Reply #1972
Ok, I think I got most kinks worked out now, there's still some areas where it could do with some major optimizing by someone more comfortable with shader code. For me this was a first time experience so no doubt I've done things in ways that could be done simpler or more elegant. Feel free to point those out if you see them.

In short, this effect file combines several of the different effects I found in this and the 'other' topic. I started out with Zao's incredible SoundCloud look and it simply grew from there. Also added some gimmicks of my own, namely a scrolling option, a grid option and colors changing over time. The file is layed out such that certain options can be combined to create various different looks.

I already had posted some teaser screenshots a page or so back, but here's some more.



The above two should animate, they didn't in the preview so if they don't when the post has entered the forum than just go to the link, image dimensions stay the same.

These are just screenshots and will lead to a larger version (1024x128)


The effect file (a measly 1400 lines of comments, defines and some crude code), a html file which describes the options, the above images, and a text file with 4 variations of the ASCII progressbar as was visible below the earlier posted teaser images can be found here.

I hope you like it, and as already mentioned, if you see ways to optimize or improve, don't hesitate and share so I can update this one.

PS. If you're a DUI user, be warned that the scrolling option is not as fluent as I hoped. With Columns UI it's prefectly smooth on my box, but YMMV.

Re: foo_wave_seekbar

Reply #1973
Woops, completely forgot to mention that in order to enjoy the beauty of the html file, it should best be copied to the wave seekbar component folder so that it can find the magical title formatting css file located in the Foobar2000 program folder. (sometimes the most obvious get overlooked, my apologies)

Re: foo_wave_seekbar

Reply #1974
Frontend Direct3D 9.0c doesn't seem to work here, any tips? Thanks