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 799083 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

foo_wave_seekbar

Reply #900
Are you using the latest version (0.2.14) and Direct3D?
Windows 10 Pro x64 // foobar2000 1.3.10

foo_wave_seekbar

Reply #901
Sure am. Everything works fine except bringing up the frontend settings, so I can't alter the waveform code, which makes me sad.

foo_wave_seekbar

Reply #902
Apart for multipass scanning, I have no way of knowing the true length of a track.
I trust the metadata they provide to me, and here, it seems that they blatantly lie.


Zao, I've detected the same problem as eevan & RAZOR87. When I use foo_input_sacd with an .iso file (or .dff) together with a .cue file.

When I play the first song (or any other) I only get 11 seconds of the waveform. I wouldn't say it's a reporting problem, since the properties of that song show the correct duration and number of samples:

General
-------------------------------------------------
Duration: 3:03.000 (516 499 200 samples)
Sample rate: 2822400 Hz
Channels: 2
Bits per sample: 24
Bitrate: 5645 kbps
Codec: DSD64
Encoding: lossless

Same happens with DST64 encoding (losslessly compressed DSD). Any chance you take a look into this?

BTW, I'm using foo_wave_seekbar 0.2.14, foo_input_sacd 0.4.1 and fb2k 1.1.7. Great component!

Regards

foo_wave_seekbar

Reply #903
I wouldn't say it's a reporting problem, since the properties of that song show the correct duration and number of samples:

General
-------------------------------------------------
Duration: 3:03.000 (516 499 200 samples)
Sample rate: 2822400 Hz

Yes, but it outputs 32 281 200 samples with 176400 Hz samplerate.

foo_wave_seekbar

Reply #904
There's several places to look for information about a track, including dynamic and static metadata. I've got no idea which fields are the "right" ones for your kind of input, as I do not have access to any source media for this format. Whatever free .DSD files I tested with before generated proper waveforms.
Stay sane, exile.

foo_wave_seekbar

Reply #905
The file scans properly with kode54's DSDIFF component. Consider using that, until I can bother to determine why the (apparently redundant) SACD one misbehaves.
Stay sane, exile.

foo_wave_seekbar

Reply #906
I don't mean to look like a noob, but where can I download the latest?  I have 0.2.12 atm.

foo_wave_seekbar

Reply #907
As with any component in the official repository - on its component page or through the update functionality inside of foobar2000 itself.
Stay sane, exile.

foo_wave_seekbar

Reply #908
I wouldn't say it's a reporting problem, since the properties of that song show the correct duration and number of samples:

General
-------------------------------------------------
Duration: 3:03.000 (516 499 200 samples)
Sample rate: 2822400 Hz

Yes, but it outputs 32 281 200 samples with 176400 Hz samplerate.


