Commit bd4984d2 authored by Harry van Haaren's avatar Harry van Haaren

-Metronome moved to seperate JACK headphones port, fixes #85.

parent e5d63bd6
-> Metronome moved from master out to headphones port
-> Special clip keybindings,
-> Captital keybindings for clear clip
-AudioEditor shows green / red based on BPM analysis of the sample
-Clearing clips bug fixed
......
......@@ -25,13 +25,6 @@
class Buffers
{
public:
Buffers()
{
memset( audio, 0, sizeof(float*)*32);
memset( midi , 0, sizeof(void *)*32);
}
float* audio[32];
void* midi [32];
enum BUFFER {
// AUDIO
......@@ -53,6 +46,8 @@ class Buffers
MASTER_RETURN_L,
MASTER_RETURN_R,
HEADPHONES_OUT,
// MIDI
MASTER_MIDI_INPUT,
......@@ -67,8 +62,18 @@ class Buffers
TRACK_5,
TRACK_6,
TRACK_7,
BUFFER_COUNT,
};
Buffers()
{
memset( audio, 0, sizeof(float*)*BUFFER_COUNT);
memset( midi , 0, sizeof(void *)*BUFFER_COUNT);
}
float* audio[BUFFER_COUNT];
void* midi [BUFFER_COUNT];
// Jack details
jack_nframes_t nframes;
jack_nframes_t samplerate;
......
......@@ -144,6 +144,12 @@ Jack::Jack( std::string name ) :
JackPortIsOutput,
0 );
headphonesPort = jack_port_register( client,
"headphone_out",
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput,
0 );
sendOutput = jack_port_register( client,
"send_out",
JACK_DEFAULT_AUDIO_TYPE,
......@@ -331,6 +337,7 @@ int Jack::process (jack_nframes_t nframes)
buffers.audio[Buffers::MASTER_INPUT] = (float*)jack_port_get_buffer( masterInput , nframes );
buffers.audio[Buffers::MASTER_RETURN_L] = (float*)jack_port_get_buffer( masterReturnL , nframes );
buffers.audio[Buffers::MASTER_RETURN_R] = (float*)jack_port_get_buffer( masterReturnR , nframes );
buffers.audio[Buffers::HEADPHONES_OUT] = (float*)jack_port_get_buffer( headphonesPort , nframes );
buffers.audio[Buffers::JACK_SEND_OUT] = (float*)jack_port_get_buffer( sendOutput , nframes );
buffers.audio[Buffers::JACK_MASTER_OUT_L] = (float*)jack_port_get_buffer( masterOutputL , nframes );
......@@ -392,6 +399,7 @@ void Jack::processFrames(int nframes)
memset( buffers.audio[Buffers::JACK_MASTER_OUT_R] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::MASTER_OUT_L] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::MASTER_OUT_R] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::HEADPHONES_OUT] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::SEND] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::SIDECHAIN_KEY] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::SIDECHAIN_SIGNAL] , 0, sizeof(float) * nframes );
......@@ -487,9 +495,10 @@ void Jack::processFrames(int nframes)
// JACK in multiple parts internally in Luppp: used for processing bar() / beat()
// if a full JACK nframes has been processed, this is extra work: its not that expensive
/// update buffers by nframes
buffers.audio[Buffers::MASTER_INPUT] = &buffers.audio[Buffers::MASTER_INPUT][nframes];
buffers.audio[Buffers::MASTER_INPUT] = &buffers.audio[Buffers::MASTER_INPUT] [nframes];
buffers.audio[Buffers::MASTER_RETURN_L] = &buffers.audio[Buffers::MASTER_RETURN_L][nframes];
buffers.audio[Buffers::MASTER_RETURN_R] = &buffers.audio[Buffers::MASTER_RETURN_R][nframes];
buffers.audio[Buffers::HEADPHONES_OUT] = &buffers.audio[Buffers::HEADPHONES_OUT] [nframes];
buffers.audio[Buffers::JACK_SEND_OUT] = &buffers.audio[Buffers::JACK_SEND_OUT][nframes];
buffers.audio[Buffers::JACK_MASTER_OUT_L] = &buffers.audio[Buffers::JACK_MASTER_OUT_L][nframes];
......
......@@ -148,6 +148,7 @@ class Jack
jack_port_t* masterOutputR;
jack_port_t* masterReturnL;
jack_port_t* masterReturnR;
jack_port_t* headphonesPort;
jack_port_t* sidechainKeyOutput;
jack_port_t* sidechainSignalOutput;
......
......@@ -82,8 +82,7 @@ void Metronome::process(int nframes, Buffers* buffers)
if ( not active )
return;
float* outL = buffers->audio[Buffers::MASTER_OUT_L];
float* outR = buffers->audio[Buffers::MASTER_OUT_R];
float* out = buffers->audio[Buffers::HEADPHONES_OUT];
float* sample = &beatSample[0];
if( playBar )
......@@ -95,8 +94,7 @@ void Metronome::process(int nframes, Buffers* buffers)
{
if ( playPoint < endPoint )
{
outL[i] += sample[playPoint];
outR[i] += sample[playPoint];
out[i] += sample[playPoint];
playPoint++;
}
}
......
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