Hi again,
I'm trying to display the bitrate for the now playing track and would like it to change dynamically for VBR tracks. I'm trying to use the following code, but for some reason it doesn't update as the track plays. I'm not sure why it's not working - I thought that on_playback_dynamic_info() should cover the updating of the display when the bitrate changes. Anyone got any pointers?
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
var bitrateTF = fb.TitleFormat("%bitrate%' kbit/s'");
var textFont = gdi.Font("Tahoma", 10, 1);
var textColour = RGB(255, 255, 255);
if (fb.IsPlaying){
update();
}
function on_size() {
ww = window.Width;
wh = window.Height;
}
function update() {
g_metadb = fb.GetNowPlaying();
if (!g_metadb) return;
bitrate = bitrateTF.EvalWithMetadb(g_metadb);
window.Repaint();
}
function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
gr.GdiDrawText(bitrate, textFont, textColour, 0, 0, ww, wh);
}
function on_playback_dynamic_info() {
update();
}
function on_playback_dynamic_info_track() {
update();
}