This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de (internal network only) to import your old projects to the new GitLab platform 📥

Commit 971cea6d by Henrik von Coler

Changed startup script (sample to be played)!

parent 5542ab0f
......@@ -55,12 +55,12 @@ double** SingleSample::get_x()
void SingleSample::set_f(int in)
{
F = in;
nFrames = in;
}
void SingleSample::set_sr(int in)
{
sr = in;
fs_sample = in;
}
......@@ -84,10 +84,10 @@ void SingleSample::initialize()
}
//double SingleSample::get_sample(int chan, int pos)
//{
// return x[chan][pos];
//}
double SingleSample::get_sample(int chan, int pos)
{
return x[chan][pos];
}
int SingleSample::getFS()
{
......@@ -133,12 +133,12 @@ void SingleSample::step()
pos = pos+R;
// loop in forward playback
if(pos>F)
pos = 0 + pos-(double)F;
if(pos>nFrames)
pos = 0 + pos-(double)nFrames;
// loop in reverse playback
if(pos<0)
pos = F;
pos = nFrames;
}
......@@ -159,18 +159,18 @@ void SingleSample::read_wavefile(std::string filePath)
}
//
F = info.frames;
sr = info.samplerate;
nFrames = info.frames;
fs_sample = info.samplerate;
nChannels = info.channels;
L = info.frames * info.channels;
//
GR = ((double) sr / (double) FS );
GR = ((double) fs_sample / (double) FS );
cout << "GR: " << GR << endl;
cout << "Fs:\t\t" << sr << endl;
cout << "Fs:\t\t" << fs_sample << endl;
cout << "Num Channels:\t" << nChannels << endl;
cout << "Num Samples:\t" << F << endl;
cout << "Num Samples:\t" << nFrames << endl;
// read interleaved data
double* tmp = new double[L];
......@@ -182,12 +182,12 @@ void SingleSample::read_wavefile(std::string filePath)
x = new double*[nChannels];
for(int i=0; i< nChannels; i++)
{
x[i] = new double[F];
x[i] = new double[nFrames];
}
// deinterleave into 'separate' arrays for L and R
int i=0;
for(int sampCNT=0; sampCNT<F; sampCNT++)
for(int sampCNT=0; sampCNT<nFrames; sampCNT++)
{
for(int chanCNT=0; chanCNT<nChannels; chanCNT++)
{
......
......@@ -53,16 +53,15 @@ public:
void set_L(int in);
void initialize();
double get_sample(int chan, int pos);
double get_sample(int chan, double pos);
//double get_sample(int chan, int pos);
double get_rate();
void set_rate(double r);
void set_rate(double r);
double get_pos();
void set_pos(double p);
......@@ -76,22 +75,33 @@ public:
private:
SNDFILE *sf;
SF_INFO info;
int FS;
double GR;
/// The resampling factor between
/// audio sample and interface.
double resFac;
int num_channels;
int F,sr,nChannels;
int num, L;
/// The number of frames in the wav file
int nFrames;
///
int fs_sample;
int nChannels;
int L;
///
/// \brief x
/// The 2d-array with the sample data,
/// arranged as a matrix.
double** x;
double pos;
/// the playback rates
double rate;
double resampleFactor = 1;
......
......@@ -2,4 +2,4 @@
#
# called by synth-user.service
#
/home/student/examples/wav_example/wav_example -f /home/student/wav/ALF_stereo.wav
/home/student/examples/wav_example/wav_example -f /home/student/wav/ALF_8bitDRY.wav
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment