mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-06 01:21:38 -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:
|
public:
|
||||||
Buffers()
|
Buffers()
|
||||||
{
|
{
|
||||||
memset( audio, 0, sizeof(float*)*2);
|
memset( audio, 0, sizeof(float*)*32);
|
||||||
|
memset( midi , 0, sizeof(void *)*32);
|
||||||
}
|
}
|
||||||
float* audio[32];
|
float* audio[32];
|
||||||
void* midi [32];
|
void* midi [32];
|
||||||
|
|
||||||
enum BUFFER {
|
enum BUFFER {
|
||||||
MASTER_OUTPUT = 0,
|
MASTER_OUTPUT = 0,
|
||||||
|
@ -21,6 +22,18 @@ class Buffers
|
||||||
MASTER_MIDI_INPUT,
|
MASTER_MIDI_INPUT,
|
||||||
APC_INPUT,
|
APC_INPUT,
|
||||||
APC_OUTPUT,
|
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
|
// Jack details
|
||||||
|
|
|
@ -66,6 +66,9 @@ Jack::Jack()
|
||||||
|
|
||||||
for(int i = 0; i < NTRACKS; i++)
|
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) );
|
loopers.push_back( new Looper(i) );
|
||||||
timeManager.registerObserver( loopers.back() );
|
timeManager.registerObserver( loopers.back() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ Looper::Looper(int t) :
|
||||||
// pre-zero the internal sample
|
// pre-zero the internal sample
|
||||||
memset( &sample[0], 0, SAMPLE_SIZE );
|
memset( &sample[0], 0, SAMPLE_SIZE );
|
||||||
|
|
||||||
|
printf("Looper ID %i\n" , track );
|
||||||
|
|
||||||
// init faust pitch shift variables
|
// init faust pitch shift variables
|
||||||
fSamplingFreq = 44100;
|
fSamplingFreq = 44100;
|
||||||
IOTA = 0;
|
IOTA = 0;
|
||||||
|
@ -151,7 +153,7 @@ void Looper::setSample(int c, AudioBuffer* ab)
|
||||||
void Looper::process(int nframes, Buffers* buffers)
|
void Looper::process(int nframes, Buffers* buffers)
|
||||||
{
|
{
|
||||||
float* in = buffers->audio[Buffers::MASTER_INPUT];
|
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 );
|
float playbackSpeed = endPoint / ( float(numBeats) * fpb );
|
||||||
semitoneShift = -( 12 * log ( playbackSpeed ) / log (2) );
|
semitoneShift = -( 12 * log ( playbackSpeed ) / log (2) );
|
||||||
|
|
Loading…
Add table
Reference in a new issue