Skip to content

Commit

Permalink
Merge pull request #23 from philippekocher/juce-update
Browse files Browse the repository at this point in the history
Juce update
  • Loading branch information
philippekocher committed Jan 10, 2024
2 parents bfd00a4 + e69d746 commit b9f916c
Show file tree
Hide file tree
Showing 34 changed files with 229 additions and 192 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: CI

on:
pull_request:
branches:
- master
branches: [ "master" ]

env:
BUILD_TYPE: Release
Expand Down Expand Up @@ -34,10 +33,9 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Checkout submodules
run: git submodule update --init --recursive --depth 1
uses: actions/checkout@v4
with:
submodules: recursive

- if: ${{ runner.os == 'Linux' }}
name: Install JUCE dependencies (Linux only)
Expand All @@ -47,37 +45,37 @@ jobs:
sudo apt-get install -y g++ libgtk-3-dev libfreetype6-dev libx11-dev libxinerama-dev libxrandr-dev libxcursor-dev mesa-common-dev libasound2-dev freeglut3-dev libxcomposite-dev libcurl4-openssl-dev
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/${{ env.BUILD_DIR }}
run: cmake -E make_directory ${{github.workspace}}/${{ env.BUILD_DIR }}

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}
shell: bash
run: cmake --build . --config $BUILD_TYPE

# upload artifacts
- name: Zip Polytempo Network
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}
run: |
cmake -E tar cfv "${{ env.PROJECT_NAME_NETWORK }}.zip" --format=zip "${{env.PROJECT_NAME_NETWORK}}${{matrix.extension}}"
- name: Zip Polytempo Composer
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}
run: |
cmake -E tar cfv "${{ env.PROJECT_NAME_COMPOSER }}.zip" --format=zip "${{env.PROJECT_NAME_COMPOSER}}${{matrix.extension}}"
- name: Upload Artifact Polytempo Network
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
path: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}/${{env.PROJECT_NAME_NETWORK}}.zip
path: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}/${{env.PROJECT_NAME_NETWORK}}.zip
name: ${{ env.PROJECT_NAME_NETWORK }}_${{ matrix.artifact }}_CI

- name: Upload Artifact Polytempo Composer
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
path: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}/${{env.PROJECT_NAME_COMPOSER}}.zip
path: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}/${{env.PROJECT_NAME_COMPOSER}}.zip
name: ${{ env.PROJECT_NAME_COMPOSER }}_${{ matrix.artifact }}_CI
102 changes: 52 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9].[0-9]-**'
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+'

workflow_dispatch:
inputs:
version:
description: Release Version
default: 0.0.1
default: 0.0.0.1
required: true

env:
Expand All @@ -28,36 +28,25 @@ jobs:
name: Prepare
runs-on: ubuntu-latest
outputs:
release_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.VERSION }}
versionlong: ${{ steps.get_version.outputs.VERSIONLONG }}
hasTweak: ${{ steps.get_version.outputs.HASTWEAK }}
steps:
- name: Get the version
id: get_version
shell: bash
run: |
[ "${{github.event_name}}" == "workflow_dispatch" ] && v=${{github.event.inputs.version}} || v=${GITHUB_REF/refs\/tags\//}
va=${v}
vb=${v%-*}
echo ::set-output name=VERSIONLONG::${va}
echo ::set-output name=VERSION::${vb}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: ${{ steps.get_version.outputs.VERSION != steps.get_version.outputs.VERSIONLONG }}
if [[ ${va} =~ [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]]; then hasTweak=true; else hasTweak=false; fi
echo "HASTWEAK=${hasTweak}" >> "$GITHUB_OUTPUT"
echo "VERSION=${va}" >> "$GITHUB_OUTPUT"
build:
needs: prepare
name: ${{ matrix.artifact }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: ${{ needs.prepare.outputs.version == needs.prepare.outputs.versionlong }} # allow prereleases to be partly built
fail-fast: ${{ needs.prepare.outputs.hasTweak == false }} # allow prereleases to be partly built
matrix:
os: [windows-2019, ubuntu-latest, macos-latest]
include:
Expand All @@ -73,11 +62,10 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Checkout submodules
run: git submodule update --init --recursive --depth 1

uses: actions/checkout@v4
with:
submodules: recursive

- name: Set Project Version
shell: bash
run: |
Expand All @@ -92,47 +80,61 @@ jobs:
sudo apt-get install -y g++ libgtk-3-dev libfreetype6-dev libx11-dev libxinerama-dev libxrandr-dev libxcursor-dev mesa-common-dev libasound2-dev freeglut3-dev libxcomposite-dev libcurl4-openssl-dev
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/${{ env.BUILD_DIR }}
run: cmake -E make_directory ${{github.workspace}}/${{ env.BUILD_DIR }}

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}
shell: bash
run: cmake --build . --config $BUILD_TYPE

- name: Zip Polytempo Network
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}
run: |
cmake -E tar cfv "${{ env.PROJECT_NAME_NETWORK }}.zip" --format=zip "${{env.PROJECT_NAME_NETWORK}}${{matrix.extension}}"
cmake -E tar cfv "${{ env.PROJECT_NAME_NETWORK }}_${{ matrix.artifact }}_${{ needs.prepare.outputs.version }}.zip" --format=zip "${{env.PROJECT_NAME_NETWORK}}${{matrix.extension}}"
- name: Zip Polytempo Composer
working-directory: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}
working-directory: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}
run: |
cmake -E tar cfv "${{ env.PROJECT_NAME_COMPOSER }}.zip" --format=zip "${{env.PROJECT_NAME_COMPOSER}}${{matrix.extension}}"
cmake -E tar cfv "${{ env.PROJECT_NAME_COMPOSER }}_${{ matrix.artifact }}_${{ needs.prepare.outputs.version }}.zip" --format=zip "${{env.PROJECT_NAME_COMPOSER}}${{matrix.extension}}"
# upload assets
- name: Upload Release Asset (Polytempo Network)
id: upload-release-asset-network
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifact Polytempo Network
uses: actions/upload-artifact@v3
with:
upload_url: ${{ needs.prepare.outputs.release_url }}
asset_path: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}/${{env.PROJECT_NAME_NETWORK}}.zip
asset_name: ${{env.PROJECT_NAME_NETWORK}}_${{ matrix.artifact }}_${{ needs.prepare.outputs.versionlong }}.zip
asset_content_type: application/x-executable

- name: Upload Release Asset (Polytempo Composer)
id: upload-release-asset-composer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.NETWORK_DIR}}/${{ env.PROJECT_NAME_NETWORK }}_artefacts/${{ env.BUILD_TYPE }}/*.zip
name: ${{ env.PROJECT_NAME_NETWORK }}_${{ matrix.artifact }}_${{ needs.prepare.outputs.version }}

- name: Upload Artifact Polytempo Composer
uses: actions/upload-artifact@v3
with:
path: ${{github.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}/*.zip
name: ${{ env.PROJECT_NAME_COMPOSER }}_${{ matrix.artifact }}_${{ needs.prepare.outputs.version }}

publish:
name: Publish Release
needs: [prepare, build]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts

- name: Show content tree
shell: bash
run: |
find . | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"
- name: Release
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ needs.prepare.outputs.release_url }}
asset_path: ${{runner.workspace}}/${{ env.BUILD_DIR }}/${{env.COMPOSER_DIR}}/${{ env.PROJECT_NAME_COMPOSER }}_artefacts/${{ env.BUILD_TYPE }}/${{env.PROJECT_NAME_COMPOSER}}.zip
asset_name: ${{env.PROJECT_NAME_COMPOSER}}_${{ matrix.artifact }}_${{ needs.prepare.outputs.versionlong }}.zip
asset_content_type: application/x-executable
name: ${{ needs.prepare.outputs.version }}
prerelease: ${{ needs.prepare.outputs.hasTweak }}
files: |
artifacts/*/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Exclude the build directory
build/
build.*/
build-*/

# Exclude OS X folder attributes
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "JUCE"]
path = JUCE
url = https://github.com/juce-framework/JUCE
branch = main
[submodule "min-api"]
path = Max/source/min-api
url = https://github.com/Cycling74/min-api.git
Expand Down
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
cmake_minimum_required(VERSION 3.12)

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OSX deployment version")
cmake_minimum_required(VERSION 3.22)

project(Polytempo)

if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OSX deployment version")
if(XCODE_VERSION VERSION_GREATER_EQUAL 15)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-ld_classic")
message("Xcode ${XCODE_VERSION} detected, using old linker style")
endif()
endif()

# Disable MSVC pragma warning
if ( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4068")
Expand Down
2 changes: 1 addition & 1 deletion JUCE
Submodule JUCE updated 2672 files
3 changes: 2 additions & 1 deletion POLYTEMPO COMPOSER/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ target_compile_definitions(PolytempoComposer PRIVATE
JUCE_USE_CURL=0
JUCE_WEB_BROWSER=0
JUCE_MODAL_LOOPS_PERMITTED=1
POLYTEMPO_COMPOSER=1)
POLYTEMPO_COMPOSER=1
JUCE_SILENCE_XCODE_15_LINKER_WARNING=1)


juce_add_binary_data(PolytempoComposerData SOURCES
Expand Down
3 changes: 2 additions & 1 deletion POLYTEMPO NETWORK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ target_compile_definitions(PolytempoNetwork PRIVATE
JUCE_USE_CURL=0
JUCE_WEB_BROWSER=0
JUCE_MODAL_LOOPS_PERMITTED=1
POLYTEMPO_NETWORK=1)
POLYTEMPO_NETWORK=1
JUCE_SILENCE_XCODE_15_LINKER_WARNING=1)


