-Updated track send code, now scales. APC feedback provided on Device control.

This commit is contained in:
Harry van Haaren 2013-08-05 13:28:43 +01:00
parent b50b3d05eb
commit 0026d12a2c
6 changed files with 63 additions and 28 deletions

View file

@ -34,6 +34,25 @@ void AkaiAPC::progress(int t, int s, float f)
jack->writeApcOutput( &data[0] );
}
void AkaiAPC::fxTrackSend(int t, int send, float v)
{
unsigned char data[3];
data[0] = 176 + t;
switch( send )
{
case SEND_REV:
data[1] = 18; break;
case SEND_POST:
data[1] = 17; break;
case SEND_SIDE:
data[1] = 16; break;
default:
break;
}
data[2] = 127 * v;
jack->writeApcOutput( &data[0] );
}
void AkaiAPC::setSceneState(int t, int clip, GridLogic::State s)
{
unsigned char data[3];

View file

@ -14,12 +14,16 @@ class AkaiAPC : public Controller, public MidiObserver
std::string getName(){return "Akai APC";}
/// track actions
void mute(int t, bool b);
void volume(int t, float f);
void progress(int t, int s, float f);
void recordArm(int t, bool b);
void setSceneState(int track, int clip, GridLogic::State s);
/// track FX
void fxTrackSend(int t, int send, float v);
void midi(unsigned char* data);
};

View file

@ -20,7 +20,7 @@ class Controller
virtual void masterVolume(float f){};
/// FX
virtual void fxReverbSend(int t, float r){};
virtual void fxTrackSend(int t, int send, float v){};
/// track functionality
virtual void mute(int t, bool b){};

View file

@ -12,8 +12,19 @@
using namespace std;
// this is a wrapper class around a vector of Controller instances
// Call the method on this class, and all controllers will be updated
/** ControllerUpdater
* Updates each registered controller when a certain event occurs. All output
* devices (MIDI controllers, GUI, OSC-UI's etc) are registered in order to
* stay up-to-date.
*
* This class does no scheduling, it passes the events to the Controllers
* immidiatly.
*
* The Logic class is the opposite of this: it takes input and Luppp processes
* it, pushing the relevant updates in state through ControllerUpdater to each
* registered device.
**/
class ControllerUpdater
{
public:
@ -21,8 +32,8 @@ class ControllerUpdater
void registerController( Controller* controller )
{
std::cout << "ControllerUpdater registering controller: " <<
controller->getName() << endl;
std::cout << "ControllerUpdater registering " << controller->getName()
<< endl;
c.push_back( controller );
}
@ -39,6 +50,12 @@ class ControllerUpdater
c.at(i)->progress(t,s,p);
}
void setTrackSend(int t, int send, float v)
{
for(unsigned int i = 0; i < c.size(); i++)
c.at(i)->fxTrackSend(t, send, v);
}
void setSceneState(int t, int clip, GridLogic::State s)
{
for(unsigned int i = 0; i < c.size(); i++)

View file

@ -96,16 +96,8 @@ void handleDspEvents()
if ( availableRead >= sizeof(EventTrackSend) ) {
EventTrackSend ev;
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTrackSend) );
if ( ev.send == SEND_REV )
jack->getTrackOutput(ev.track)->setReverb( ev.value );
else if ( ev.send == SEND_SIDE )
jack->getTrackOutput(ev.track)->setSidechain( ev.value );
else if ( ev.send == SEND_POST )
jack->getTrackOutput(ev.track)->setPostSidechain( ev.value );
else
{
// nothing
}
jack->getTrackOutput(ev.track)->setSend( ev.send, ev.value );
jack->getControllerUpdater()->setTrackSend( ev.track, ev.send, ev.value );
} break; }
default:
{

View file

@ -35,20 +35,23 @@ class TrackOutput : public AudioProcessor
{
_toMaster = value;
}
/// set sidechain mix, 0-1
void setSidechain(float value)
/// set send
void setSend( int send, float value )
{
_toSidechain = value;
}
/// set post sidechain mix, 0-1
void setPostSidechain(float value)
{
_toPostSidechain = value;
}
/// set reverb mix, 0-1
void setReverb(float value)
{
_toReverb = value;
switch( send )
{
case SEND_REV:
_toReverb = value;
break;
case SEND_SIDE:
_toSidechain = value;
break;
case SEND_POST:
_toPostSidechain = value;
break;
}
}
/// copies the track output to master buffer, sidechain & post-side buffer