|
|
@ -1,18 +1,18 @@ |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc. |
|
|
|
Copyright 2013 Google Inc. |
|
|
|
* |
|
|
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
you may not use this file except in compliance with the License. |
|
|
|
* You may obtain a copy of the License at |
|
|
|
You may obtain a copy of the License at |
|
|
|
* |
|
|
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
* |
|
|
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
|
|
Unless required by applicable law or agreed to in writing, software |
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
|
|
distributed under the License is distributed on an "AS IS" BASIS, |
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
See the License for the specific language governing permissions and |
|
|
|
* limitations under the License. |
|
|
|
limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#ifndef __CONTROLLERS_H |
|
|
|
#ifndef __CONTROLLERS_H |
|
|
|
#define __CONTROLLERS_H |
|
|
|
#define __CONTROLLERS_H |
|
|
@ -51,11 +51,10 @@ struct FmMod { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setTarget(uint8_t assign) { |
|
|
|
void setTarget(uint8_t assign) { |
|
|
|
assign=assign < 0 && assign > 7 ? 0 : assign; |
|
|
|
assign = assign < 0 && assign > 7 ? 0 : assign; |
|
|
|
pitch=assign&1; // AMP
|
|
|
|
pitch = assign & 1; // AMP
|
|
|
|
amp=assign&2; // PITCH
|
|
|
|
amp = assign & 2; // PITCH
|
|
|
|
eg=assign&4; // EG
|
|
|
|
eg = assign & 4; // EG
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -63,17 +62,17 @@ class Controllers { |
|
|
|
void applyMod(int cc, FmMod &mod) { |
|
|
|
void applyMod(int cc, FmMod &mod) { |
|
|
|
float range = 0.01 * mod.range; |
|
|
|
float range = 0.01 * mod.range; |
|
|
|
uint8_t total = (float)cc * range; |
|
|
|
uint8_t total = (float)cc * range; |
|
|
|
if(mod.amp) |
|
|
|
if (mod.amp) |
|
|
|
amp_mod = max(amp_mod, total); |
|
|
|
amp_mod = max(amp_mod, total); |
|
|
|
|
|
|
|
|
|
|
|
if(mod.pitch) |
|
|
|
if (mod.pitch) |
|
|
|
pitch_mod = max(pitch_mod, total); |
|
|
|
pitch_mod = max(pitch_mod, total); |
|
|
|
|
|
|
|
|
|
|
|
if(mod.eg) |
|
|
|
if (mod.eg) |
|
|
|
eg_mod = max(eg_mod, total); |
|
|
|
eg_mod = max(eg_mod, total); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
int32_t values_[3]; |
|
|
|
int32_t values_[3]; |
|
|
|
|
|
|
|
|
|
|
|
uint8_t amp_mod; |
|
|
|
uint8_t amp_mod; |
|
|
@ -101,7 +100,7 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void refresh() { |
|
|
|
void refresh() { |
|
|
|
amp_mod=pitch_mod=eg_mod=0; |
|
|
|
amp_mod = pitch_mod = eg_mod = 0; |
|
|
|
|
|
|
|
|
|
|
|
applyMod(modwheel_cc, wheel); |
|
|
|
applyMod(modwheel_cc, wheel); |
|
|
|
applyMod(breath_cc, breath); |
|
|
|
applyMod(breath_cc, breath); |
|
|
|