Skip to main content

Topic: foo_wave_seekbar (Read 511203 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
foo_wave_seekbar
Reply #1425
Just a quick post in case anyone is as stupid as me. I was getting the:

Failed to load DLL: foo_wave_seekbar.dll
Reason: This component is missing a required dependency, or was made for different version of foobar2000.

DirectX installed, VC++ 2012 Redist installed.

I'm running Win 7 64 bit, so installed the 64 bit version of the VC++ 2012 redist. When I installed the 32bit version of the VC++ 2012 redist, foo_wave_seekbar reappeared.

If I'd just clicked on the link in the first post, which links directly to the 32 bit version download, rather than searching out the installer myself,  (I've no idea why I did), I'd have been fine. 


  • jarko2227
  • [*]
foo_wave_seekbar
Reply #1426
I have the same error 
Quote
Failed to load DLL: foo_wave_seekbar.dll
Reason: This component is missing a required dependency, or was made for different version of foobar2000.

plis fast fix it.

  • marc2003
  • [*][*][*][*][*]
foo_wave_seekbar
Reply #1427
Let's say 2 weeks ago I altered the RG of 5 tracks, but I can't remember which tracks I altered.


sort by %last_modifed%. or have you been on a wild tagging spree changing the dates of all your other files?

  • carpman
  • [*][*][*][*][*]
  • Developer
foo_wave_seekbar
Reply #1428
Actually yes. Just added a %subcat% (been on a sub genre tagging spree). So in the process of going through music collection a whole bunch of files have been changed and will continue to be (whimsically re-tagged). But not nearly as many will be have their RG values changed. Thanks for asking. 

C.

EDIT: marc2003, I'm not suggesting that it's an absolute necessity, nor am I suggesting that there's no way around this. All I'm saying is, if the option was there, I'd have it ticked. Clearly, you wouldn't.
  • Last Edit: 20 May, 2013, 09:55:14 PM by carpman
PC = TAK + LossyWAV  ::  Portable = Lame MP3

  • marc2003
  • [*][*][*][*][*]
foo_wave_seekbar
Reply #1429
edit: junk reply removed.

i just re-read zao's original response to your post.

Quote
The analysis scans at full scale, no RG is applied during the process so traditional changes in RG values do not matter. As for people who use MP3Gain-like tools, one'd expect that they'd generate and modify tracks once, as the computed RG for something doesn't really change.


this applies to what you're doing, doesn't it?
  • Last Edit: 20 May, 2013, 10:31:30 PM by marc2003

  • carpman
  • [*][*][*][*][*]
  • Developer
foo_wave_seekbar
Reply #1430
That's really weird, I'd completely missed that reply from Zao. All I saw was:
Quote
carpman: Do you have some particular use case in mind where you'd have unpredictable and recurring modifications of the underlying audio stream data?

Thanks marc2003 (and Zao); consider my suggestion abandoned.

C.
PC = TAK + LossyWAV  ::  Portable = Lame MP3

  • Andreasvb
  • [*][*][*][*][*]
foo_wave_seekbar
Reply #1431
I'm running Win 7 64 bit, so installed the 64 bit version of the VC++ 2012 redist. When I installed the 32bit version of the VC++ 2012 redist, foo_wave_seekbar reappeared.

It's for the architecture the host program is using, in this case foobar2000, which is a 32-bit program.
You're not the first.
Windows 10 Pro x64 // foobar2000 1.3.10

  • sammael
  • [*]
foo_wave_seekbar
Reply #1432
Hi,
since I upgraded to latest version (0.2.38), when Direct3D is chosen as the output path, the waveform seekbar component hangs whole foobar window for about 5 seconds whenever it comes to view (i.e. on startup, when opening/closing visualisation (shpeck) etc)

when switched to GDI output this issue goes away, however it wasn't present in older versions as I used Direct3D without issue.

there is no console output, in fact, console claims the startup took 2 seconds, when in fact it takes over 8 seconds with 5 seconds of skipping music and frozen foobar window.

other than that no issues, thanks for great component!

edit: i reinstalled my skin from scratch to ensure it's not something else, and narrowed it down to the direct3d output path, as it happens on fresh install of foobar + tech skin as soon as i select direct3d in waveform seekbar preferences.
  • Last Edit: 21 May, 2013, 03:24:17 PM by sammael

  • Zao
  • [*][*][*][*][*]
  • Developer (Donating)
foo_wave_seekbar
Reply #1433
Does it happen in a fresh portable install without "skins", just the element/panel in Default UI and/or Columns UI?
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.

  • sammael
  • [*]
foo_wave_seekbar
Reply #1434
Does it happen in a fresh portable install without "skins", just the element/panel in Default UI and/or Columns UI?


Hello, I have just tested this and have to report it does indeed happen even on fresh portable installation with default ui, no skin and only new component (apart from default) installed being waveform seekbar. GDI mode again resolves this issue.

  • Zao
  • [*][*][*][*][*]
  • Developer (Donating)
foo_wave_seekbar
Reply #1435
What Windows version is this, what GPU and driver, and does this occur if you do a similiar install of an older version of the component into the portable environment?

