[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeextragear-1/amarok/src/analyzers
From: Adam Pigg <adam () piggz ! fsnet ! co ! uk>
Date: 2004-08-29 19:38:30
Message-ID: 20040829193830.D6863900E () office ! kde ! org
[Download RAW message or body]
CVS commit by piggz:
Implemented (kinda) dynamic scaling. It scans the data for the peak and scales \
depending on that value. It also resets the peak every 25 updates. to ensure it \
stays up-to-date with the current 'feel' of the music. I think it looks ok but feel \
free to comment.
M +22 -2 glanalyzer.cpp 1.22
--- kdeextragear-1/amarok/src/analyzers/glanalyzer.cpp #1.21:1.22
@@ -50,4 +50,8 @@ void GLAnalyzer::analyze( const Scope &s
}*/
uint offset = 0;
+ static float peak;
+ float mfactor = 0.0;
+ static int drawcount;
+
if (s.size() == 64)
{
@@ -57,4 +61,20 @@ void GLAnalyzer::analyze( const Scope &s
glRotatef(0.25f, 0.0f, 1.0f, 0.5f); //Rotate the scene
drawFloor();
+ drawcount++;
+ if (drawcount > 25)
+ {
+ drawcount = 0;
+ peak = 0.0;
+ }
+
+ for ( uint i = 0; i < 32; i++ )
+ {
+ if (s[i] > peak)
+ {
+ peak = s[i];
+ }
+ }
+
+ mfactor = 20 / peak;
for ( uint i = 0; i < 32; i++ )
{
@@ -66,5 +86,5 @@ void GLAnalyzer::analyze( const Scope &s
// Calculating new vertical position (y) depending on the data \
passed by amarok
- y = float(s[i+offset] * 30.0f); //Should multiply by 20 but it looks \
crappy + y = float(s[i+offset] * mfactor); //This make it kinda \
dynamically resize depending on the data
//Some basic bounds checking
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic