xiRetimer

fit recorded audio to a tempo
git clone https://git.ce9e.org/xiRetimer.git

commit
1993a0185965bed5b60b0c4af124cec46bcf41d1
parent
89da71bf8e91e72a77fc824f40958680ce947211
Author
xi <tobias.bengfort@gmx.net>
Date
2010-11-01 17:08
read displayed data from old

Diffstat

M src/curve.cpp 4 +++-
M src/sample.cpp 7 +++++++
M src/sample.h 1 +

3 files changed, 11 insertions, 1 deletions


diff --git a/src/curve.cpp b/src/curve.cpp

@@ -2,6 +2,8 @@
    2     2 
    3     3 #include <cmath>
    4     4 
   -1     5 // TODO change first and last marker
   -1     6 
    5     7 Curve::Curve() {
    6     8   marker=new Marker();
    7     9   sample=new Sample(marker);
@@ -16,7 +18,7 @@ Curve::~Curve() {
   16    18 
   17    19 float Curve::get(float nn) {
   18    20   // TODO interpolation?
   19    -1   return sample->get(nn);
   -1    21   return sample->getOld(marker->new2old(marker->nnew2new(nn)));
   20    22 }
   21    23 
   22    24 float Curve::getSeeker() {return seeker;}

diff --git a/src/sample.cpp b/src/sample.cpp

@@ -23,6 +23,13 @@ float Sample::get(float nn) {
   23    23   return data[i];
   24    24 }
   25    25 
   -1    26 loat Sample::getOld(float o) {
   -1    27   // TODO interpolation?
   -1    28   int i=int((olength-1)*o);
   -1    29   if (i<0 || i>=olength) return NULL;
   -1    30   return data[i];
   -1    31 }
   -1    32 
   26    33 int Sample::loadFile(const char* fileName) {
   27    34   SNDFILE *sndfile;
   28    35   sfinfo;

diff --git a/src/sample.h b/src/sample.h

@@ -12,6 +12,7 @@ public:
   12    12   ~Sample();
   13    13   float *data;
   14    14   float get(float nn); // nnew
   -1    15   float getOld(float o);
   15    16   int getLength();
   16    17   int loadFile(const char* filename);
   17    18   int writeFile(const char* filename);