Old 1st October 2006, 22:59   #1
Plague
f(caffeine){
return wasabi;
}
(Forum King)
 
Plague's Avatar
 
Join Date: Jul 2001
Location: Sweden
Posts: 3,984
determining cbr vbr

Hi..

Is there a way to determine if a file is VBR or CBR in maki?
Like, rip that info from the ID3 editor's MPEG info section or something...?
Plague is offline   Reply With Quote
Old 2nd October 2006, 08:40   #2
martin.deimos
Android/UI Development
 
martin.deimos's Avatar
 
Join Date: Sep 2004
Location: Bavaria
Posts: 1,242
Send a message via ICQ to martin.deimos Send a message via AIM to martin.deimos Send a message via Yahoo to martin.deimos
hm, let's try this:
(untested scrap)


Define in your xmlfile:
<text id="br.dummy" display="SONGBITRATE" />

then load the script
PHP Code:

include <lib/std.mi>

#define MAX_LOOPS 100;

Global timer check;
Global 
Boolean isVBR;
Global 
int lastBitrate;
Global 
Text br_dummy;
Global 
int loops 0;

System.onScriptLoaded ()
{
   
check = new Timer;
   
check.setDelay(10);

   
br_dummy getScriptGroup().findObject("br.dummy");

   if (
getStatus() == 1check.start();
}

System.onTitleChange (string newtitle)
{
   
isVBR 0;
   
lastBitrate 0;
   
check.start();
}

System.onPlay ()
{
   
isVBR 0;
   
lastBitrate 0;
   
check.start();
}

//add functions onPause () etc.

check.onTimer ()
{
   
int newBitrate br_dummy.getText();
   
//getPlayItemMetaDataString("Bitrate") won't work cause it's static!
   
if (newBitrate != lastBitrate && lastBitrate != 0)
   {
      
check.stop();
      
isVBR 1//instead of this call a function or set Text to vbr
   
}

   
// perhaps add this if you don't wanna check it all the time the song plays
   
loops++;
   if (
loops MAX_LOOPSstop();


WebSite: www.skinconsortium.com - Community for Userinterface Design & Coding
Skins: Click Here

Last edited by martin.deimos; 2nd October 2006 at 09:06.
martin.deimos is offline   Reply With Quote
Old 2nd October 2006, 15:16   #3
Plague
f(caffeine){
return wasabi;
}
(Forum King)
 
Plague's Avatar
 
Join Date: Jul 2001
Location: Sweden
Posts: 3,984
two things:

1. you forgot to add lastBitrate = newBitrate after the if in the timer..

2. this method will first show CBR when a song starts, and then _if_ the song is really VBR, it will switch to showing VBR once the bitrate has actually changed from it's starting value..
That's not good enough.

Let's say the song has really small bitrate changes that are few and far apart, then it may go as far as maybe a minute or so before the bitrate changes and the script switches from CBR to VBR.

Which in turn pretty much makes this script useless, as the user will see on the bitrate itself that it's VBR.

The whole point was to show VBR on VBR files even though it may not be noticable in the bitrate a while..

so, this won't work I'm afraid..
Plague is offline   Reply With Quote
Old 2nd October 2006, 18:09   #4
martin.deimos
Android/UI Development
 
martin.deimos's Avatar
 
Join Date: Sep 2004
Location: Bavaria
Posts: 1,242
Send a message via ICQ to martin.deimos Send a message via AIM to martin.deimos Send a message via Yahoo to martin.deimos
yeah, but it was an attempt...

to 1) i havn't forgott it! (lastBitrate = newBitrate) you needn't to load this cause the timer will stop when lastBitrate != newBitrate.
but you need to set lastBitrate = 0; after each playitem change

WebSite: www.skinconsortium.com - Community for Userinterface Design & Coding
Skins: Click Here
martin.deimos is offline   Reply With Quote
Old 2nd October 2006, 18:31   #5
Plague
f(caffeine){
return wasabi;
}
(Forum King)
 
Plague's Avatar
 
Join Date: Jul 2001
Location: Sweden
Posts: 3,984
yeah, but you still need to do something with lastBitrate, because in your script, lastBitrate will ALWAYS be 0.
it's only newBitrate that changes in that script..
Read through it, in no place is lastBitrate said to be anything other than 0. Like I said, you forgot to put lastBitrate = newBitrate after the if.

not that it matters anyways, cos the script won't do what I want, but still.
Plague is offline   Reply With Quote
Old 2nd October 2006, 23:39   #6
Benski
Ben Allison
Former Winamp Developer
 
Benski's Avatar
 
Join Date: Jan 2005
Location: Brooklyn, NY
Posts: 1,057
for MP3, getPlayitemMetaDataString("vbr") should work just fine It will return "1" for VBR files and "0" for CBR files.
Benski is offline   Reply With Quote
Old 3rd October 2006, 12:49   #7
SLoB
Major Dude
 
SLoB's Avatar
 
Join Date: Jul 2003
Location: UK
Posts: 1,316
any chance of posting the link to or full list and perhaps adding it to the stickies in the tips&tricks forum please Benski/anyone?

altho for VBR/CBR most peeps arent gonna be too bothered unless theyr freaky heheh
SLoB is offline   Reply With Quote
Old 3rd October 2006, 13:38   #8
Mr Jones
Nothing to say...
 
Mr Jones's Avatar
 
Join Date: Sep 2000
Location: UK
Posts: 23,063
If someone wants to make a nice list of them all I'll create a spanky thread with them all in.
Mr Jones is offline   Reply With Quote
Old 3rd October 2006, 14:32   #9
Plague
f(caffeine){
return wasabi;
}
(Forum King)
 
Plague's Avatar
 
Join Date: Jul 2001
Location: Sweden
Posts: 3,984
thanks Benski.. will this work on only MP3, or will it work on some other Audio formats aswell?
If not, will it in the future?

Also, have you looked more into the whole classic="1" mode for the modern vis?
Plague is offline   Reply With Quote
Old 3rd October 2006, 15:38   #10
Benski
Ben Allison
Former Winamp Developer
 
Benski's Avatar
 
Join Date: Jan 2005
Location: Brooklyn, NY
Posts: 1,057
getPlayitemMetaDataString uses the same names as the %tags% in ATF.
Benski is offline   Reply With Quote
Old 3rd October 2006, 18:05   #11
martin.deimos
Android/UI Development
 
martin.deimos's Avatar
 
Join Date: Sep 2004
Location: Bavaria
Posts: 1,242
Send a message via ICQ to martin.deimos Send a message via AIM to martin.deimos Send a message via Yahoo to martin.deimos
good to know! thanks

WebSite: www.skinconsortium.com - Community for Userinterface Design & Coding
Skins: Click Here
martin.deimos is offline   Reply With Quote
Old 4th October 2006, 10:24   #12
martin.deimos
Android/UI Development
 
martin.deimos's Avatar
 
Join Date: Sep 2004
Location: Bavaria
Posts: 1,242
Send a message via ICQ to martin.deimos Send a message via AIM to martin.deimos Send a message via Yahoo to martin.deimos
is there a list with all atf %tags%?

WebSite: www.skinconsortium.com - Community for Userinterface Design & Coding
Skins: Click Here
martin.deimos is offline   Reply With Quote
Old 4th October 2006, 13:34   #13
Benski
Ben Allison
Former Winamp Developer
 
Benski's Avatar
 
Join Date: Jan 2005
Location: Brooklyn, NY
Posts: 1,057
Here's the list of tags that in_mp3 supports. Support with other file formats varies, but should be a subset of this list.

title
album
artist
albumartist
comment
year
composer
bitrate
srate
stereo
vbr
replaygain_track_gain
replaygain_album_gain
replaygain_track_peak
replaygain_album_peak
gain
genre
track
length
disc
bpm
conductor
key
mood
subtitle
lyricist
ISRC
media
remixer
encoder
publisher
tool
pregap
postgap
numsamples
Benski is offline   Reply With Quote
Old 4th October 2006, 15:31   #14
martin.deimos
Android/UI Development
 
martin.deimos's Avatar
 
Join Date: Sep 2004
Location: Bavaria
Posts: 1,242
Send a message via ICQ to martin.deimos Send a message via AIM to martin.deimos Send a message via Yahoo to martin.deimos
thanks!

WebSite: www.skinconsortium.com - Community for Userinterface Design & Coding
Skins: Click Here
martin.deimos is offline   Reply With Quote
Old 4th October 2006, 17:49   #15
SLoB
Major Dude
 
SLoB's Avatar
 
Join Date: Jul 2003
Location: UK
Posts: 1,316
cool, thanks Benski
SLoB is offline   Reply With Quote
Old 4th October 2006, 22:57   #16
leechbite
Major Dude
 
leechbite's Avatar
 
Join Date: Sep 2003
Location: Canada
Posts: 635
Send a message via Yahoo to leechbite
good to know.
leechbite is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump