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 799351 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foo_wave_seekbar

Reply #1700
Made an account to say thank you. <3

foo_wave_seekbar

Reply #1701
thanks for this beautiful plugin!
I'd like to add a constant gain to replaygain tracks' waveforms? (like +7db, as in my replaygain pre-amp setting)
is there a way to do it?
I've tried
minmaxrms.rgb *= pow(10,(replayGain.g) / 20)+0.7; //use track gain
but it seems it's not exactly what I want.
thnx!

foo_wave_seekbar

Reply #1702
The scale of the signal after decoding and RG is linear full scale from -1.0 (negative full scale) through DC=0 up to +1.0 (positive full scale).
If you want to attenuate or amplify by decibels, you should probably use whatever fancypants math one uses to attenuate a linear signal.
Also note that the 'r' channel is the minimum sample value (closest to negative infinity) in the range, 'g' is the maximum sample value (closest to positive infinity), and 'b' is the Root-Mean-Square measurement of that slice, which is in whatever range that measurement is.
Stay sane, exile.

foo_wave_seekbar

Reply #1703
While spelunking in the codebase I discovered a size bug in the writing of RIFF chunks for the Render To Clipboard functionality.
This may be related to the clipboard content not being recognized by some DAWs, or might just be cosmetic. A fix will probably appear in a future version.
Stay sane, exile.

foo_wave_seekbar

Reply #1704
I hope customization for soundcloud-ish style, please hint?

foo_wave_seekbar

Reply #1705
narucy: I've got an effect, seekbar-soundcloud.fx which does a decent job of looking like the Real Deal.

Is that what you are asking about, or are you looking for ways to change this effect?
Stay sane, exile.


foo_wave_seekbar

Reply #1707
I've got an effect, seekbar-soundcloud.fx which does a decent job of looking like the Real Deal.


Thanks for that effect, Zao, it looks amazing.  Since I can't help myself from customizing things, I've made my own modification which makes multiple passes for more complex effect combinations.

If you don't like an effect, just comment or delete the line with the appropriate #define and it'll turn off.

Everyone is also welcome to use that as a reference if they want to experiment with multiple-pass effects, it's not like I hold a copyright on it

foo_wave_seekbar

Reply #1708
Heh. Turns out that I've got multi-pass effects in my D3D9 code. I don't remember ever writing it...

Note that D3D10 bits of the effects is entirely non-functional, as there never was a released D3D10 frontend.
Stay sane, exile.

foo_wave_seekbar

Reply #1709
Heh. Turns out that I've got multi-pass effects in my D3D9 code. I don't remember ever writing it...

Note that D3D10 bits of the effects is entirely non-functional, as there never was a released D3D10 frontend.


Yeah, I noticed that. You were probably thinking of adding D3D10 at some point when you wrote your shaders originally.

foo_wave_seekbar

Reply #1710
I had an D3D10 implementation in the early days but it didn't gain me anything above what D3D9 could provide, so I scrapped it.
If I make any other implementations, it'll probably be a decent software renderer or possibly OpenGL to avoid having to rely on the DXSDK forever.
Stay sane, exile.

foo_wave_seekbar

Reply #1711
I installed this and I copied the settings (exactly) in Right Click -> Configuration from another theme and my seekbar did not turn out like it should, any idea what i'm doing wrong?

Mine is the top one, the way I wan't it to look is the bottom one.

foo_wave_seekbar

Reply #1712
Some effects are lacking the unbias operation needed for 8-bit textures I standardized on a few versions ago. The theme you used probably relied on the historical formats that didn't need unbiasing. You want code similiar to the following, where the important part is the subtraction and scale on lines 2-3.

Code: [Select]
 // alpha 1 indicates biased texture
float4 minmaxrms = tex.Sample(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) / 20); //use track gain
} else if (replayGain.r != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.r) / 20); //use album gain
}
Stay sane, exile.

foo_wave_seekbar

Reply #1713
Some effects are lacking the unbias operation needed for 8-bit textures I standardized on a few versions ago. The theme you used probably relied on the historical formats that didn't need unbiasing. You want code similiar to the following, where the important part is the subtraction and scale on lines 2-3.

Code: [Select]
 // alpha 1 indicates biased texture
float4 minmaxrms = tex.Sample(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) / 20); //use track gain
} else if (replayGain.r != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.r) / 20); //use album gain
}

This is the code in the 'Frontend Settings', if that helps:

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 chan_mag : CHANNELMAGNITUDE; // Requires "foo_wave_seekbar" version 0.2.34 or better
float4 track_mag : TRACKMAGNITUDE; // Requires "foo_wave_seekbar" version 0.2.34 or better
float4 backgroundColor : BACKGROUNDCOLOR;
float4 highlightColor : HIGHLIGHTCOLOR;
float4 selectionColor : SELECTIONCOLOR;
float4 textColor : TEXTCOLOR;
float cursorPos : CURSORPOSITION;
bool cursorVisible : CURSORVISIBLE;
float seekPos : SEEKPOSITION;
bool seeking : SEEKING;
float2 viewportSize : VIEWPORTSIZE;
bool horizontal : ORIENTATION;
bool flipped : FLIPPED;
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);

//- NORMALIZE/RESCALE ALL WAVEFORMS TO FILL PANEL EDGE-TO-EDGE -
//Requires "foo_wave_seekbar" version 0.2.34 or better - see changelog
//This variation will map the range [-1,1] to [min_peak,max_peak].
input.tc.y = (input.tc.y + 1)/2 * (chan_mag.g - chan_mag.r) + chan_mag.r;
//This variation will map the range [-1,1] to [-largest_peak,largest_peak]
//input.tc.y = input.tc.y * max(abs(chan_mag.r), abs(chan_mag.g));

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(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)
{
c = evaluate(backgroundColor, highlightColor, factor);
}
return c;
}

float RMSfactor( float2 tc, float border )
{
float4 minmaxrms = tex1D(sTex, tc.x);

minmaxrms.rgb *= .95 + 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 ? ( 1 - 0.5 * saturate(factorRms / border / 2)): 1;
factor = insideWave ? (factor * saturate(factorWave / border / 0.5)) : 0; //1 = max sharp

return factor;
}

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 = 1 * dx;
float positionWidth = 2 * dx;

float factor = RMSfactor(input.tc, 2.5 * dy);

float4 c0 = evaluate(backgroundColor, textColor, factor);
if (shade_played)
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;
}

technique10 Render10
{
pass P0
{
SetGeometryShader( 1 );
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();
}
}

It is an older version of your component, is there any harm in using it? I know nothing about making themes really I was just copy and pasting that code. What should I change?

foo_wave_seekbar

Reply #1714
Turn
Code: [Select]
minmaxrms.rgb *= .95 + minmaxrms.a;
into
Code: [Select]
minmaxrms.rgb -= 0.5 * minmaxrms.a;
minmaxrms.rgb *= 1.0 + minmaxrms.a;
minmaxrms.rgb *= .95;
Stay sane, exile.

foo_wave_seekbar

Reply #1715
Turn
Code: [Select]
minmaxrms.rgb *= .95 + minmaxrms.a;
into
Code: [Select]
minmaxrms.rgb -= 0.5 * minmaxrms.a;
minmaxrms.rgb *= 1.0 + minmaxrms.a;
minmaxrms.rgb *= .95;

Thanks, that works on the portable mode, but apparently I don't know anything about Foobar because when I do the exact same thing on a standard install nothing shows up, no matter what I do on a regular install nothing shows up in the wave seekbar its just whatever color I make the background!

foo_wave_seekbar

Reply #1716
Turn
Code: [Select]
minmaxrms.rgb *= .95 + minmaxrms.a;
into
Code: [Select]
minmaxrms.rgb -= 0.5 * minmaxrms.a;
minmaxrms.rgb *= 1.0 + minmaxrms.a;
minmaxrms.rgb *= .95;

Thanks, that works on the portable mode, but apparently I don't know anything about Foobar because when I do the exact same thing on a standard install nothing shows up, no matter what I do on a regular install nothing shows up in the wave seekbar its just whatever color I make the background!

Found the problem? On the portable version I have  'Front Center (mono)' checked and on the standard install to display the same thing I have to have 'Front Left' checked, odd? Front Center (mono) doesn't show anything on standard install.

foo_wave_seekbar

Reply #1717
"Front left" displays the left stereo channel in all playback that has a left channel.
"Front center (mono)" displays the center channel for playback that has one (5.1/7.1 etc.) or the mono channel in mono playback.

If you want to display a mix of left/right, use the "downmix to mono" option and use the "Front center (mono)" checkbox.
Stay sane, exile.

foo_wave_seekbar

Reply #1718
"Front left" displays the left stereo channel in all playback that has a left channel.
"Front center (mono)" displays the center channel for playback that has one (5.1/7.1 etc.) or the mono channel in mono playback.

If you want to display a mix of left/right, use the "downmix to mono" option and use the "Front center (mono)" checkbox.

Thank you, that did the trick I forgot I had it on 'Keep as is' because I didn't know what the option did.

foo_wave_seekbar

Reply #1719
Hi Zao, I love your plugin but I'm not satisfied with the standard effect. I was looking for something similar to what a zippyshare player is using and I found it. It's written by 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 horizontal : ORIENTATION;
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);
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);

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)
{
c = evaluate(backgroundColor, highlightColor, factor);
}
return c;
}

float RMSfactor( float2 tc, float border )
{
// alpha 1 indicates biased texture
float4 minmaxrms = tex.Sample(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) / 20); //use track gain
} else if (replayGain.r != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.r) / 20); //use album gain
}

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 ? (1.0 - 0.5 * saturate(factorRms / border / 2)): 1.0;
factor = insideWave ? (factor * saturate(factorWave / border / 2)) : 0.0;

return factor;
}

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 = 2.5 * dx;

float factor = RMSfactor(input.tc, 2.5 * dy);

float4 c0 = evaluate(backgroundColor, textColor, factor);
if (shade_played)
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;
}

technique Render9
{
pass
{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_2_0 PS();
}
}
Pic:
The gray waveform inside that black one is the one I'm looking for. Can you please get rid of the black one and make the gray use all the space, so it looks like here:

foo_wave_seekbar

Reply #1720
I could, if I could recall the name of the 'extent' semantics.
In any way, change the RMSfactor function to only consider insideRms, and then scaling the result by 1 over the RMS extent semantic, if I even bothered to provide that parameter.

Might conjure up a fixed effect once I've slept properly.
Stay sane, exile.

foo_wave_seekbar

Reply #1721
I took the original effect by Propheticus and stripped out all the stuff that you didn't want.
The names of functions and values remain whatever they were.
The place to do the reversal is in played, swapping textColor (which is what you think of as foreground) and backgroundColor.
What your :FOREGROUNDCOLOR semantic did was just read from an unbound parameter, probably blackness.
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;

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(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)
        {
                c = evaluate(textColor, backgroundColor, factor);
        }
        return c;
}

float RMSfactor( float2 tc, float border )
{
        float4 minmaxrms = tex1D(sTex, tc.x);

// uncomment code below to use replaygain
if(replayGain.r != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.r) / 20) * 1.2; //use album gain
}
else if(replayGain.g != -1000){
minmaxrms.rgb *= pow(10,(replayGain.g) / 20) * 1.2; //use track gain
}
else {
minmaxrms.rgb *= 0.8 + minmaxrms.a;
}

//without replaygain (comment out when using the code above)
        minmaxrms.rgb *= 0.8 + 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 factor = insideWave ? (saturate(factorWave / border / 1)) : 0.0; //1 = max sharp
        return factor;
}

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 = 1 * dx;
        float positionWidth = 1 * dx;

        float factor = RMSfactor(input.tc, 2.5 * dy);

        float4 c0 = evaluate(backgroundColor, textColor, factor);
        if (shade_played)
                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;
}

technique Render9
{
    pass
    {
        VertexShader = compile vs_2_0 VS();
        PixelShader = compile ps_2_0 PS();
    }
}
switched from 32bit windows to 64bit and i'm using this code (actually a slightly altered one but i figure if you know what's wrong i can apply it to mine) you made for me a while back and it looks like this now



i messed the numbers in this line and it seemed to sort of work but there was a shadow in the middle of it and i couldn't get it right

bool insideWave = (belowWave > 0 && aboveWave < 0);

foo_wave_seekbar

Reply #1722
slyman: You've got the same problem as everyone else with the lack of unbias.
After
float4 minmaxrms = tex1D(sTex, tc.x);
add
minmaxrms.rgb -= 0.5 * minmaxrms.a;
minmaxrms.rgb *= 1.0 + minmaxrms.a;


Your problem isn't really about OS bitness, but installing a slightly newer seekbar after I removed special-case code that your effect relied on.
Stay sane, exile.

foo_wave_seekbar

Reply #1723
ah so i could've figured that out by looking through the thread haha, my bad. thanks though, especially for the fast reply. you're awesome!

it's funny, it wasn't working at first because i didn't have dx installed and before i remembered i had to install it i updated to the new version to see if that would work. would've been fine if i never updated or at least would've realized it was the update rather than the os change. although, i did look through the thread for 64bit stuff because i thought it was that.

foo_wave_seekbar

Reply #1724
When I load a .mid file, foobar2000 crashes and the report says that it's the Waveform Seekbar's fault.