2013-12-08 22:44:43 +01:00
|
|
|
/*
|
|
|
|
* Author: Harry van Haaren 2013
|
|
|
|
* harryhaaren@gmail.com
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2013-05-13 23:04:12 +02:00
|
|
|
|
|
|
|
#ifndef LUPPP_LOOPER_H
|
|
|
|
#define LUPPP_LOOPER_H
|
|
|
|
|
2013-05-17 10:24:24 +02:00
|
|
|
#include <vector>
|
2013-05-13 23:04:12 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "buffers.hxx"
|
2013-07-27 19:34:48 +02:00
|
|
|
|
2013-07-27 23:36:58 +02:00
|
|
|
#include "audioprocessor.hxx"
|
2013-07-27 19:34:48 +02:00
|
|
|
|
|
|
|
#include "looperclip.hxx"
|
2013-07-31 11:55:48 +02:00
|
|
|
#include "observer/time.hxx"
|
2013-05-15 03:55:51 +02:00
|
|
|
|
2013-05-13 23:04:12 +02:00
|
|
|
using namespace std;
|
|
|
|
|
2013-07-27 19:24:04 +02:00
|
|
|
/** Looper
|
|
|
|
* The class which reads from LooperClips, and reads/ writes the data using the
|
|
|
|
* track buffer. Scene recording / playback is the essential functionality here.
|
|
|
|
**/
|
2013-07-31 11:55:48 +02:00
|
|
|
class Looper : public AudioProcessor, public TimeObserver
|
2013-05-13 23:04:12 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-05-17 10:24:24 +02:00
|
|
|
Looper(int t);
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-08-06 23:20:37 +02:00
|
|
|
/// *sets* the new audiobuffer, but the content gets copied to the new buffer.
|
|
|
|
/// Used for infinite lenght recording
|
|
|
|
void setRequestedBuffer(int s, AudioBuffer* ab);
|
|
|
|
|
2013-08-22 00:50:52 +02:00
|
|
|
/// stores the framesPerBeat from TimeManager. Used to stretch audio
|
2013-12-08 00:27:33 +01:00
|
|
|
void setFpb(int f);
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-08-22 00:50:52 +02:00
|
|
|
/// Retrieve a clip from the Looper
|
2013-07-27 20:06:28 +02:00
|
|
|
LooperClip* getClip(int scene);
|
|
|
|
|
2013-08-22 00:50:52 +02:00
|
|
|
/// Process nframes of audio
|
2013-08-16 00:51:09 +02:00
|
|
|
void process(unsigned int nframes, Buffers* buffers);
|
2013-05-13 23:04:12 +02:00
|
|
|
|
|
|
|
private:
|
2013-05-18 20:52:12 +02:00
|
|
|
const int track;
|
2013-05-15 05:05:36 +02:00
|
|
|
|
2013-08-01 20:58:26 +02:00
|
|
|
/// variables used to determing the current actions of the looper
|
|
|
|
int playingScene;
|
|
|
|
int queuedScene;
|
|
|
|
|
2013-08-13 18:57:14 +02:00
|
|
|
int fpb;
|
|
|
|
|
2013-08-15 18:18:03 +02:00
|
|
|
//vector<float> tmpRecordBuffer;
|
2013-08-22 01:46:58 +02:00
|
|
|
LooperClip* clips[10];
|
2013-07-27 19:34:48 +02:00
|
|
|
|
2013-05-17 10:24:24 +02:00
|
|
|
// Pitch Shifting
|
|
|
|
void pitchShift(int count, float* input, float* output);
|
|
|
|
vector<float> tmpBuffer;
|
2013-08-15 18:18:03 +02:00
|
|
|
|
2013-05-17 10:24:24 +02:00
|
|
|
int IOTA;
|
|
|
|
float fVec0[65536];
|
|
|
|
float semitoneShift;
|
|
|
|
float windowSize;
|
|
|
|
float fRec0[2];
|
|
|
|
float crossfadeSize;
|
|
|
|
float fSamplingFreq;
|
2013-07-30 19:34:47 +02:00
|
|
|
|
|
|
|
int uiUpdateConstant;
|
|
|
|
int uiUpdateCounter;
|
2013-05-13 23:04:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LUPPP_LOOPER_H
|