-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] ); 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) void AkaiAPC::setSceneState(int t, int clip, GridLogic::State s)
{ {
unsigned char data[3]; unsigned char data[3];

View file

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

View file

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

View file

@ -12,8 +12,19 @@
using namespace std; 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 class ControllerUpdater
{ {
public: public:
@ -21,8 +32,8 @@ class ControllerUpdater
void registerController( Controller* controller ) void registerController( Controller* controller )
{ {
std::cout << "ControllerUpdater registering controller: " << std::cout << "ControllerUpdater registering " << controller->getName()
controller->getName() << endl; << endl;
c.push_back( controller ); c.push_back( controller );
} }
@ -39,6 +50,12 @@ class ControllerUpdater
c.at(i)->progress(t,s,p); 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) void setSceneState(int t, int clip, GridLogic::State s)
{ {
for(unsigned int i = 0; i < c.size(); i++) for(unsigned int i = 0; i < c.size(); i++)

View file

@ -96,16 +96,8 @@ void handleDspEvents()
if ( availableRead >= sizeof(EventTrackSend) ) { if ( availableRead >= sizeof(EventTrackSend) ) {
EventTrackSend ev; EventTrackSend ev;
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTrackSend) ); jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTrackSend) );
if ( ev.send == SEND_REV ) jack->getTrackOutput(ev.track)->setSend( ev.send, ev.value );
jack->getTrackOutput(ev.track)->setReverb( ev.value ); jack->getControllerUpdater()->setTrackSend( ev.track, ev.send, 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
}
} break; } } break; }
default: default:
{ {

View file

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