Mercurial > hg > audiodb
diff examples/iAudioDB/AppController.m @ 703:14b48e1b9ca4
Fix to start vector / length (ta Christophe!)
author | mas01mj |
---|---|
date | Fri, 30 Apr 2010 15:31:08 +0000 |
parents | 6d8539709d9c |
children | df35c9c976a0 |
line wrap: on
line diff
--- a/examples/iAudioDB/AppController.m Fri Apr 30 14:57:30 2010 +0000 +++ b/examples/iAudioDB/AppController.m Fri Apr 30 15:31:08 2010 +0000 @@ -670,7 +670,7 @@ { if(lengthSecs >= 0) { - lengthVectors = ceil(((lengthSecs*sampleRate)-winSize)/hopSize); + lengthVectors = ceil((((lengthSecs*sampleRate)-winSize)/hopSize)+1); if(lengthVectors < 0) {lengthVectors = 0; } [queryLengthVectors setDoubleValue:lengthVectors]; } @@ -680,7 +680,7 @@ { if(lengthVectors >= 0) { - lengthSecs = ((hopSize*lengthVectors)+winSize)/sampleRate; + lengthSecs = ((hopSize*(lengthVectors-1))+winSize)/sampleRate; if(lengthSecs < 0) { lengthSecs = 0; } [queryLengthSeconds setDoubleValue:lengthSecs]; } @@ -691,7 +691,7 @@ { if(startSecs >= 0) { - startVectors = ceil(((startSecs*sampleRate)-winSize)/hopSize); + startVectors = ceil((startSecs*sampleRate)/hopSize); if(startVectors < 0) { startVectors = 0; } [queryStartVectors setDoubleValue:startVectors]; } @@ -700,7 +700,7 @@ { if(startVectors >= 0) { - startSecs = ((hopSize*startVectors)+winSize)/sampleRate; + startSecs = (hopSize*startVectors)/sampleRate; if(startSecs < 0) { startSecs = 0; } [queryStartSeconds setDoubleValue:startSecs]; }