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

foo_wave_seekbar

Reply #1500
Is it somehow possible to get Direct2D or Direct3D rendering to work under Wine? I'm using version 0.2.34 and it falls always back to GDI rendering, which is way too blurry.

winecfg lists every d3d9 version from 24 to 43.

And btw: Thanks for this great component!

@Axon: Did Direct2D or 3D work for you any time in the past? Because I never got it to work.

foo_wave_seekbar

Reply #1501
[!--sizeo:2--][span style=\"font-size:10pt;line-height:100%\"][!--/sizeo--]
Code: [Select]
libGL error: open uki failed (Operation not permitted)
libGL error: reverting to (slow) indirect rendering
err:winediag:X11DRV_WineGL_InitOpenglInfo Direct rendering is disabled, most likely your OpenGL drivers haven't been installed correctly (using GL renderer "AMD Radeon HD 7800 Series", version "2.1 (4.2.12337 Compatibility Profile Context 13.101)").
fixme:win:EnumDisplayDevicesW ((null),0,0x33f058,0x00000000), stub!
fixme:d3dx:D3DXCreateEffectEx (0x190cb0, 0x1ff920, 3852, (nil), (nil), (nil), 0, (nil), 0x33f394, 0x33f390): semi-stub
fixme:d3dx:d3dx9_base_effect_init HLSL ascii effects not supported, yet
fixme:d3dx:D3DXCreateEffectEx (0x190cb0, 0x2009a0, 3852, (nil), (nil), (nil), 0, (nil), 0x33f494, 0x33f490): semi-stub
fixme:d3dx:d3dx9_base_effect_init HLSL ascii effects not supported, yet
fixme:d3dx:D3DXCreateEffectEx (0x190cb0, 0x1fba70, 3852, (nil), (nil), (nil), 0, (nil), 0x33f46c, 0x33f468): semi-stub
fixme:d3dx:d3dx9_base_effect_init HLSL ascii effects not supported, yet
fixme:d3dx:D3DXCreateEffectEx (0x190cb0, 0x30e8a68, 3852, (nil), (nil), (nil), 0, (nil), 0x33f498, 0x33f494): semi-stub
fixme:d3dx:d3dx9_base_effect_init HLSL ascii effects not supported, yet
fixme:d3dx:ID3DXEffectImpl_Begin iface 0x1fc988, passes 0x33f690, flags 0 partial stub
fixme:d3dx:ID3DXEffectImpl_End (0x1fc988)->(): stub
fixme:d3dx:ID3DXEffectImpl_Begin iface 0x1fc988, passes 0x33f690, flags 0 partial stub
fixme:d3dx:ID3DXEffectImpl_End (0x1fc988)->(): stub
[/size]
As expected, the D3DX9 implementation in an out-of-box Wine is quite a few bottles short of a rack.
If one works around their completely botched synchronization primitives, you have no chance in hell of properly compiling the effect source. You guys owe me a new X session, Wine violently crashed my open-source X driver.

At best, you'll get an empty seekbar window responsive enough to let you change to the GDI frontend. As for Direct2D, I quite doubt that there's any trace of that at all in Wine.
Stay sane, exile.

foo_wave_seekbar

Reply #1502
Found out about this component too late... Thank you so much! Works fine for me

 

foo_wave_seekbar

Reply #1504
Manchesterer: Yup, there's a known bug where it always displays the seek location indicator in the GDI frontend.
Stay sane, exile.

foo_wave_seekbar

Reply #1505
I'm getting Direct 3D to work, but the "Frontend Settings..." button is unresponsive, where as all else are. Minor issue, should require minor fix.

foo_wave_seekbar

Reply #1506
Take a look at the console output, it's probably falling back to GDI. Therefore the "Frontend Settings..." doesn't work.

foo_wave_seekbar

Reply #1507
« Minor issue, should require minor fix. » -- Famous last words.

As Wander alluded to, the configuration dialog isn't that well wired up with the actual element state, so some things like the frontend settings button will remain enabled and do-nothing.
Stay sane, exile.

foo_wave_seekbar

Reply #1508
« Minor issue, should require minor fix. » -- Famous last words.

As Wander alluded to, the configuration dialog isn't that well wired up with the actual element state, so some things like the frontend settings button will remain enabled and do-nothing.

So, you tricked me? :C

foo_wave_seekbar

Reply #1509
I found the error. Turns out I had a WIP component loaded and it was conflicting with your component's D3D

foo_wave_seekbar

Reply #1510
What on earth could such a component be doing? I'm now genuinely curious.
By the way, if you're using D3D9, don't forget to D3DCREATE_FPU_PRESERVE.
Stay sane, exile.

foo_wave_seekbar

Reply #1511
Older versions are available for testing purposes, so if you can find the version change where it stops working it would help me find out if it's something I did and what the reason might be. Make sure you look at the console and see if it succeeds at loading the Direct3D9 frontend or if it's falling back to GDI mode.

Regarding the problem i mentioned using the waveform-seekbar with wine, I just tested the different plugin versions and found out that it stopped working for me with v0.2.36.2. Version 0.2.36.1 was still working, though.
The only output that is printed to the console is this:

RegisterShellHookWindow failure
Watching: Z:\mnt\nas-multimedia\mp3
Album List refreshed in: 0:04.545933
UI Element instantiation failure: Unknown exception

Later versions won't even allow foobar2k to start - it immediately crashes with a runtime error caused by the visual c++ runtime library. If i can contribute anything else to fix the issue, i would be more than willing to help!!

foo_wave_seekbar

Reply #1512
The only way to get versions past that to work is completely rewrite all the threading and concurrency code to not use the C++ standard library from Visual C++ 2012 or 2013.

Those runtimes rely on functions (NUMA hardware information) that Wine has stubbed out and which the runtime doesn't expect failure from, as they should never be able to fail on a real Windows implementation.

Until some brave and bored soul makes the effort to implement all the minefield functionality that the runtime needs, the component will continue to not load.

It's reasonably trivial to hack around on a private Wine, but way more annoying to get it into upstream.

Of course, I could painstakingly roll my own threading bits and bobs, but that's nothing I dare release into the public, as there's a lot of tricky parts in my use of the existing primitives. The seekbar code relies on a lot of recursive mutexes thanks to sloppy design, and trying to unravel it has had some interesting results.

And of course, all this work doesn't help the fact that Wine's "support" for D3DX9 effects is very incomplete and unfortunately partially stubbed, so I can't detect it until far into the frontend instantiation process.

I'm quite tempted to kill off the whole frontend business and have one single slightly configurable checkbox clusterhug of a frontend, dropping the whole effect concept. At least then it would have a chance of working on such spotty platforms.
Stay sane, exile.

foo_wave_seekbar

Reply #1513
Thanks I love this plugin.
It really makes Foobar for me.

It would be great to have the position line glide more and not seemingly stagger to each refresh.
No biggy just be better.

Umm I'm using the most up-to-date version and Direct 3d setting with a config file from this tread.

Thanks for all the great work. 

foo_wave_seekbar

Reply #1514
There is an advanced preferences setting to adjust the repaint rate.
You may need to bump it up a bit if you are using an effect with a narrow bar, as those tend to be a bit less subtle when they move around. If the problem you see is a shimmer, you may have to lower the contrast of your colours or make the bar wider.

Preferences -> Advanced -> Tools -> Waveform Seekbar -> Percentage of base display rate to display at (1-400%).
Stay sane, exile.

foo_wave_seekbar

Reply #1515
There is an advanced preferences setting to adjust the repaint rate.
You may need to bump it up a bit if you are using an effect with a narrow bar, as those tend to be a bit less subtle when they move around. If the problem you see is a shimmer, you may have to lower the contrast of your colours or make the bar wider.

Preferences -> Advanced -> Tools -> Waveform Seekbar -> Percentage of base display rate to display at (1-400%).


Thanks. 
I've moved it from 100 to 400 and its a bit better.
Your right I have a narrow bar and high contrast.
Thanks again.

foo_wave_seekbar

Reply #1516
would it be possible to make the "highlight" or part that's already played, invert the color of the waveform and bg? so like if the waveform was white on a black background, the waveform would become black on a white bg.

also, i noticed that this lacks the ability to scroll through the song with the scroll wheel while the mouse pointer is over the seekbar. this is possible with the default seekbar.

foo_wave_seekbar

Reply #1517
The look you desire can be achieved by writing a suitable effect for the Direct3D9 frontend. For the other frontends you're currently out of luck.
The mouse wheel seek has been requested before and hasn't been implemented because of me never remembering to do it, and not wanting to figure out in what steps the default seekbar jumps.
Stay sane, exile.

foo_wave_seekbar

Reply #1518
The look you desire can be achieved by writing a suitable effect for the Direct3D9 frontend. For the other frontends you're currently out of luck.
The mouse wheel seek has been requested before and hasn't been implemented because of me never remembering to do it, and not wanting to figure out in what steps the default seekbar jumps.
thanks 

just did it and it's kind of funny since i didn't even really know what i was doing.

first took the code that skullinsky posted on the last page and then propheticus' and wasted a bunch of time trying to figure out the differences only to realize they were pretty much the same besides propheticus' normalization (which i used). i guess it wasn't that much of a waste since i was able to figure out some things and tweak them to how i wanted.

anyway, ended up just adding this line to the identifiers

float4 foregroundColor : FOREGROUNDCOLOR;

then found the line that said backgroundColor and changed it to foregroundColor just to see what it would do and it did what i wanted haha.



here's the whole code, i'm using propheticus' normalization, a solid wave and a seekbar with a thickness of 2

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 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 foregroundColor : FOREGROUNDCOLOR;
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 shade_played : SHADEPLAYED;
bool flipped : FLIPPED;

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 *= 0.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 + .5 * saturate(factorRms / border / 100)): 1.0;
factor = insideWave ? (factor * saturate(factorWave / border / .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(foregroundColor, 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( 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();
}
}

i was just messing with the colors and realized that this actually only makes the unshaded background black. so it's only a partial solution but it will work since that's kind of what i wanted to do anyway..

anyone know how to do it? i tried something like backgroundColor = foregroundColor under if (shade_played) but that doesn't work haha

foo_wave_seekbar

Reply #1519
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();
    }
}
Stay sane, exile.

foo_wave_seekbar

Reply #1520
ah awesome thank you, i appreciate the help

foo_wave_seekbar

Reply #1521
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();
    }
}

Thanks a lot it also works with other foreground colors

foo_wave_seekbar

Reply #1522
Zao, thank you very much for this plugin! I always had this feeling that a simple seek-bar wasn't good enough to navigate through a song.

foo_wave_seekbar

Reply #1523
since today i get instant crash on foobar
i reinstalled all and copy paste my configuration folder = instant crash
removed components one by one and seekbar is the problem

downloaded last version of seekbar = instant crash
what the ..

foo_wave_seekbar

Reply #1524
hgodzillay: Try moving away the wavecache.db, it may have been corrupted and cause integrity failure.
What OS, UI component, foobar2000 version, etc. is this?
Stay sane, exile.