Skip to content

Commit b71d248

Browse files
authored
Merge pull request #87 from pingdynasty/develop
OwlProgram v21.1
2 parents 3b7a82d + 685aa71 commit b71d248

23 files changed

Lines changed: 643 additions & 2922 deletions

.github/workflows/c-cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup arm-none-eabi-gcc
1919
uses: fiam/arm-none-eabi-gcc@v1
2020
with:
21-
release: '9-2020-q2' # The arm-none-eabi-gcc release to use.
21+
release: '10-2020-q4'
2222
- name: Setup emsdk
2323
uses: mymindstorm/setup-emsdk@v7
2424
with:

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "Libraries/DaisySP"]
2+
path = Libraries/DaisySP
3+
url = https://github.com/electro-smith/DaisySP.git
4+
branch = master

FaustCode/owl.cpp

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "Patch.h"
4040
#include "VoltsPerOctave.h"
4141

42-
// We have to undefine min/max from Owl's basicmaths.h, otherwise they cause
42+
// We have to undefine min/max from OWL's basicmaths.h, otherwise they cause
4343
// errors when Faust calls functions with the same names in std:: namespace
4444
#undef min
4545
#undef max
@@ -54,10 +54,11 @@
5454
#include "faust/gui/UI.h"
5555
#include "faust/gui/meta.h"
5656

57-
static float fFreq, fGain, fGate;
57+
static float fKey, fFreq, fGain, fGate;
5858
static float fBend = 1.0f;
5959

