Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support an instant input setting in ORAC on Organelle #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mec-kontrol/pd/kontrolrack/KontrolRack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ EXTERN void KontrolRack_setup(void) {
(t_method) KontrolRack_setmoduleorder, gensym("setmoduleorder"),
A_GIMME, A_NULL);

class_addmethod(KontrolRack_class,
(t_method) KontrolRack_instantParam, gensym("instantParamsBool"),
A_FLOAT, A_NULL);

class_addmethod(KontrolRack_class,
(t_method) KontrolRack_test, gensym("test"),
A_DEFFLOAT, A_NULL);
Expand Down Expand Up @@ -1030,6 +1034,9 @@ void KontrolRack_selectmodule(t_KontrolRack* x, t_floatarg module) {
if (x->device_) x->device_->selectModule((unsigned) module);
}

void KontrolRack_instantParam(t_KontrolRack* x, t_floatarg setting) {
x->device_->instantParam(setting);
}

//-----------------------
void PdCallback::rack(Kontrol::ChangeSource src, const Kontrol::Rack & rack) {
Expand Down
1 change: 1 addition & 0 deletions mec-kontrol/pd/kontrolrack/KontrolRack.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void KontrolRack_selectmodule(t_KontrolRack* x, t_floatarg value);
void KontrolRack_loadresources(t_KontrolRack *x);

void KontrolRack_setmoduleorder(t_KontrolRack *x,t_symbol* s, int argc, t_atom *argv);
void KontrolRack_instantParam(t_KontrolRack *x, t_floatarg setting);

}

Expand Down
4 changes: 4 additions & 0 deletions mec-kontrol/pd/kontrolrack/devices/KontrolDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ void KontrolDevice::midiLearn(Kontrol::ChangeSource src, bool b) {
midiLearnActive_ = b;
}

void KontrolDevice::instantParam(bool b) {
instantParamSetting_ = b;
}

void KontrolDevice::modulationLearn(Kontrol::ChangeSource src, bool b) {
modParamId_ = "";
modModuleId_ = "";
Expand Down
4 changes: 4 additions & 0 deletions mec-kontrol/pd/kontrolrack/devices/KontrolDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class KontrolDevice : public Kontrol::KontrolCallback {

void midiLearn(bool b);
void modulationLearn(bool b);
void instantParam(bool b);

virtual void midiCC(unsigned num, unsigned value);
virtual void modulate(const std::string& src, unsigned bus, float value);
Expand All @@ -81,6 +82,8 @@ class KontrolDevice : public Kontrol::KontrolCallback {

bool midiLearn() { return midiLearnActive_; }
bool modulationLearn() { return modulationLearnActive_; }
bool instantParamSetting() { return instantParamSetting_; }


Kontrol::EntityId currentRack() { return currentRackId_; }

Expand All @@ -105,6 +108,7 @@ class KontrolDevice : public Kontrol::KontrolCallback {
bool midiLearnActive_;
bool modulationLearnActive_;
bool enableMenu_;
bool instantParamSetting_ = false;
std::vector<std::string> moduleOrder_;

Kontrol::EntityId modParamId_;
Expand Down
5 changes: 4 additions & 1 deletion mec-kontrol/pd/kontrolrack/devices/Organelle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,16 @@ void OParamMode::changePot(unsigned pot, float rawvalue) {
if (rawvalue != std::numeric_limits<float>::max()) {
float value = rawvalue / MAX_POT_VALUE;
calc = param->calcFloat(value);
if (rawvalue != pots_->rawValue[pot] && parent_.instantParamSetting()) {
pots_->locked_[pot] = Pots::K_UNLOCKED;
}
//std::cerr << "changePot " << pot << " " << value << " cv " << calc.floatValue() << " pv " << param->current().floatValue() << std::endl;
}

pots_->rawValue[pot] = rawvalue;


if (pots_->locked_[pot] != Pots::K_UNLOCKED) {
if (pots_->locked_[pot] != Pots::K_UNLOCKED && parent_.instantParamSetting() == false) {
//if pot is locked, determined if we can unlock it
if (calc == param->current()) {
pots_->locked_[pot] = Pots::K_UNLOCKED;
Expand Down