Skip to content

Commit

Permalink
Merge pull request #19 from captainssounds/development
Browse files Browse the repository at this point in the history
New build system to master
  • Loading branch information
mikeallisonJS authored May 25, 2020
2 parents 65f1484 + 26989a7 commit aea6935
Show file tree
Hide file tree
Showing 14 changed files with 298 additions and 7 deletions.
18 changes: 18 additions & 0 deletions .github/actions/build_linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:16.04

LABEL "com.github.actions.name"="VCVRackPluginBuilder-Linux"
LABEL "com.github.actions.description"="Builds a VCV Rack plugin for Linux"
LABEL "com.github.actions.icon"="headphones"
LABEL "com.github.actions.color"="purple"

LABEL "repository"="TBD"
LABEL "homepage"="TBD"
LABEL "maintainer"="dewb"

RUN apt-get update
RUN apt-get install -y build-essential cmake curl gcc g++ git make tar unzip zip libgl1-mesa-dev libglu1-mesa-dev jq

ADD entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
15 changes: 15 additions & 0 deletions .github/actions/build_linux/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -eu

export RACK_DIR=${GITHUB_WORKSPACE}/Rack-SDK
export RACK_USER_DIR=${GITHUB_WORKSPACE}

git submodule update --init --recursive

curl -L https://vcvrack.com/downloads/Rack-SDK-${RACK_SDK_VERSION}.zip -o rack-sdk.zip
unzip -o rack-sdk.zip
rm rack-sdk.zip

make clean
make dist
64 changes: 64 additions & 0 deletions .github/actions/build_osx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

FROM debian

LABEL "com.github.actions.name"="VCVRackPluginBuilder-OSX"
LABEL "com.github.actions.description"="Builds a VCV Rack plugin for OS X"
LABEL "com.github.actions.icon"="headphones"
LABEL "com.github.actions.color"="purple"

LABEL "repository"="TBD"
LABEL "homepage"="TBD"
LABEL "maintainer"="dewb"

RUN apt-get update && \
apt-get upgrade -yy && \
apt-get install -yy \
automake \
bison \
curl \
file \
flex \
git \
libtool \
pkg-config \
python \
texinfo \
vim \
wget \
zlib1g-dev \
build-essential \
cmake \
make \
tar \
unzip \
zip \
libgl1-mesa-dev \
libglu1-mesa-dev \
jq \
rsync

# Install osxcross
# NOTE: The Docker Hub's build machines run varying types of CPUs, so an image
# built with `-march=native` on one of those may not run on every machine - I
# ran into this problem when the images wouldn't run on my 2013-era Macbook
# Pro. As such, we remove this flag entirely.
ENV OSXCROSS_SDK_VERSION 10.11
RUN SDK_VERSION=$OSXCROSS_SDK_VERSION \
mkdir /opt/osxcross && \
cd /opt && \
git clone https://github.com/tpoechtrager/osxcross.git && \
cd osxcross && \
git checkout e0a171828a72a0d7ad4409489033536590008ebf && \
sed -i -e 's|-march=native||g' ./build_clang.sh ./wrapper/build.sh && \
./tools/get_dependencies.sh && \
curl -L -o ./tarballs/MacOSX${OSXCROSS_SDK_VERSION}.sdk.tar.xz \
https://github.com/apriorit/osxcross-sdks/raw/master/MacOSX${OSXCROSS_SDK_VERSION}.sdk.tar.xz && \
yes | PORTABLE=true ./build.sh && \
./build_compiler_rt.sh

ENV PATH $PATH:/opt/osxcross/target/bin

ADD entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
19 changes: 19 additions & 0 deletions .github/actions/build_osx/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -eu

export RACK_DIR=${GITHUB_WORKSPACE}/Rack-SDK
export RACK_USER_DIR=${GITHUB_WORKSPACE}

export CC=x86_64-apple-darwin15-clang
export CXX=x86_64-apple-darwin15-clang++
export STRIP=x86_64-apple-darwin15-strip

git submodule update --init --recursive

curl -L https://vcvrack.com/downloads/Rack-SDK-${RACK_SDK_VERSION}.zip -o rack-sdk.zip
unzip -o rack-sdk.zip
rm rack-sdk.zip

