Skip to content

Commit dd8395c

Browse files
committed
Add ABC
Fix compass screws
1 parent 68d8745 commit dd8395c

File tree

10 files changed

+2880
-86
lines changed

10 files changed

+2880
-86
lines changed

.github/workflows/build-plugin.yml

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,76 @@ name: Build VCV Rack Plugin
22
on: [push, pull_request]
33

44
env:
5-
rack-sdk-version: 2.0.2
5+
rack-sdk-version: 2.6.6
6+
rack-plugin-toolchain-dir: /home/build/rack-plugin-toolchain
67

78
defaults:
89
run:
910
shell: bash
1011

11-
jobs:
12+
jobs:
1213
build:
13-
name: ${{ matrix.config.os }}
14-
runs-on: ${{ matrix.config.os }}
14+
name: ${{ matrix.platform }}
15+
runs-on: ubuntu-latest
16+
container:
17+
image: ghcr.io/qno/rack-plugin-toolchain-win-linux
18+
options: --user root
1519
strategy:
20+
fail-fast: false
1621
matrix:
17-
config:
18-
- os: ubuntu-latest
19-
arch: lin
20-
compiler: cc
21-
install-dependencies: |
22-
sudo apt-get update && sudo apt-get install -y libglu-dev
23-
- os: macos-latest
24-
arch: mac
25-
compiler: cc
26-
install-dependencies: |
27-
brew install mesa
28-
- os: windows-latest
29-
arch: win
30-
compiler: gcc
31-
install-dependencies: |
32-
choco install --no-progress -y zip
22+
platform: [win-x64, lin-x64]
3323
steps:
34-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v3
3525
with:
36-
submodules: true
37-
- name: Install Rack SDK
26+
submodules: recursive
27+
- name: Build plugin
3828
run: |
39-
curl -o sdk.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-${{ matrix.config.arch }}.zip
40-
unzip sdk.zip
41-
- name: Install Dependencies
29+
export PLUGIN_DIR=$GITHUB_WORKSPACE
30+
pushd ${{ env.rack-plugin-toolchain-dir }}
31+
make plugin-build-${{ matrix.platform }}
32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
path: ${{ env.rack-plugin-toolchain-dir }}/plugin-build
36+
name: ${{ matrix.platform }}
37+
38+
build-mac:
39+
name: mac
40+
runs-on: macos-14
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
platform: [x64, arm64]
45+
steps:
46+
- uses: actions/checkout@v3
47+
with:
48+
submodules: recursive
49+
- name: Get Rack-SDK
4250
run: |
43-
${{ matrix.config.install-dependencies }}
44-
- name: Build
45-
env:
46-
RACK_DIR: Rack-SDK
47-
CC: ${{ matrix.config.compiler }}
51+
pushd $HOME
52+
wget -O Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac-${{ matrix.platform }}.zip
53+
unzip Rack-SDK.zip
54+
- name: Build plugin
4855
run: |
56+
CROSS_COMPILE_TARGET_x64=x86_64-apple-darwin
57+
CROSS_COMPILE_TARGET_arm64=arm64-apple-darwin
58+
export RACK_DIR=$HOME/Rack-SDK
59+
export CROSS_COMPILE=$CROSS_COMPILE_TARGET_${{ matrix.platform }}
60+
make dep
4961
make dist
62+
echo "Plugin architecture '$(lipo -archs plugin.dylib)'"
5063
- name: Upload artifact
51-
uses: actions/upload-artifact@v2
64+
uses: actions/upload-artifact@v4
5265
with:
53-
path: dist
54-
name: ${{ matrix.config.arch }}.zip
66+
path: dist/*.vcvplugin
67+
name: mac-${{ matrix.platform }}
5568

5669
publish:
5770
name: Publish plugin
58-
runs-on: ubuntu-18.04
59-
needs: build
71+
runs-on: ubuntu-latest
72+
needs: [build, build-mac]
6073
steps:
61-
- uses: actions/download-artifact@v2
74+
- uses: actions/download-artifact@v4
6275
with:
6376
path: _artifacts
6477
- uses: "marvinpinto/action-automatic-releases@latest"

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Changelog
22

3-
## v2.0.0
3+
## v2.1.0
4+
* Added module: ABC
45

6+
## v2.0.0
57
* Initial release: Kompas

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
This repo contains VCV ports of [Bastl Eurorack modules](https://bastl-instruments.com/eurorack/). See also: https://github.com/bastl-instruments
1+
[![Build plugin](https://github.com/bastl-instruments/bastl-vcv/actions/workflows/build-plugin.yml/badge.svg)](https://github.com/bastl-instruments/bastl-vcv/actions/workflows/build-plugin.yml) [![License](https://img.shields.io/badge/license-GPLv3--only-blue)](https://opensource.org/licenses/GPL-3.0)
22

3-
[VCV Library page](https://library.vcvrack.com/?brand=Bastl)
3+
This repo contains the collection of open-source VCV ports of [Bastl Eurorack modules](https://bastl-instruments.com/eurorack/). See also: https://github.com/bastl-instruments
4+
5+
All VCV modules (including the closed source Pizza collection) can be found at the [VCV Library page](https://library.vcvrack.com/?brand=Bastl).
46

57
[License](LICENSE.md)

plugin.json

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
1-
{
2-
"slug": "Bastl",
3-
"name": "Bastl",
4-
"version": "2.0.0",
5-
"license": "GPL-3.0-only",
6-
"brand": "Bastl",
7-
"author": "Stefano Manconi, Ewan Hemingway, Bastl collaborators",
8-
"authorEmail": "",
9-
"authorUrl": "",
10-
"pluginUrl": "https://github.com/hemmer/bastl-vcv",
11-
"manualUrl": "https://bastl-instruments.com/eurorack#modules",
12-
"sourceUrl": "https://github.com/hemmer/bastl-vcv",
13-
"donateUrl": "",
14-
"changelogUrl": "https://github.com/hemmer/bastl-vcv/blob/v2/CHANGELOG.md",
15-
"modules": [
16-
{
17-
"slug": "Kompas",
18-
"name": "Kompas",
19-
"description": "Kompas is a three-coordinate probabilistic pattern navigator.",
20-
"manualUrl": "https://bastl-instruments.com/eurorack/modules/kompas",
21-
"modularGridUrl": "https://www.modulargrid.net/e/bastl-instruments-kompas",
22-
"tags": [
23-
"Clock modulator",
24-
"Hardware clone",
25-
"Random",
26-
"Sequencer"
27-
]
28-
}
29-
]
1+
{
2+
"slug": "Bastl",
3+
"name": "Bastl",
4+
"version": "2.1.0",
5+
"license": "GPL-3.0-only",
6+
"brand": "Bastl",
7+
"author": "Stefano Manconi, Ewan Hemingway, Bastl collaborators",
8+
"authorEmail": "",
9+
"authorUrl": "",
10+
"pluginUrl": "https://github.com/hemmer/bastl-vcv",
11+
"manualUrl": "https://bastl-instruments.com/eurorack#modules",
12+
"sourceUrl": "https://github.com/hemmer/bastl-vcv",
13+
"donateUrl": "",
14+
"changelogUrl": "https://github.com/hemmer/bastl-vcv/blob/v2/CHANGELOG.md",
15+
"modules": [
16+
{
17+
"slug": "Kompas",
18+
"name": "Kompas",
19+
"description": "Kompas is a three-coordinate probabilistic pattern navigator.",
20+
"manualUrl": "https://bastl-instruments.com/eurorack/modules/kompas",
21+
"modularGridUrl": "https://www.modulargrid.net/e/bastl-instruments-kompas",
22+
"tags": [
23+
"Clock modulator",
24+
"Hardware clone",
25+
"Random",
26+
"Sequencer"
27+
]
28+
},
29+
{
30+
"slug": "ABC",
31+
"name": "ABC",
32+
"description": "Simple Six Channel Signal Mixer",
33+
"manualUrl": "https://bastl-instruments.com/eurorack/modules/abc",
34+
"modularGridUrl": "https://modulargrid.net/e/bastl-instruments-abc-black",
35+
"tags": [
36+
"Hardware clone",
37+
"Mixer"
38+
]
39+
}
40+
]
3041
}

res/panels/ABC.svg

Lines changed: 2587 additions & 0 deletions
Loading
File renamed without changes.

src/ABC.cpp

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#include "plugin.hpp"
2+
3+
using namespace simd;
4+
5+
struct ABC : Module {
6+
enum ParamId {
7+
A_PARAM,
8+
B_PARAM,
9+
C_PARAM,
10+
D_PARAM,
11+
E_PARAM,
12+
F_PARAM,
13+
PARAMS_LEN
14+
};
15+
enum InputId {
16+
A_INPUT,
17+
B_INPUT,
18+
C_INPUT,
19+
D_INPUT,
20+
E_INPUT,
21+
F_INPUT,
22+
INPUTS_LEN
23+
};
24+
enum OutputId {
25+
ABC_OUTPUT,
26+
DEF_OUTPUT,
27+
OUTPUTS_LEN
28+
};
29+
enum LightId {
30+
LIGHTS_LEN
31+
};
32+
33+
dsp::TBiquadFilter<float_4> dcBlockFilter[2];
34+
bool dcBlockEnabled = true;
35+
36+
ABC() {
37+
config(PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN);
38+
configParam(A_PARAM, 0.f, 1.f, 1.f, "Channel A Gain");
39+
configParam(B_PARAM, 0.f, 1.f, 1.f, "Channel B Gain");
40+
configParam(C_PARAM, 0.f, 1.f, 1.f, "Channel C Gain");
41+
configParam(D_PARAM, 0.f, 1.f, 1.f, "Channel D Gain");
42+
configParam(E_PARAM, 0.f, 1.f, 1.f, "Channel E Gain");
43+
configParam(F_PARAM, 0.f, 1.f, 1.f, "Channel F Gain");
44+
configInput(A_INPUT, "Channel A");
45+
configInput(B_INPUT, "Channel B");
46+
configInput(C_INPUT, "Channel C");
47+
configInput(D_INPUT, "Channel D");
48+
configInput(E_INPUT, "Channel E");
49+
configInput(F_INPUT, "Channel F");
50+
configOutput(DEF_OUTPUT, "Sum of D, E, F (and A, B, C if not connected)");
51+
configOutput(ABC_OUTPUT, "Sum of A, B, C");
52+
}
53+
54+
void onSampleRateChange() override {
55+
float sampleRate = APP->engine->getSampleRate();
56+
57+
// this doesn't work with floats below ~0.0004
58+
const float fc = std::max(0.0004, (30. / sampleRate));
59+
dcBlockFilter[0].setParameters(dsp::TBiquadFilter<float_4>::HIGHPASS, fc, 0.707, 1.0f);
60+
dcBlockFilter[1].setParameters(dsp::TBiquadFilter<float_4>::HIGHPASS, fc, 0.707, 1.0f);
61+
62+
dcBlockFilter[0].reset();
63+
dcBlockFilter[1].reset();
64+
}
65+
66+
void process(const ProcessArgs &args) override {
67+
68+
float_4 abcInputs = float_4(inputs[A_INPUT].getVoltage() * params[A_PARAM].getValue(),
69+
inputs[B_INPUT].getVoltage() * params[B_PARAM].getValue(),
70+
inputs[C_INPUT].getVoltage() * params[C_PARAM].getValue(), 0.f);
71+
72+
float_4 defInputs = float_4(inputs[D_INPUT].getVoltage() * params[D_PARAM].getValue(),
73+
inputs[E_INPUT].getVoltage() * params[E_PARAM].getValue(),
74+
inputs[F_INPUT].getVoltage() * params[F_PARAM].getValue(), 0.f);
75+
76+
if (dcBlockEnabled) {
77+
abcInputs = dcBlockFilter[0].process(abcInputs);
78+
defInputs = dcBlockFilter[1].process(defInputs);
79+
}
80+
81+
float abcSum = abcInputs[0] + abcInputs[1] + abcInputs[2];
82+
float defSum = defInputs[0] + defInputs[1] + defInputs[2];
83+
if (outputs[ABC_OUTPUT].isConnected()) {
84+
outputs[ABC_OUTPUT].setVoltage(abcSum);
85+
outputs[DEF_OUTPUT].setVoltage(defSum);
86+
87+
} else if (outputs[DEF_OUTPUT].isConnected()) {
88+
outputs[DEF_OUTPUT].setVoltage(abcSum + defSum);
89+
}
90+
}
91+
92+
json_t *dataToJson() override {
93+
json_t *rootJ = json_object();
94+
json_object_set_new(rootJ, "dcBlockEnabled", json_boolean(dcBlockEnabled));
95+
return rootJ;
96+
}
97+
98+
void dataFromJson(json_t *rootJ) override {
99+
json_t *dcBlockEnabledJ = json_object_get(rootJ, "dcBlockEnabled");
100+
if (dcBlockEnabledJ) {
101+
dcBlockEnabled = json_is_true(dcBlockEnabledJ);
102+
}
103+
}
104+
};
105+
106+
struct ABCWidget : ModuleWidget {
107+
ABCWidget(ABC *module) {
108+
setModule(module);
109+
setPanel(createPanel(asset::plugin(pluginInstance, "res/panels/ABC.svg")));
110+
111+
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
112+
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
113+
114+
addParam(createParamCentered<Trimpot>(mm2px(Vec(6.791, 25.42)), module, ABC::A_PARAM));
115+
addParam(createParamCentered<Trimpot>(mm2px(Vec(6.791, 44.461)), module, ABC::B_PARAM));
116+
addParam(createParamCentered<Trimpot>(mm2px(Vec(6.791, 63.527)), module, ABC::C_PARAM));
117+
addParam(createParamCentered<Trimpot>(mm2px(Vec(18.203, 15.861)), module, ABC::D_PARAM));
118+
addParam(createParamCentered<Trimpot>(mm2px(Vec(18.216, 34.962)), module, ABC::E_PARAM));
119+
addParam(createParamCentered<Trimpot>(mm2px(Vec(18.216, 53.987)), module, ABC::F_PARAM));
120+
121+
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(18.207, 73.181)), module, ABC::D_INPUT));
122+
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.809, 78.25)), module, ABC::A_INPUT));
123+
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(18.207, 84.6)), module, ABC::E_INPUT));
124+
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.809, 89.681)), module, ABC::B_INPUT));
125+
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(18.207, 96.02)), module, ABC::F_INPUT));
126+
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(6.809, 101.1)), module, ABC::C_INPUT));
127+
128+
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(18.207, 107.45)), module, ABC::DEF_OUTPUT));
129+
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(6.798, 112.53)), module, ABC::ABC_OUTPUT));
130+
}
131+
132+
void appendContextMenu(Menu *menu) override {
133+
ABC *abcModule = dynamic_cast<ABC *>(module);
134+
assert(abcModule);
135+
136+
menu->addChild(new MenuSeparator());
137+
138+
menu->addChild(createBoolPtrMenuItem("DC Block", "", &abcModule->dcBlockEnabled));
139+
}
140+
};
141+
142+
Model *modelABC = createModel<ABC, ABCWidget>("ABC");

src/Kompas.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ struct Kompas : Module {
352352
struct KompasWidget : ModuleWidget {
353353
KompasWidget(Kompas* module) {
354354
setModule(module);
355-
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Kompas.svg")));
355+
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/panels/Kompas.svg")));
356356

357-
addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
358-
addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
357+
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, 0)));
358+
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
359359

360360
addParam(createParamCentered<RoundBlackKnob>(mm2px(Vec(12.607, 16.749)), module, Kompas::LATITUDE_PARAM));
361361
addParam(createParamCentered<RoundBlackKnob>(mm2px(Vec(12.613, 36.429)), module, Kompas::ALTITUDE_PARAM));

src/plugin.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include "plugin.hpp"
22

3+
Plugin *pluginInstance;
34

4-
Plugin* pluginInstance;
5+
void init(Plugin *p) {
6+
pluginInstance = p;
57

8+
// Add modules here
9+
p->addModel(modelKompas);
10+
p->addModel(modelABC);
611

7-
void init(Plugin* p) {
8-
pluginInstance = p;
9-
10-
// Add modules here
11-
p->addModel(modelKompas);
12-
13-
// Any other plugin initialization may go here.
14-
// As an alternative, consider lazy-loading assets and lookup tables when your module is created to reduce startup times of Rack.
12+
// Any other plugin initialization may go here.
13+
// As an alternative, consider lazy-loading assets and lookup tables when your module is created to reduce startup times of
14+
// Rack.
1515
}

0 commit comments

Comments
 (0)