Introverterz: If you want a background change, you can modify evaluate to:
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;
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 outside_color = lerp((played ? 0.3 : 0.0), backgroundColor, highlightColor);
float4 wave = outside
? outside_color
: inside_color
;
return saturate(wave);
}
The area outside of the waveform will in the case of a played section be (30% highlight + 70% background), and for unplayed (100% background).
You can do a similar change for inside_color if you want to interpolate instead of select text vs. highlight.
Shader code is simpler than it seems, if you just squint at it right.