Skip to content

Commit a2fb3b7

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/new-heavy
2 parents f9f1f2c + 267b96e commit a2fb3b7

115 files changed

Lines changed: 8451 additions & 1150 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/c-cpp.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
uses: mymindstorm/setup-emsdk@v7
2424
with:
2525
version: 2.0.10
26+
- name: Setup python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: 2.7
2630
- name: make
2731
run: make
2832
- name: make check

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
path = Libraries/DaisySP
33
url = https://github.com/electro-smith/DaisySP.git
44
branch = master
5+
[submodule "Tools/hvcc"]
6+
path = Tools/hvcc
7+
url = https://github.com/pingdynasty/hvcc.git
8+
branch = develop

FaustSource/owl.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,15 @@ class OwlUI : public UI {
911911
}
912912
else if (strcasecmp(id, "PUSH") == 0)
913913
fButton = PUSHBUTTON;
914-
}
914+
else if (strcasecmp(id, "ButtonA") == 0)
915+
fButton = BUTTON_A;
916+
else if (strcasecmp(id, "ButtonB") == 0)
917+
fButton = BUTTON_B;
918+
else if (strcasecmp(id, "ButtonC") == 0)
919+
fButton = BUTTON_C;
920+
else if (strcasecmp(id, "ButtonD") == 0)
921+
fButton = BUTTON_D;
922+
}
915923
// else if (strcasecmp(k, "midi") == 0) {
916924
// if (strcasecmp(id, "pitchwheel") == 0){ // PB
917925
// }else if (strcasecmp(id, "ctrl") == 0){ // CC

GenSource/GenPatch.hpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "Patch.h"
55
#include "gen.h"
6+
#include "genlib.h"
67
#include "PatchMetadata.h"
78