176400 Hz is a samplerate when DSD (or DST) is transformed into PCM for playback. In any case, 32 281 200 samples / 176 000 samples / sec = 183 s, which is equal to 3.03 min for the duration. I tend to agree with Zao in that the problem might be in which field the duration is looked for (which I don't know which they are, BTW, except what fb2k reports).

@Zao,

If you have any free DSD file that can be shared, I'd gladly give it a try and report what happens if that's helpful.

Regards,

foo_wave_seekbar

Reply #909
The files I tried with are the ones under special formats on 2L.

In any way, a solution has already been presented, which is to use the dsdiff component instead of the SACD component, as no-one has yet to enlighten me why they keep sticking with a component that doesn't work properly. If there's a concrete reason to use the SACD input component, then I'll bother investigating why it feeds me bogus values.
Stay sane, exile.

foo_wave_seekbar

Reply #910
The files I tried with are the ones under special formats on 2L.

In any way, a solution has already been presented, which is to use the dsdiff component instead of the SACD component, as no-one has yet to enlighten me why they keep sticking with a component that doesn't work properly. If there's a concrete reason to use the SACD input component, then I'll bother investigating why it feeds me bogus values.


Zao, I'll try with these files to see what happens. I don't think this is about enlightening anybody, and I use foo_input_sacd since I like it better and it has many more options for the decoding (and didn't have any issue regarding sound quality, btw). If you want to take a look at this issue, then great! If you don't have enough time or don't want to spend your time solving this issue, it's also OK. I never meant anything else than collaborate and make all components work together. I just found something that didn't work as expected and reported it.

Regards

foo_wave_seekbar

Reply #911
Try 0.2.14.1, see if it does the right thing.

foo_input_sacd gives me a quite useless raw sample rate when queried statically and a more correct sample rate while decoding. When using the correct sample rate, I get correct waveforms but with roughly half the amplitude compared to DSDIFF.
Stay sane, exile.

foo_wave_seekbar

Reply #912
Hello everyone,

First off, thank you Zao for this great seekbar.
I upgraded from XP to Win7 and decided to give my foobar a facelift while I was at it, and I love your seekbar component.

I'm using v0.2.14 with foobar 1.1.9 and CUI 0.3.8.8 and no bugs to report as of yet.

However, I spent some time browsing this thread for some way to make the waveform look a bit nicer, and came across people sharing code for what used to be the seekbar.fx file (but it seems it's not needed anymore?)
I'm using some code from many pages back that allowed multiple channels plus replaygain. However, it also changed the highlighting. While I'm not necessarily annoyed at having only a grayscale and sepia option, I do miss the "original" seekbar behavior that highlighted the entire bar as it was progressing (though seemingly somewhat transparent) while leaving the waveform colors alone. Is there any way to combine these two things?

I've tried to do it myself, but every code snippet is different, so I'm having a heck of a time figuring it out. If there's a snippet of code I can simply drop in, that would be great. I'm still trying to figure out how to modify these colors and such from the existing code. I don't know if I should post the code I'm currently using though, as it's from like 20 pages ago, so I'm not sure if there's a more updated/configurable version of it now. (Mainly because I compared with a more recent link and the replaygain handling seemed completely different.)

Thanks!


foo_wave_seekbar

Reply #914
Thanks for the quick response!

I believe your code was actually the last one I checked, and why I said it seemed the replaygain check (among other things) changed drastically. I wasn't using foosion's but rather the one someone updated a few pages later of foosion's to support multiple channels, instead of only mono.

However, your code changes the waveform itself to the highlight color which is not quite what I was looking for. (I set my highlight color to pure green, 0,255,0.) With the default behavior (if I click on load default) this green is somewhat transparent and not as neon/radioactive, covers the entire bar, and leaves the waveform color alone (though tinted slightly green.) I tried looking through the default effect code, but I couldn't find anything that called for the highlight color, so I was unable to copy it over.

foo_wave_seekbar

Reply #915
Here's the contents of the played() function in my source:
Code: [Select]
float4 played( float pos, float2 tc, float4 fg, float4 bg, float alpha)
{
    float4 c = bg;
    if (pos > tc.x)
    {
            c = lerp(c, fg, saturate(alpha));
    }
    return c;
}

{
    float4 c0 = evaluate(input.tc);
    c0 = bar(cursorPos, input.tc, selectionColor, c0, positionWidth, cursorVisible);
    c0 = bar(seekPos,   input.tc, selectionColor, c0, seekWidth,     seeking      );
    if (shade_played)
        c0 = played(cursorPos, input.tc, highlightColor, c0, 0.3);
    return c0;
}

Here, I interpolate between the highlight color passed in and the computed waveform image (including background), with the factor 'alpha'. A lerp(a, b, v) is a linear interpolation on the form (b*v + a*(1-v)), that is, when v is 0, it's all a, when v is 1 it's all b, when v is 0.3 it's 0.7*a and 0.3*b.

Compare that with the function in foosion's source:
Code: [Select]
float4 played( float pos, float2 tc, float4 bg, float factor)
{
        float4 c = bg;
        if (pos > tc.x)
        {
                if (shade_played)
                        c = evaluate(backgroundColor, highlightColor, factor);
                else
                        c = evaluate(highlightColor, textColor, factor);
        }
        return c;
}

{
        float4 c0 = evaluate(backgroundColor, textColor, factor);
        c0 = played(cursorPos, input.tc, c0, factor);

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


While I compute the waveform up-front and then tint it, foosion computes two different things based on whether we're in the shaded area or not.
Stay sane, exile.

foo_wave_seekbar

Reply #916
Try 0.2.14.1, see if it does the right thing.

foo_input_sacd gives me a quite useless raw sample rate when queried statically and a more correct sample rate while decoding. When using the correct sample rate, I get correct waveforms but with roughly half the amplitude compared to DSDIFF.


Works as a charm! It gives the complete waveform for the .dff files. I can't try the .cue/.iso files till the weekend, but it seems that the issue is nailed. I'll let you know.

Thanks for your prompt response!

Regards

foo_wave_seekbar

Reply #917
Thanks, Zao!
I didn't expect the two functions to be so completely different, so I guess that's what threw me off.

After a bit of trial and error, I've managed to get it working. I took Anomalous' latest version to use as a base.

I ended up replacing the entire played() function
Code: [Select]
float4 played( float pos, float2 tc, float4 bg, float factor)
{
        float4 c = bg;
        if (pos > tc.x)
        {
                if (shade_played)
                        c = evaluate(backgroundColor, highlightColor, factor);
                else
                        c = evaluate(highlightColor, textColor, factor);
        }
        return c;
}


With the original code.
I ran into an odd situation trying to insert the c0 thing as it complained about converting from float2 to float4, but I noticed the existing line was very similar, so I made a quick change
Code: [Select]
c0 = played(cursorPos, input.tc, c0, factor);
Became:
c0 = played(cursorPos, input.tc, highlightColor, c0, 0.3);


It started working immediately!

I made a few other changes while I was at it using tips throughout this thread; switched RG mode to album gain, changed 0.3 to 0.15 for a lighter highlight, made the vertical bar thinner, and added the faded bar as per this post.

The faded bar gave me a bit of trouble, but it seems it was due to a small typo; the function is set as fade_bar, but then it tries to call faded_bar. Removing the extra 'd' worked.

I tried to add a border around the shaded region outlined in this post, but it gave me an error saying there were too many arithmetic functions (66 out of an allowed 64 or something.) I guess it's not a big loss, but in either case, thank you both of you for the help, and keep up the great work!

At some point I may try to merge in the code from foosion's effects script just to have more options available if I change my mind.

For now though, I'm quite happy with it.

foo_wave_seekbar

Reply #918
The number of instructions available are governed by what shader model your effect is compiled as. In the technique section of your effect you can change the pixel shader model by replacing ps_2_0 with ps_2_a or ps_3_0, assuming that your graphics card supports those shader models.

They have much higher minimal limits on instruction count, the reason that the default is SM2.0 is because some of the graphics cards I target do not support anything higher, and the default effect is crafted to fit within the limits of 2.0.
Stay sane, exile.

 

foo_wave_seekbar

Reply #919
Thank you for the tip, Zao!
I have an 8800GT so it should support everything up to pixel shader 4. I'll give it a shot when I get home since I'm at work right now.

foo_wave_seekbar

Reply #920
Note that the reason I stopped at SM3.0 is because that's the highest supported in Direct3D 9. For SM4.0 you need Direct3D 10.0; SM4.1 needs Direct3D 10.1; SM5.0 needs Direct3D 11.0.
Stay sane, exile.

foo_wave_seekbar

Reply #921
Ah, that's great to know.

Changing the pixel shader version to ps_3_0 (and I thought I'd bump vs to vs_3_0 while I was at it) worked like a charm.
Replaced the played() code with the snippet to add the border and it added them without changing the highlights.
A quick experiment showed that changing the number "1" would change the thickness of the borders, so I've set it to 0 for now until I have more time to muck with it.

Only thing I can say now is Process Explorer is tracking 20% CPU utilization while the seekbar is displayed, regardless of it playing a track or not. Switching to another layout without it drops CPU back to idle, but am I safe to assume this is simply the seekbar passively scanning the other tracks in my playlist? I don't have any library set up yet since I'm still tweaking everything.

foo_wave_seekbar

Reply #922
I wanted to share my use of this component with the developer, thanks to him, my foobar look good (and is easy to use)

(I would like to go further with skinning, but that's too harsh for me, i had to stop somewhere)

foo_wave_seekbar

Reply #923
That's a rather attractive skin, colagen. Props.

foo_wave_seekbar

Reply #924
I like this component. Refreshing design. Thank You.


Code: [Select]
Texture1D tex : WAVEFORMDATA;
SamplerState sTex
{
Filter = MIN_MAG_MIP_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 shade_played   : SHADEPLAYED;
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);
output.tc = float2((input.tc.x + 1.0) / 2.0, input.tc.y);
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(float4 bg, float4 fg, float factor)
{
return saturate(lerp(bg, fg, factor));
}
float4 played( float pos, float2 tc, float4 bg, float factor)
{
float4 c = bg;
if (pos > tc.x)
{
if (shade_played)
c = evaluate(1.2*selectionColor, .5*highlightColor, factor);
else
c = evaluate(highlightColor, textColor, factor);
}
return c;
}
float RMSfactor( float2 tc, float border )
{
// alpha 1 indicates biased texture
float4 minmaxrms = tex.Sample(sTex, tc.x);
if (replayGain.g != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.g) / 20) * 2; //use track gain
} else if (replayGain.r != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.r) / 20) * 2; //use album gain
}
minmaxrms.rgb -= 0.5 * minmaxrms.a;
minmaxrms.rgb *= 1.0 + minmaxrms.a;
float belowWave = tc.y + border - minmaxrms.r;
float aboveWave = tc.y - border - minmaxrms.g;
float factorWave = min(abs(belowWave), abs(aboveWave));
bool insideWave = (belowWave > 0 && aboveWave < 0);
float diffRms = abs(tc.y) - border - minmaxrms.b;
float factorRms = abs(diffRms);
bool insideRms = diffRms < 0;
float factor = insideRms ? (- 18* saturate(factorRms / border)): 0.7;
factor = insideWave ? factor / saturate(factorWave / border /4) : 0.2;
return factor;
}
float4 PS( PS_IN input ) : SV_Target
{
float dx, dy;
dx = 1/viewportSize.x;
dy = 1/viewportSize.y;
float seekWidth = 1.5 * dx;
float positionWidth = 1.5 * dx;
float factor = RMSfactor(input.tc, 2.5 * dy);
float4 c0 = evaluate(backgroundColor+.2*selectionColor, textColor, factor);
c0 = played(cursorPos, input.tc, c0, factor);//selectionColor textColor highlightColor
c0 = bar(cursorPos, input.tc, selectionColor, c0, positionWidth, cursorVisible);
c0 = bar(seekPos,  input.tc, highlightColor, c0, seekWidth, seeking   );
return c0;
}
technique10 Render10
{
pass P0
{
SetGeometryShader( 0 );
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}
technique Render9
{
pass
{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_2_0 PS();
}
}