mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Implementing track buffers
This commit is contained in:
parent
e597733b00
commit
a20da93fdb
3 changed files with 21 additions and 3 deletions
|
@ -10,10 +10,11 @@ class Buffers
|
|||
public:
|
||||
Buffers()
|
||||
{
|
||||
memset( audio, 0, sizeof(float*)*2);
|
||||
memset( audio, 0, sizeof(float*)*32);
|
||||
memset( midi , 0, sizeof(void *)*32);
|
||||
}
|
||||
float* audio[32];
|
||||
void* midi [32];
|
||||
void* midi [32];
|
||||
|
||||
enum BUFFER {
|
||||
MASTER_OUTPUT = 0,
|
||||
|
@ -21,6 +22,18 @@ class Buffers
|
|||
MASTER_MIDI_INPUT,
|
||||
APC_INPUT,
|
||||
APC_OUTPUT,
|
||||
|
||||
// track buffers: they are the "working" buffers per track:
|
||||
// the end result is mixed into the master output, while each
|
||||
// stage along the way the amplitude etc can be analysed
|
||||
TRACK_0,
|
||||
TRACK_1,
|
||||
TRACK_2,
|
||||
TRACK_3,
|
||||
TRACK_4,
|
||||
TRACK_5,
|
||||
TRACK_6,
|
||||
TRACK_7,
|
||||
};
|
||||
|
||||
// Jack details
|
||||
|
|
|
@ -66,6 +66,9 @@ Jack::Jack()
|
|||
|
||||
for(int i = 0; i < NTRACKS; i++)
|
||||
{
|
||||
// allocate working buffers for each track
|
||||
buffers.audio[Buffers::TRACK_0 + i] = (float*) malloc( sizeof(float) * nframes );
|
||||
|
||||
loopers.push_back( new Looper(i) );
|
||||
timeManager.registerObserver( loopers.back() );
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ Looper::Looper(int t) :
|
|||
// pre-zero the internal sample
|
||||
memset( &sample[0], 0, SAMPLE_SIZE );
|
||||
|
||||
printf("Looper ID %i\n" , track );
|
||||
|
||||
// init faust pitch shift variables
|
||||
fSamplingFreq = 44100;
|
||||
IOTA = 0;
|
||||
|
@ -151,7 +153,7 @@ void Looper::setSample(int c, AudioBuffer* ab)
|
|||
void Looper::process(int nframes, Buffers* buffers)
|
||||
{
|
||||
float* in = buffers->audio[Buffers::MASTER_INPUT];
|
||||
float* out = buffers->audio[Buffers::MASTER_OUTPUT];
|
||||
float* out = buffers->audio[Buffers::TRACK_0 + track];
|
||||
|
||||
float playbackSpeed = endPoint / ( float(numBeats) * fpb );
|
||||
semitoneShift = -( 12 * log ( playbackSpeed ) / log (2) );
|
||||
|
|
Loading…
Add table
Reference in a new issue