89
#if __has_include("metadata.h")
@@ -105,8 +106,8 @@ class GenParameter : public GenParameterBase {
105106
public:
106107
PatchParameterId pid;
107108
int8_t index;
108-
float min = 0.0;
109-
float max = 1.0;
109+
float min = 0.0f;
110+
float max = 1.0f;
110111
GenParameter(Patch* patch, CommonState *context, const char* name, PatchParameterId id, int8_t idx) : pid(id), index(idx) {
111112
#ifndef OWL_METADATA
112113
patch->registerParameter(id, name);
@@ -222,7 +223,7 @@ class GenPatch : public Patch {
222223
for(int ch=channels; ch<gen::num_outputs(); ++ch)
223224
buffers[ch] = new float[getBlockSize()];
224225

225-
size_t nof_outs = gen::num_outputs()-min(gen::num_outputs(), channels);
226+
size_t nof_outs = gen::num_outputs()-std::min((size_t)gen::num_outputs(), channels);
226227
// debugMessage("outs", (int)channels, nof_outs, sizeof(OutputParameter[nof_outs]));
227228
if(nof_outs > 0)
228229
outputs = SimpleArray<OutputParameter>(new OutputParameter[nof_outs], nof_outs);
@@ -231,12 +232,22 @@ class GenPatch : public Patch {
231232
for(int i=0; i<PatchMetadata::parameter_count; ++i){
232233
const PatchMetadata::Control& ctrl = PatchMetadata::parameters[i];
233234
PatchParameterId pid = (PatchParameterId)ctrl.id;
234-
registerParameter(pid, ctrl.name);
235235
if(ctrl.flags & CONTROL_OUTPUT){
236236
if(outputindex < nof_outs)
237237
outputs[outputindex] = OutputParameter(pid, ctrl.name, FloatArray(buffers[channels+outputindex], getBlockSize()));
238238
outputindex++;
239239
}
240+
size_t len = strlen(ctrl.name);
241+
if(ctrl.flags & CONTROL_OUTPUT && ctrl.name[len-1] != '>'){
242+
// add a > at end of name
243+
char name[len+2];
244+
strcpy(name, ctrl.name);
245+
name[len] = '>';
246+
name[len+1] = '\0';
247+
registerParameter(pid, name);
248+
}else{
249+
registerParameter(pid, ctrl.name);
250+
}
240251
}
241252
for(int i=0; i<PatchMetadata::button_count; ++i){
242253
const PatchMetadata::Control& ctrl = PatchMetadata::buttons[i];

GenSource/genlib.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,4 +463,17 @@ short genlib_setstate(CommonState *cself, const char *state, setparameter_method
463463

464464
return 0;
465465
}
466+
#else
467+
short genlib_setstate(CommonState *cself, const char *state, setparameter_method setmethod)
468+
{
469+
return 0;
470+
}
471+
short genlib_getstate(CommonState *cself, char *state, getparameter_method getmethod)
472+
{
473+
return 0;
474+
}
475+
size_t genlib_getstatesize(CommonState *cself, getparameter_method getmethod)
476+
{
477+
return 0;
478+
}
466479
#endif

GenSource/genlib_ops.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2222

2323
#include "genlib_common.h" // common to common code and any host code
2424
#include "genlib.h" // this file is different for different "hosts"
25+
#ifdef clamp
26+
#undef clamp
27+
#endif
2528

2629
//////////// genlib_ops.h ////////////
2730

HISTORY.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
1+
v22.2
2+
-----
3+
* Added NoiseOscillator (whitenoise s+h)
4+
* Added PhaseShiftOscillator template
5+
* Added Biquad allpass filter configuration
6+
* Fixed Antialiased oscillators (Triangle, SquareWave, Ramp)
7+
* Added MorphingOscillator
8+
* AdjustableTapTempo interface changes
9+
* CircularBuffer improvements, added isFull()
10+
* Added InvertedRampOscillator
11+
* Added StateVariableFilter::setAllpass() and processLowMidHighBand()
12+
* Improved realloc implementation
13+
* Block based SineOscillator::generate() with FM
14+
* Added test patches for automatic CI builds
15+
* Automatically add '>' to end of gen~ output parameters
16+
* Updated to use C++17
17+
* Use std::min/max/abs/clamp instead of macros for C++
18+
* Refactored AdsrEnvelope to Linear and Exponential versions
119
* Updated CMSIS libraries
220

321
v21.2
422
-----
523

24+
* Added FloatArray::softclip()
25+
* Added clamp(x, lo, hi) macro
26+
* Added TapTempo
27+
* Added DryWetProcessors
28+
* Added FeedbackProcessors
29+
* Added CrossFadingDelayProcessor
30+
* Added AudioBuffer::copyFrom(), copyTo(), multiply() and add()
631
* Added Sample oscillator
732
* Added Agnesi curve oscillator
833
* Added MPE processor

LibSource/AbstractSynth.h

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@ class AbstractSynth : public Synth, public MidiProcessor, public VelocityCurve {
1010
protected:
1111
uint8_t note = 60; // C4
1212
float pb = 0;
13-
float pb_range = 2;
13+
float pb_range = 2/8192.0f;
14+
float mod_range = 0.5/127.0f;
15+
float tuning = 440;
1416
public:
1517
virtual ~AbstractSynth(){}
18+
/**
19+
* Set frequency in Hertz for middle A (defaults to Stuttgart pitch, A440, 440 Hz)
20+
*/
21+
void setTuning(float value){
22+
tuning = value;
23+
}
24+
float getTuning(){
25+
return tuning;
26+
}
1627
/**
1728
* Set note in whole semitones
1829
*/
@@ -50,44 +61,54 @@ class AbstractSynth : public Synth, public MidiProcessor, public VelocityCurve {
5061
* Does not update the frequency; effective from next pitch bend change
5162
*/
5263
void setPitchBendRange(float range){
53-
this->pb_range = range;
54-
}
64+
this->pb_range = range/8192.0f;
65+
}
66+
/**
67+
* Set modulation depth range, from 0 to 1.0
68+
*/
69+
void setModulationDepthRange(float range){
70+
mod_range = range / 127.0f;
71+
}
5572
// MIDI handlers
56-
virtual void noteOn(MidiMessage msg) override {
73+
virtual void noteOn(MidiMessage msg) {
5774
setNote(msg.getNote());
5875
setFrequency(noteToFrequency(note+pb));
5976
setGain(velocityToGain(msg.getVelocity()));
6077
gate(true);
6178
}
62-
virtual void noteOff(MidiMessage msg) override {
79+
virtual void noteOff(MidiMessage msg) {
6380
gate(false);
6481
}
65-
virtual void controlChange(MidiMessage msg) override {
82+
virtual void controlChange(MidiMessage msg) {
6683
if(msg.getControllerNumber() == MIDI_CC_MODULATION)
67-
setModulation(msg.getControllerValue()/127.0f);
84+
setModulation(msg.getControllerValue()/128.0f);
6885
else if(msg.getControllerNumber() == MIDI_ALL_NOTES_OFF)
6986
allNotesOff();
7087
}
71-
virtual void channelPressure(MidiMessage msg) override {
72-
setPressure(msg.getChannelPressure()/127.0f);
88+
virtual void channelPressure(MidiMessage msg) {
89+
setPressure(msg.getChannelPressure()/128.0f);
7390
}
74-
virtual void polyKeyPressure(MidiMessage msg) override {
75-
setPressure(msg.getPolyKeyPressure()/127.0f);
91+
virtual void polyKeyPressure(MidiMessage msg) {
92+
setPressure(msg.getPolyKeyPressure()/128.0f);
7693
}
77-
virtual void setModulation(float modulation){} // default implementation does nothing
78-
virtual void setPressure(float pressure){}
79-
virtual void pitchbend(MidiMessage msg) override {
80-
setPitchBend(pb_range*msg.getPitchBend()/8192.0f);
94+
virtual void modulate(MidiMessage msg) {
95+
setModulation(mod_range * msg.getControllerValue());
96+
}
97+
virtual void pitchbend(MidiMessage msg) {
98+
setPitchBend(pb_range * msg.getPitchBend());
8199
}
82100
virtual void allNotesOff(){
83101
gate(false);
84102
}
103+
// default implementations do nothing
104+
virtual void setModulation(float modulation){}
105+
virtual void setPressure(float pressure){}
85106
// static utility methods
86-
static inline float frequencyToNote(float freq){
87-
return 12 * log2f(freq / 440) + 69;
107+
inline float frequencyToNote(float freq){
108+
return 12 * log2f(freq / tuning) + 69;
88109
}
89-
static inline float noteToFrequency(float note){
90-
return 440 * exp2f((note - 69) / 12);
110+
inline float noteToFrequency(float note){
111+
return tuning * exp2f((note - 69) / 12);
91112
}
92113
};
93114

0 commit comments

Comments
 (0)