make clean
make dist
18 changes: 18 additions & 0 deletions .github/actions/build_win/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM debian:stretch

LABEL "com.github.actions.name"="VCVRackPluginBuilder-Windows"
LABEL "com.github.actions.description"="Builds a VCV Rack plugin for Windows"
LABEL "com.github.actions.icon"="headphones"
LABEL "com.github.actions.color"="purple"

LABEL "repository"="TBD"
LABEL "homepage"="TBD"
LABEL "maintainer"="dewb"

RUN apt-get update
RUN apt-get install -y build-essential cmake curl gcc g++ git make tar unzip zip libgl1-mesa-dev libglu1-mesa-dev jq g++-mingw-w64-x86-64

ADD entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
19 changes: 19 additions & 0 deletions .github/actions/build_win/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -eu

export RACK_DIR=${GITHUB_WORKSPACE}/Rack-SDK
export RACK_USER_DIR=${GITHUB_WORKSPACE}

export CC=x86_64-w64-mingw32-gcc-posix
export CXX=x86_64-w64-mingw32-g++-posix
export STRIP=x86_64-w64-mingw32-strip

git submodule update --init --recursive

curl -L https://vcvrack.com/downloads/Rack-SDK-${RACK_SDK_VERSION}.zip -o rack-sdk.zip
unzip -o rack-sdk.zip
rm rack-sdk.zip

make clean
make dist
42 changes: 42 additions & 0 deletions .github/actions/combine_zip/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

set -eu

GITHUB_API_URL=https://api.github.com

GITHUB_TOKEN=$1

