diff --git a/.github/workflows/cmake.yaml b/.github/workflows/cmake.yaml new file mode 100644 index 0000000..b5cad3a --- /dev/null +++ b/.github/workflows/cmake.yaml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + + workflow_dispatch: + +jobs: + build_and_test: + name: Test plugin on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # show all errors for each platform (vs. cancel jobs on error) + matrix: + os: [macOS-latest] # TODO: enable other OSes [ubuntu-latest, windows-2019, macOS-latest] + + steps: + - name: Get latest CMake + uses: lukka/get-cmake@latest + + - name: Get latest Ninja + uses: seanmiddleditch/gha-setup-ninja@v3 + + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Init repo + shell: bash + run: ./repo-init.sh + + - name: Configure Build (Ninja) + shell: bash + run: cmake -B build-ninja -S . -G Ninja + + - name: Build CMake (Ninja) + shell: bash + run: cmake --build build-ninja \ No newline at end of file diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 0000000..949a5a6 --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,13 @@ +name: Check clang-format +on: [push, pull_request] +jobs: + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.10.2 + with: + clang-format-version: '13' + check-path: 'src' \ No newline at end of file diff --git a/src/audio/tflite/InferencePipeline.cpp b/src/audio/tflite/InferencePipeline.cpp index 9dba192..5d0e593 100644 --- a/src/audio/tflite/InferencePipeline.cpp +++ b/src/audio/tflite/InferencePipeline.cpp @@ -35,21 +35,21 @@ InferencePipeline::~InferencePipeline() {} void InferencePipeline::prepareToPlay (double sr, int samplesPerBlock) { sampleRate = sr; - + // Calculate the hopsize and framesize of the model at the // user's sample rate in order to load the holding input buffer. - + // The frame size is the amount that is copied for downsampling and is // independent of the amount that is removed from the buffer after processing (hopsize). // Use ceil to ensure there are enough samples to correctly perform downsampling later. userFrameSize = static_cast (ceil (sampleRate * kModelFrameSize / kModelSampleRate_Hz)); - + // If the hopsize of the model does not convert evenly to the user's sample rate, logic // must be written to handle this when advancing the pointer in the holding input buffer. // E.g. 44100 * 320 / 16000 = 882 // As is, this works with standard sample rates of 44.1k, 48k, 88.2k, 96k, 176.4k and 192k. userHopSize = static_cast (sampleRate * kModelHopSize / kModelSampleRate_Hz); - + DBG ("User Sample Rate: " << sampleRate); DBG ("User Frame Size: " << userFrameSize); DBG ("User Hop Size: " << userHopSize);