Please try some of the following to narrow it down:
0.2.36
0.2.36.1
0.2.36.2
0.2.36.3
0.2.37
0.2.38
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.

  • sammael
  • [*]
foo_wave_seekbar
Reply #1436
What Windows version is this, what GPU and driver, and does this occur if you do a similiar install of an older version of the component into the portable environment?

Please try some of the following to narrow it down:
0.2.36
0.2.36.1
0.2.36.2
0.2.36.3
0.2.37
0.2.38


Windows 7 x64
primary monitor is on AMD Radeon HD7850 2GB
secondary monitor is on AMD Radeon HD5670 1GB
driver 13.5beta
8GB Ram
AMD Vishera FX-6300 Cpu
dxdiag log: http://pastebin.com/Z4abnmGC

After trying all the older versions you provided links for, I have found this behaviour on all, which leads me to believe it is indeed something within my system. I don't recall installing anything serious (like drivers etc) in last 2 weeks, and I'm positive it didn't freeze on startup before.

To better illustrate the issue I have made 2 short clips, both were made with 0.2.38 version but the links you provided exhibited same behaviour (whereas I am more than sure they didn't a week ago and as I have OCD about updating I'm pretty sure I used all versions as they came out). Frankly speaking I'm at a loss as to what's happening. I mean in the end, it's no big deal, I can live with GDI path, but it keeps bugging me.

First one is startup with Direct3D path (notice the window frozen and music skipping):
http://youtu.be/FRa73PBQOqE

This is how the startup looks/sounds with same config, just GDI output.
http://youtu.be/8wQ7VcYjt_c

(the stupid phone cut off the part where the seekbar is but its just under the song list )
the clips were made with tech skin, but the behaviour is the same in fresh portable install as i noted in previous post.

Thanks for any suggestions
  • Last Edit: 22 May, 2013, 09:13:48 AM by sammael

  • Zao
  • [*][*][*][*][*]
  • Developer (Donating)
foo_wave_seekbar
Reply #1437
Please run a test program designed to emulate the D3D9 frontend startup process and reply to me (in private if you like) with the results from the report you get after closing it. You can Ctrl-C the message box to copy them to the clipboard.
The results will be like:
Code: [Select]
(t: 0.003025, dt: 0.003025): initializing d3d
(t: 0.012729, dt: 0.009704): enumerating multisamples
(t: 0.016671, dt: 0.003942): creating device
(t: 0.089040, dt: 0.072369): testing texture formats
(t: 0.089134, dt: 0.000094): initialized d3d
(t: 0.089136, dt: 0.000002): creating resources
(t: 0.089152, dt: 0.000016): creating effect
(t: 0.129686, dt: 0.040534): creating textures
(t: 0.129773, dt: 0.000088): filling textures
(t: 0.130172, dt: 0.000398): created resources
(t: 0.130174, dt: 0.000002): startup done
(t: 0.130174, dt: 0.000000): clearing
(t: 0.130177, dt: 0.000003): drawing
(t: 0.130536, dt: 0.000359): presenting
(t: 0.139090, dt: 0.008554): done
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.

  • sammael
  • [*]
foo_wave_seekbar
Reply #1438
Please run a test program...


Hello,

Not sure if the program is supposed to end by itself, but I closed it after a bit and this is what came in the Timing report window:

Code: [Select]
---------------------------
Timing report
---------------------------
(t: 0.025619, dt: 0.025619): initializing d3d
(t: 0.038396, dt: 0.012777): enumerating multisamples
(t: 0.045829, dt: 0.007433): creating device
(t: 0.137369, dt: 0.091540): testing texture formats
(t: 0.137526, dt: 0.000157): initialized d3d
(t: 0.137529, dt: 0.000003): creating resources
(t: 0.137569, dt: 0.000040): creating effect
(t: 0.193159, dt: 0.055590): creating textures
(t: 0.193427, dt: 0.000268): filling textures
(t: 0.194212, dt: 0.000785): created resources
(t: 0.194219, dt: 0.000006): startup done
(t: 0.194219, dt: 0.000001): clearing
(t: 0.194225, dt: 0.000005): drawing
(t: 0.194997, dt: 0.000773): presenting
(t: 2.883113, dt: 2.688116): done

---------------------------
OK  
---------------------------

Hope it helps.

  • Zao
  • [*][*][*][*][*]
  • Developer (Donating)
foo_wave_seekbar
Reply #1439
That's a 2.5 second stall on presenting, compared to the 8 milliseconds I experience.
Are you running any screen capture software like fraps or dxtory, or some user interface hacks or other software that could envisionably hook the device? Also, does this persist if you disable your secondary graphics adapter?

There's not really much seekbar specific in that test code, it's just using the effect and some hardcoded waveform data. There's something fundamentally odd with your box.
  • Last Edit: 22 May, 2013, 09:50:57 PM by Zao
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.

  • sammael
  • [*]
foo_wave_seekbar
Reply #1440
That's a 2.5 second stall on presenting, compared to the 8 milliseconds I experience.
Are you running any screen capture software like fraps or dxtory, or some user interface hacks or other software that could envisionably hook the device? Also, does this persist if you disable your secondary graphics adapter?