6060
class MonoVoiceAllocator {
61+
float& key;
6162
float& freq;
6263
float& gain;
6364
float& gate;
@@ -66,8 +67,9 @@ class MonoVoiceAllocator {
6667
uint8_t lastNote = 0;
6768

6869
public:
69-
MonoVoiceAllocator(float& fq, float& gn, float& gt, float& bd)
70-
: freq(fq)
70+
MonoVoiceAllocator(float& ky, float& fq, float& gn, float& gt, float& bd)
71+
: key(ky)
72+
, freq(fq)
7173
, gain(gn)
7274
, gate(gt)
7375
, bend(bd) {
@@ -114,6 +116,7 @@ class MonoVoiceAllocator {
114116
void noteOn(uint8_t note, uint16_t velocity, uint16_t delay) {
115117
if (lastNote < 16)
116118
notes[lastNote++] = note;
119+
key = note;
117120
freq = noteToHz(note);
118121
gain = velocityToGain(velocity);
119122
gate = 1.0f;
@@ -130,11 +133,12 @@ class MonoVoiceAllocator {
130133
notes[i] = notes[i + 1];
131134
i++;
132135
}
133-
freq = noteToHz(notes[lastNote - 1]);
136+
key = notes[lastNote - 1];
137+
freq = noteToHz(key);
134138
}
135139
else {
136140
gate = 0.0f;
137-
lastNote = 0;
141+
lastNote = 0;
138142
}
139143
}
140144
void allNotesOff() {
@@ -153,8 +157,7 @@ enum ParserState {
153157
* To enable MIDI in current patch, add this to source Faust file:
154158
* declare options "[midi:on]";
155159
*
156-
* You can also add descrpiption to be displayed with debugMessage function like
157-
* this:
160+
* You can also add a description to be displayed like this:
158161
* declare message "Hello World";
159162
*
160163
* To add V/Oct scaling support, use something likes this:
@@ -251,8 +254,8 @@ class MetaData : public Meta {
251254

252255
/**************************************************************************************
253256
*
254-
* OwlParameter : object used by OwlUI to ensures the connection between an Owl
255-
* parameter and a Faust widget
257+
* OwlParameter : object used by OwlUI to ensures the connection between an OWL
258+
* parameter and a FAUST widget
256259
*
257260
***************************************************************************************/
258261

@@ -349,8 +352,8 @@ class OwlButton : public OwlParameterBase {
349352
* OwlUI : Faust User Interface builder. Passed to buildUserInterface OwlU
350353
* ensures the mapping between owl parameters and faust widgets. It relies on
351354
* specific metadata "...[OWL:PARAMETER_X]..." in widget's label for that. For
352-
* example any faust widget with metadata [OWL:PARAMETER_B] will be controlled
353-
* by PARAMETER_B (the second knob).
355+
* example any faust widget with metadata [OWL:B] will be controlled by
356+
* PARAMETER_B (the second knob).
354357
*
355358
***************************************************************************************/
356359

@@ -359,7 +362,7 @@ class OwlButton : public OwlParameterBase {
359362
#define NO_PARAMETER ((PatchParameterId)-1)
360363
#define NO_BUTTON ((PatchButtonId)-1)
361364

362-
MonoVoiceAllocator allocator(fFreq, fGain, fGate, fBend);
365+
MonoVoiceAllocator allocator(fKey, fFreq, fGain, fGate, fBend);
363366
VoltsPerOctave* fVOctInput;
364367
VoltsPerOctave* fVOctOutput;
365368

@@ -385,6 +388,10 @@ class OwlUI : public UI {
385388
fParameterTable[fParameterIndex++] =
386389
new OwlVariable(fPatch, &fBend, zone, label, init, lo, hi);
387390
}
391+
else if (meta.midiOn && strcasecmp(label, "key") == 0) {
392+
fParameterTable[fParameterIndex++] =
393+
new OwlVariable(fPatch, &fKey, zone, label, init, lo, hi);
394+
}
388395
else if (fParameter != NO_PARAMETER) {
389396
fParameterTable[fParameterIndex++] =
390397
new OwlParameter(fPatch, fParameter, zone, label, init, lo, hi);
@@ -451,7 +458,7 @@ class OwlUI : public UI {
451458
delete fVOctOutput;
452459
}
453460

454-
// should be called before compute() to update widget's zones registered as Owl parameters
461+
// should be called before compute() to update widget's zones registered as OWL parameters
455462
void update() {
456463
for (int i = 0; i < fParameterIndex; i++)
457464
fParameterTable[i]->update();
@@ -513,7 +520,6 @@ class OwlUI : public UI {
513520
if (strcasecmp(k, "OWL") == 0) {
514521
if (strncasecmp(id, "PARAMETER_", 10) == 0)
515522
id += 10;
516-
517523
if (strlen(id) == 1) {
518524
// Single char parameter name.
519525
// Note that we can use I - P as aliases for AA-AH.
@@ -581,12 +587,13 @@ class OwlUI : public UI {
581587
else if (strcasecmp(id, "PUSH") == 0)
582588
fButton = PUSHBUTTON;
583589
}
584-
else if (strcasecmp(k, "midi") == 0) {
585-
// todo!
586-
// if (strcasecmp(id,"pitchwheel") == 0) fParameter = PARAMETER_G;
587-
// // mapped to pitch wheel declare(&fHslider1, "midi",
588-
// "pitchwheel"); declare(&fButton1, "midi", "ctrl 64");
589-
}
590+
// else if (strcasecmp(k, "midi") == 0) {
591+
// if (strcasecmp(id, "pitchwheel") == 0){ // PB
592+
// }else if (strcasecmp(id, "ctrl") == 0){ // CC
593+
// }else if (strcasecmp(id, "chanpress") == 0){ // AT
594+
// }else if (strcasecmp(id, "pgm") == 0){ // PC
595+
// }
596+
// }
590597
}
591598

592599
// -- V/Oct

HISTORY.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
v21.1
2+
-----
3+
4+
* SOUL integration
5+
* Maximilian integration
6+
* DaisySP integration
7+
* Added FAUST 'key' MIDI parameter (complements 'freq', 'gain', 'gate' and 'bend')
8+
* Added StateVariableFilter DSP class
9+
* Fixed Bus Error regression on legacy hardware
10+
* Automatically zero-initialise all heap allocations
11+
12+
v21.0
13+
-----
14+
15+
* Matches release v21.0 of OpenWare
16+
* Add support for patch resources
17+
18+
Prehistory
19+
-----------
20+
21+
A wise old OWL sat in an oak
22+

LibSource/ComplexShortArray.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void ComplexShortArray::complexByComplexMultiplication(ComplexShortArray operand
8585
#ifdef ARM_CORTEX
8686
arm_cmplx_mult_cmplx_q15((int16_t*)getData(), (int16_t*)operand2.getData(), (int16_t*)result.getData(), size );
8787
#else
88-
assert(false, "TODO");
88+
ASSERT(false, "TODO");
8989
float *pSrcA=(float*)data;
9090
float *pSrcB=(float*)operand2;
9191
float *pDst=(float*)result;

LibSource/Resource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ class Resource {
9393
~Resource(){}
9494
protected:
9595
Resource(const char* name, size_t size, void* data)
96-
: name(name), size(size), data((uint8_t*)data) {}
96+
: name(name), size(size), data((uint8_t*)data), allocated(false) {}
9797
const char* name;
98-
uint8_t* data;
9998
size_t size;
99+
uint8_t* data;
100100
bool allocated;
101101
};
102102
#endif

LibSource/ScreenBuffer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
#include "device.h"
77
#include "message.h"
88

9-
#ifndef swap
10-
#define swap(a, b) { int t = a; a = b; b = t; }
11-
#endif
129

1310
template<typename Colour, Colour BLACK, Colour WHITE>
1411
class ScreenBuffer {
@@ -22,6 +19,9 @@ class ScreenBuffer {
2219
uint16_t textcolor;
2320
uint16_t textbgcolor;
2421
bool wrap;
22+
23+
inline void swap(int& a, int& b) { int t = a; a = b; b = t; };
24+
2525
public:
2626
ScreenBuffer(uint16_t w, uint16_t h) :
2727
width(w), height(h), pixels(NULL),

LibSource/ShortFastFourierTransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ShortFastFourierTransform::ShortFastFourierTransform(int aSize){
4747
}
4848

4949
ShortFastFourierTransform::~ShortFastFourierTransform(){
50-
assert(false, "TODO");
50+
ASSERT(false, "TODO");
5151
ComplexShortArray::destroy(temp);
5252
}
5353

0 commit comments

Comments
 (0)