2013-12-08 22:44:43 +01:00
|
|
|
/*
|
|
|
|
* Author: Harry van Haaren 2013
|
|
|
|
* harryhaaren@gmail.com
|
2016-12-27 13:47:19 +01:00
|
|
|
*
|
2013-12-08 22:44:43 +01:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-12-27 13:47:19 +01:00
|
|
|
*
|
2013-12-08 22:44:43 +01:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2016-12-27 13:47:19 +01:00
|
|
|
*
|
2013-12-08 22:44:43 +01:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2013-10-22 23:41:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include "nonseq.hxx"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "../jack.hxx"
|
|
|
|
#include "../looper.hxx"
|
|
|
|
#include "../looperclip.hxx"
|
|
|
|
|
|
|
|
NonSeq::NonSeq() :
|
2016-12-27 13:47:19 +01:00
|
|
|
Controller(),
|
|
|
|
MidiIO()
|
2013-10-22 23:41:14 +02:00
|
|
|
{
|
2016-12-27 13:47:19 +01:00
|
|
|
std::string name = "non-seq";
|
|
|
|
registerMidiPorts( name );
|
2013-10-22 23:41:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void NonSeq::launchScene( int scene )
|
|
|
|
{
|
2016-12-27 13:47:19 +01:00
|
|
|
unsigned char data[3];
|
|
|
|
data[0] = 176;
|
|
|
|
data[1] = 20;
|
|
|
|
data[2] = scene;
|
|
|
|
|
2019-06-09 10:41:19 +02:00
|
|
|
//LOOPP_NOTE("NonSeq::launchScene() %i, %i, %i\n", data[0],data[1],data[2] );
|
2016-12-27 13:47:19 +01:00
|
|
|
writeMidi( data );
|
2013-10-22 23:41:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string NonSeq::getName()
|
|
|
|
{
|
2016-12-27 13:47:19 +01:00
|
|
|
return "non-seq";
|
2013-10-22 23:41:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void NonSeq::setSceneState(int track, int scene, GridLogic::State s)
|
|
|
|
{
|
2016-12-27 13:47:19 +01:00
|
|
|
unsigned char data[3];
|
|
|
|
data[0] = 176;
|
|
|
|
data[1] = 22; // off
|
|
|
|
|
|
|
|
// check *actual* value of playing: *NOT* GridState::s, because it could be queued
|
|
|
|
// for something else, but we want the *actual* here, not "queued". This is a unique
|
2019-06-09 10:41:19 +02:00
|
|
|
// use case because were trying to control non-seq as if it were part of Loopp.
|
2016-12-27 13:47:19 +01:00
|
|
|
if( jack->getLooper( track )->getClip( scene )->playing() )
|
|
|
|
data[1] = 21;
|
|
|
|
|
|
|
|
data[2] = track;
|
|
|
|
|
2019-06-09 10:41:19 +02:00
|
|
|
//LOOPP_NOTE("NonSeq::setSceneState() %i, %i, %i\n", data[0],data[1],data[2] );
|
2016-12-27 13:47:19 +01:00
|
|
|
writeMidi( data );
|
2013-10-22 23:41:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int NonSeq::registerComponents()
|
|
|
|
{
|
2016-12-27 13:47:19 +01:00
|
|
|
// makes JACK add this controller to the midiObservers list:
|
|
|
|
// note the static_cast<>() is *needed* here for multiple-inheritance
|
|
|
|
MidiIO* m = static_cast<MidiIO*>(this);
|
|
|
|
|
|
|
|
jack->registerMidiIO( m );
|
|
|
|
|
2019-06-09 10:41:19 +02:00
|
|
|
return LOOPP_RETURN_OK;
|
2013-10-22 23:41:14 +02:00
|
|
|
}
|