You nailed it!

I only run 2 programs like that - MSI Afterburner and RadeonPro. Aaaand the culprit is RadeonPro, which indeed I remember upgrading to Preview version few days ago. When I close RadeonPro The issue goes away.

I fiddled around and found a way to make RadeonPro ignore foobar, by simply setting "Disable API monitoring for programs not on profile list" (not exact spelling but the setting is called along those lines. With that setting enabled I can run RadeonPro which enforces profiles for chosen apps, and the waweform seekbar works as a charm with direct3d path again.

the utility reports no stall at last step now as well.
Code: [Select]
---------------------------
Timing report
---------------------------
(t: 0.013567, dt: 0.013567): initializing d3d
(t: 0.026311, dt: 0.012744): enumerating multisamples
(t: 0.032623, dt: 0.006312): creating device
(t: 0.095033, dt: 0.062410): testing texture formats
(t: 0.095171, dt: 0.000137): initialized d3d
(t: 0.095173, dt: 0.000002): creating resources
(t: 0.095204, dt: 0.000031): creating effect
(t: 0.146723, dt: 0.051520): creating textures
(t: 0.146896, dt: 0.000173): filling textures
(t: 0.148053, dt: 0.001156): created resources
(t: 0.148057, dt: 0.000004): startup done
(t: 0.148057, dt: 0.000000): clearing
(t: 0.148060, dt: 0.000003): drawing
(t: 0.148809, dt: 0.000749): presenting
(t: 0.154400, dt: 0.005591): done

---------------------------
OK  
---------------------------

Thank you very much for taking time to help me narrow down the issue, keep up the great work!

  • fateswarm
  • [*]
foo_wave_seekbar
Reply #1441
-wrong post-
  • Last Edit: 23 May, 2013, 07:55:16 AM by fateswarm

  • Zao
  • [*][*][*][*][*]
  • Developer (Donating)
foo_wave_seekbar
Reply #1442
In any remotely standard UI configuration you have the numeric time in the status bar.
Additionally, there already is a numeric tooltip while seeking, that is, holding your mouse button and dragging around. If you don't want to seek, simply drag the cursor far enough outside the element to abort the seek.

(edit: seems like the post it replied to was edited away, it was regarding hover tooltips)
  • Last Edit: 23 May, 2013, 07:58:35 AM by Zao
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.

foo_wave_seekbar
Reply #1443
After updating, all waveforms appear blown out, filling the whole width of the window without much variation. Previously I saw a lot of white space behind the waveform - now it's just solid.

Same track then and now:



Here's the configuration I'm using - maybe something changed and it needs to be adjusted?

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);
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 ? (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;
}

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();
}
}
  • Last Edit: 27 May, 2013, 07:37:25 PM by db1989

  • Propheticus
  • [*][*][*]
foo_wave_seekbar
Reply #1444
Try this code. The problem is in the fact you are chaining replaygain calculation and normal wave hight calculation. I've changed the code so the normal wave heigth calculation only gets used when there's no rpgain info available.

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);
if (replayGain.g != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.g) / 20) * 1.8; //use track gain
} else if (replayGain.r != -1000) {
minmaxrms.rgb *= pow(10,(replayGain.r) / 20) * 1.8; //use album gain
} else {
minmaxrms.rgb *= 0.9 + 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 - 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;
}

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

foo_wave_seekbar
Reply #1445
That helps a little, but there are still many wafeforms that are overblown.
What I don't understand is why it was working before, but now it's not

foo_wave_seekbar
Reply #1446
Really nice plugin, but i have an issue to report.
In the beginning i thought that i would have to ask how it is with instalation of the libraries (but thanks to
technicaltitch
i noticed the links in first post)

...but now the seekbar doesnt load a new wave after i change a song to play. or, it loads the wave, but i have to resize the window to actually make it visible. i did copy&paste the script written by Propheticus on this forum to the frontend settings. ...aand now i see that there is the issue. Since i am not a coder, i dont know where. but i like the style of highlight he uses..

Could anyoone tell me what to rewrite, and to what?

  • Propheticus
  • [*][*][*]
foo_wave_seekbar
Reply #1447
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 *= 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 + 0.17 * 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 = 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;
}

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


this is the current code I use, now with faux-normalization/rescaling instead of replaygain. Be sure to enable front left + front right when using mix-down to stereo, and front center(mono) when using mix-down to mono.
  • Last Edit: 03 June, 2013, 09:09:52 AM by Propheticus

foo_wave_seekbar
Reply #1448
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 *= 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 + 0.17 * 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 = 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;
}

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


this is the current code I use, now with faux-normalization/rescaling instead of replaygain. Be sure to enable front left + front right when using mix-down to stereo, and front center(mono) when using mix-down to mono.



Works perfectly! thanks.

  • Zao
  • [*][*][*][*][*]
  • Developer (Donating)
foo_wave_seekbar
Reply #1449
As a side note, you can completely remove the technique10 block, that hasn't done anything since early 0.1.
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.