curl -o release.json \
--header "Authorization: token ${GITHUB_TOKEN}" \
--request GET \
${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${GITHUB_REF#"refs/"}

UPLOAD_URL=$(jq -r .upload_url release.json)

DOWNLOAD_LIST=$(jq -r ".assets | .[] | .url" release.json)

rm release.json

mkdir dist

echo "$DOWNLOAD_LIST" | while IFS= read -r line
do
curl -L -o $(basename $line).zip --header "Authorization: token ${GITHUB_TOKEN}" --header "Accept: application/octet-stream" --request GET $line
unzip -o $(basename $line).zip -d dist
rm $(basename $line).zip
done

PLUGIN_BUILD_SLUG=$(jq -r .slug plugin.json)
PLUGIN_BUILD_NAME=${PLUGIN_BUILD_SLUG}-$(jq -r .version plugin.json)
cd dist
zip -q -9 -r ${PLUGIN_BUILD_NAME}.zip ./${PLUGIN_BUILD_SLUG}
cd ..

ASSET_PATH=$(ls dist/*.zip)

curl -i \
--header "Authorization: token ${GITHUB_TOKEN}" \
--header "Content-Type: application/zip" \
--request POST \
--data-binary @"${ASSET_PATH}" \
${UPLOAD_URL%"{?name,label\}"}?name=${ASSET_PATH#"dist/"}
24 changes: 24 additions & 0 deletions .github/actions/upload_zip/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

set -eu

GITHUB_API_URL=https://api.github.com

GITHUB_TOKEN=$1

# Get release url
curl -o release.json \
--header "Authorization: token ${GITHUB_TOKEN}" \
--request GET \
${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${GITHUB_REF#"refs/"}

UPLOAD_URL=$(jq -r .upload_url release.json)

ASSET_PATH=$(ls dist/*.zip)

curl -i \
--header "Authorization: token ${GITHUB_TOKEN}" \
--header "Content-Type: application/zip" \
--request POST \
--data-binary @"${ASSET_PATH}" \
${UPLOAD_URL%"{?name,label\}"}?name=${ASSET_PATH#"dist/"}
18 changes: 18 additions & 0 deletions .github/workflows/buildDevelop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
branches:
- development
pull_request:
branches:
- development
name: Development
env:
RACK_SDK_VERSION: 1.1.6
jobs:
buildLinux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build Linux
uses: ./.github/actions/build_linux
42 changes: 42 additions & 0 deletions .github/workflows/buildRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
release:
types: [published]
name: Release
env:
RACK_SDK_VERSION: 1.1.6
jobs:
buildLinux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build Linux
uses: ./.github/actions/build_linux
- name: upload zip
run: sh ./.github/actions/upload_zip/script.sh ${{ secrets.GITHUB_TOKEN }}
buildWindows:
name: Build Windows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build Windows
uses: ./.github/actions/build_win
- name: upload zip
run: sh ./.github/actions/upload_zip/script.sh ${{ secrets.GITHUB_TOKEN }}
buildOsx:
name: Build OSX
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build OSX
uses: ./.github/actions/build_osx
- name: upload zip
run: sh ./.github/actions/upload_zip/script.sh ${{ secrets.GITHUB_TOKEN }}
combineDist:
name: Combine Distributions
runs-on: ubuntu-latest
needs: [buildLinux, buildWindows, buildOsx]
steps:
- uses: actions/checkout@master
- name: combine zip
run: sh ./.github/actions/combine_zip/script.sh ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Captain's Sounds VCV Rack Modules

![Release](https://github.com/captainssounds/vcv-CaptainsSounds/workflows/Development/badge.svg?branch=master) ![Development](https://github.com/captainssounds/vcv-CaptainsSounds/workflows/Development/badge.svg?branch=development)

![screeshot](./images/vcv523.png)

Modules are for [VCV Rack](https://vcvrack.com), an open-source, virtual Eurorack-style modular synthesizer.
Expand Down Expand Up @@ -51,3 +53,13 @@ Oscillator with locked pitch by octave & note. Also allows for v/oct overrides r

#### Pow
Uni-polar and Bi-polar voltage generator and attenuator


## Issues and Feedback

Bug reports and feedback are welcome: please use the [issue tracker](https://github.com/mikeallisonJS/vcv-CaptainsSounds/issues).


## Acknowledgements

The Github Actions auto-build scripts under [.github/](.github) are originally from [SubmarineFree](https://github.com/david-c14/SubmarineFree) -- thanks @david-c14 and @dewb -- find a detailed explanation [here](https://github.com/david-c14/SubmarineFree/wiki/Cross-compiling-using-github-actions).
8 changes: 4 additions & 4 deletions src/IMO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ void IMO::process(const ProcessArgs& args) {
for (int i = 0; i < numChannels; i++)
outputAV[i] = inputs[INPUT_A].getPolyVoltage(i);

int index = 2;
int index = 3;
//copy values to B outs if not connected
if (!connectedB)
index = 5;
index = 6;

for (int i = 0; i < index; i++) {
outputs[OUTPUT_1 + i].setChannels(channelsA);
Expand All @@ -29,8 +29,8 @@ void IMO::process(const ProcessArgs& args) {
for (int i = 0; i < numChannels; i++)
outputBV[i] = inputs[INPUT_B].getPolyVoltage(i);
for (int i = 0; i < 3; i++) {
outputs[OUTPUT_3 + i].setChannels(channelsB);
outputs[OUTPUT_3 + i].writeVoltages(outputBV);
outputs[OUTPUT_4 + i].setChannels(channelsB);
outputs[OUTPUT_4 + i].writeVoltages(outputBV);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Oscillator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace captainssounds {
template<typename T>
T calculateFrequencyFromA4Tuning(T octaveFromA4, T notesFromA4) {
T semitones = (octaveFromA4 * 12) + notesFromA4;
return tuning * std::pow(FREQ_SEMITONE, semitones);
return tuning * pow(FREQ_SEMITONE, semitones);
}

template<typename T>
Expand All @@ -55,7 +55,7 @@ namespace captainssounds {

template<typename T>
T sine(T phase) {
return std::sin(TWO_PI * phase);
return sin(TWO_PI * phase);
}

template<typename T>
Expand Down
2 changes: 1 addition & 1 deletion src/VBNO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void VBNO::process(const ProcessArgs& args) {
// Use Wave CV if connected 0-10v
if (inputs[WAVE_INPUT].isConnected()) {
float waveInputV = round(inputs[WAVE_INPUT].getVoltage());
float waveAdjustedV = tclamp(floor(.4f * waveInputV), 0.f, 3.f); //4 choices, 10volts
float waveAdjustedV = tclamp(floorf(.4f * waveInputV), 0.f, 3.f); //4 choices, 10volts
osc.wave = waveAdjustedV;
} else {
osc.wave = params[WAVE_PARAM].getValue();
Expand Down

0 comments on commit aea6935

Please sign in to comment.