juce_add_binary_data(PolytempoNetworkData SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void Polytempo_ComposerApplication::initialise(const String& commandLine)

// scheduler
Polytempo_ScoreScheduler::getInstance()->setEngine(new Polytempo_ComposerEngine);
Polytempo_EventScheduler::getInstance()->startThread(5); // priority between 0 and 10
Polytempo_EventScheduler::getInstance()->startThread(Thread::Priority::normal);

// network
oscSender.reset(new Polytempo_OSCSender());
Expand All @@ -44,7 +44,7 @@ void Polytempo_ComposerApplication::initialise(const String& commandLine)
#if (! JUCE_DEBUG)
// contact web server
URL url = URL("https://polytempo.zhdk.ch/stats/log.php?application="+getApplicationName()+"&version="+getApplicationVersion()+"&os="+SystemStats::getOperatingSystemName()+"&user="+SystemStats::getFullUserName());
auto stream = url.createInputStream(true);
auto stream = url.createInputStream(URL::InputStreamOptions(URL::ParameterHandling::inPostData));
#endif

if (File::isAbsolutePath(commandLine.unquoted()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void Polytempo_NetworkApplication::initialise(const String& commandLine)

// scheduler
Polytempo_ScoreScheduler::getInstance()->setEngine(new Polytempo_NetworkEngine());
Polytempo_EventScheduler::getInstance()->startThread(8); // priority between 0 and 10
Polytempo_EventScheduler::getInstance()->startThread(Thread::Priority::high);

// create network connection
oscListener.reset(new Polytempo_OSCListener(POLYTEMPO_NETWORK_PORT_APP));
Expand All @@ -60,10 +60,10 @@ void Polytempo_NetworkApplication::initialise(const String& commandLine)
if(Polytempo_StoredPreferences::getInstance()->getProps().getBoolValue("checkForNewVersion"))
Polytempo_LatestVersionChecker::getInstance()->checkForNewVersion(false);

#if (! JUCE_DEBUG)
#if (! JUCE_DEBUG)
// contact web server
URL url = URL("https://polytempo.zhdk.ch/stats/log.php?application="+getApplicationName()+"&version="+getApplicationVersion()+"&os="+SystemStats::getOperatingSystemName()+"&user="+SystemStats::getFullUserName());
auto stream = url.createInputStream(true);
auto stream = url.createInputStream(URL::InputStreamOptions(URL::ParameterHandling::inPostData));
#endif

if (File::isAbsolutePath(commandLine.unquoted()))
Expand Down
4 changes: 2 additions & 2 deletions Source/Application/Polytempo_LatestVersionChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void Polytempo_LatestVersionChecker::checkForNewVersion(bool userInteraction)
if (!isThreadRunning())
{
showAlert = userInteraction;
startThread(3);
startThread(Priority::background);
}
}

Expand Down Expand Up @@ -85,7 +85,7 @@ void Polytempo_LatestVersionChecker::run()
bool Polytempo_LatestVersionChecker::fetchFromUpdateServer()
{
URL serverURL ("https://api.github.com/repos/philippekocher/polytempo/releases/latest");
std::unique_ptr<InputStream> inStream(serverURL.createInputStream (false, nullptr, nullptr, {}, 5000));
std::unique_ptr<InputStream> inStream(serverURL.createInputStream (URL::InputStreamOptions(URL::ParameterHandling::inAddress).withConnectionTimeoutMs(5000)));

if(inStream == nullptr)
return false;
Expand Down
4 changes: 2 additions & 2 deletions Source/Audio+Midi/Polytempo_AudioClick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SineWaveVoice : public SynthesiserVoice
double cyclesPerSecond = MidiMessage::getMidiNoteInHertz(midiNoteNumber);
double cyclesPerSample = cyclesPerSecond / getSampleRate();

angleDelta = cyclesPerSample * 2.0 * double_Pi;
angleDelta = cyclesPerSample * 2.0 * MathConstants<double>::pi;
}

void stopNote(float /*velocity*/, bool /*allowTailOff*/) override
Expand Down Expand Up @@ -207,7 +207,7 @@ void Polytempo_AudioClick::writeClickforEvent(Polytempo_Event* event, AudioBuffe
double currentAngle = 0;
double cyclesPerSecond = MidiMessage::getMidiNoteInHertz(pitch);
double cyclesPerSample = cyclesPerSecond / sampleRate;
double angleDelta = cyclesPerSample * 2.0 * double_Pi;
double angleDelta = cyclesPerSample * 2.0 * MathConstants<double>::pi;
float sig;

int sample = int(event->getTime() * 0.001 * sampleRate + sampleOffset);
Expand Down

0 comments on commit b9f916c

Please sign in to comment.