-MidiObserver interface in action, tested using APC controller

This commit is contained in:
Harry van Haaren 2013-07-31 19:50:58 +01:00
parent 60727b10be
commit 6c77081b15
3 changed files with 8 additions and 6 deletions

View file

@ -54,7 +54,7 @@ void AkaiAPC::volume(int t, float f)
void note_on( int track, int note, int vel )
{
printf("apc note on using MIDI observer \n");
}
void cc_change( int track, int cc, float value )
@ -84,6 +84,6 @@ void AkaiAPC::midi(unsigned char* data)
}
else if ( b1 >= 176 && b1 < 176 + 16 ) // CC
{
cc_change( b1 - 144, b2, data[2] / 127.f );
cc_change( b1 - 176, b2, data[2] / 127.f );
}
}

View file

@ -13,7 +13,8 @@ extern int jackSamplerate;
Jack::Jack() :
clientActive(false),
client( 0 )
client( 0 ),
controllerUpdater( new ControllerUpdater() )
{
// open the client
client = jack_client_open ( "Luppp", JackNullOption , 0 , 0 );
@ -103,7 +104,8 @@ Jack::Jack() :
void Jack::activate()
{
// move to "settings" class or so
controllerUpdater->registerController( new AkaiAPC() );
Controller* c = new AkaiAPC();
controllerUpdater->registerController( c );
jack_activate( client );
jack_transport_start(client);
@ -161,7 +163,7 @@ int Jack::process (jack_nframes_t nframes)
// check each looper for MIDI match
for( int i = 0; i < midiObservers.size(); i++ )
{
midiObservers.at(i)->midi( (unsigned char*) in_event.buffer[0] );
midiObservers.at(i)->midi( (unsigned char*) &in_event.buffer[0] );
}
//std::for_each( midiObservers.begin(), midiObservers.end(), [](MidiObserver* mo) { mo->midi( ); } );

View file

@ -7,5 +7,5 @@ extern Jack* jack;
MidiObserver::MidiObserver( std::string portName )
{
//jack->registerMidiObserver( this );
jack->registerMidiObserver( this );
}