-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d2042a3
Showing
23 changed files
with
827 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
BasedOnStyle: WebKit | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Right | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowShortBlocksOnASingleLine: true | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: AllIfsAndElse | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
BreakBeforeBraces: Allman | ||
BreakBeforeInheritanceComma: true | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeComma | ||
BreakStringLiterals: true | ||
ColumnLimit: 120 | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
Cpp11BracedListStyle: true | ||
DisableFormat: false | ||
FixNamespaceComments: true | ||
IndentCaseLabels: true | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
Language: Cpp | ||
LambdaBodyIndentation: Signature | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
PointerAlignment: Left | ||
ReferenceAlignment: Left | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesInAngles: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Auto | ||
UseTab: Never | ||
QualifierAlignment: Custom | ||
QualifierOrder: ["inline", "static", "constexpr", "type", "const", "volatile"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Checks: > | ||
*-, | ||
boost-*, | ||
bugprone-*, | ||
-bugprone-macro-parentheses, | ||
-bugprone-narrowing-conversions, | ||
cert-*, | ||
-cert-oop54-cpp, | ||
-cert-err58-cpp, | ||
clang-analyzer-*, | ||
-clang-analyzer-optin.performance.Padding, | ||
clang-diagnostics-*, | ||
concurrency-*, | ||
cppcoreguidelines-*, | ||
-cppcoreguidelines-avoid-magic-numbers, | ||
-cppcoreguidelines-macro-usage, | ||
-cppcoreguidelines-non-private-member-variables-in-classes, | ||
-cppcoreguidelines-owning-memory, | ||
-cppcoreguidelines-special-member-functions, | ||
hicpp-*, | ||
-hicpp-uppercase-literal-suffix, | ||
-hicpp-signed-bitwise, | ||
-hicpp-special-member-functions, | ||
misc-*, | ||
-misc-non-private-member-variables-in-classes, | ||
modernize-*, | ||
performance-*, | ||
readability-*, | ||
-readability-const-return-type, | ||
-readability-function-cognitive-complexity, | ||
-readability-identifier-length, | ||
-readability-magic-numbers, | ||
-readability-uppercase-literal-suffix | ||
WarningsAsErrors: "*" | ||
FormatStyle: none | ||
CheckOptions: | ||
- key: bugprone-easily-swappable-parameters.MinimumLength | ||
value: 4 | ||
- key: readability-identifier-naming.ClassCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.ClassMemberCase | ||
value: camelBack | ||
- key: readability-identifier-naming.ClassConstantCase | ||
value: camelBack | ||
- key: readability-identifier-naming.PrivateMemberPrefix | ||
value: _ | ||
- key: readability-identifier-naming.EnumCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.FunctionCase | ||
value: camelBack | ||
- key: readability-identifier-naming.GlobalConstantCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.IgnoreMainLikeFunctions | ||
value: 1 | ||
- key: readability-identifier-naming.ParameterCase | ||
value: camelBack | ||
- key: readability-identifier-naming.UnionCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.VariableCase | ||
value: camelBack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.atom | ||
.idea | ||
.vscode | ||
.vs | ||
|
||
/resources/samples | ||
/build | ||
/cmake-build-* | ||
|
||
.DS_Store | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "3rd_party/JUCE"] | ||
path = 3rd_party/JUCE | ||
url = https://github.com/juce-framework/JUCE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(app-stiggi-dj VERSION 0.1.0) | ||
|
||
# Only do these if this is the main project, | ||
# and not if it is included through add_subdirectory. | ||
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
# Caches build artifacts for faster builds | ||
find_program(CCACHE ccache) | ||
if (CCACHE) | ||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) | ||
endif () | ||
|
||
# Set C11 with no extensions enabled. Fail if the | ||
# standard is not supported. | ||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_C_STANDARD_REQUIRED ON) | ||
set(CMAKE_C_EXTENSIONS OFF) | ||
|
||
# Set C++14 with no extensions enabled. Fail if the | ||
# standard is not supported. | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
# library settings | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_CXX_VISIBILITY_PRESET hidden) | ||
set(BUILD_SHARED_LIBS OFF) | ||
|
||
# misc | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# Minimum macOS version | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11") | ||
endif () | ||
|
||
add_subdirectory(3rd_party/JUCE) | ||
|
||
juce_add_gui_app(StiggiDJ | ||
COMPANY_NAME "tobanteAudio" # Specify the name of the app's author | ||
PRODUCT_NAME "Stiggi DJ" # The name of the final executable, which can differ from the target name | ||
) | ||
|
||
target_sources(StiggiDJ | ||
PRIVATE | ||
"src/Main.cpp" | ||
"src/MainComponent.hpp" | ||
"src/MainComponent.cpp" | ||
|
||
"src/Core/Array.hpp" | ||
|
||
"src/DSP/AudioFileSource.cpp" | ||
"src/DSP/AudioFileSource.hpp" | ||
|
||
"src/UI/Component/JogWheel.cpp" | ||
"src/UI/Component/JogWheel.hpp" | ||
"src/UI/Component/Placeholder.cpp" | ||
"src/UI/Component/Placeholder.hpp" | ||
|
||
"src/UI/Section/MainSection.cpp" | ||
"src/UI/Section/MainSection.hpp" | ||
"src/UI/Section/SideBarLeft.cpp" | ||
"src/UI/Section/SideBarLeft.hpp" | ||
"src/UI/Section/SideBarRight.cpp" | ||
"src/UI/Section/SideBarRight.hpp" | ||
) | ||
|
||
target_compile_definitions(StiggiDJ | ||
PRIVATE | ||
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_gui_app` call | ||
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_gui_app` call | ||
JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:StiggiDJ,JUCE_PRODUCT_NAME>" | ||
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:StiggiDJ,JUCE_VERSION>" | ||
) | ||
|
||
target_include_directories(StiggiDJ | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/src | ||
) | ||
|
||
target_link_libraries(StiggiDJ | ||
PRIVATE | ||
juce::juce_gui_extra | ||
juce::juce_audio_basics | ||
juce::juce_audio_devices | ||
juce::juce_audio_formats | ||
PUBLIC | ||
juce::juce_recommended_config_flags | ||
juce::juce_recommended_lto_flags | ||
juce::juce_recommended_warning_flags | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export PATH := $(shell pwd)/scripts:$(PATH) | ||
|
||
BUILD_DIR ?= $(BUILD_DIR_BASE)_$(CONFIG) | ||
|
||
CLANG_FORMAT_BIN ?= clang-format | ||
CLANG_REPLACEMENTS_BIN ?= clang-apply-replacements-14 | ||
CLANG_TIDY_BIN ?= clang-tidy-14 | ||
CLANG_TIDY_ARGS = ./scripts/run-clang-tidy.py -clang-tidy-binary ${CLANG_TIDY_BIN} -clang-apply-replacements-binary ${CLANG_REPLACEMENTS_BIN} -j $(shell nproc) | ||
|
||
.PHONY: tidy-check | ||
tidy-check: | ||
${CLANG_TIDY_ARGS} -quiet -p $(BUILD_DIR) -header-filter $(shell realpath ./src) $(shell realpath ./src) | ||
|
||
.PHONY: tidy-fix | ||
tidy-fix: | ||
${CLANG_TIDY_ARGS} -fix -quiet -p $(BUILD_DIR) -header-filter $(shell realpath ./src) $(shell realpath ./src) | ||
|
||
.PHONY: docs | ||
docs: | ||
doxygen ./docs/Doxyfile | ||
|
||
.PHONY: docs-pdf | ||
docs-pdf: docs | ||
make -C cmake-build-doxygen/latex pdf | ||
cp cmake-build-doxygen/latex/refman.pdf "cmake-build-doxygen/Electrickick Developer Manual.pdf" | ||
|
||
.PHONY: coverage | ||
coverage: | ||
cmake -S . -G Ninja -B cmake-build-coverage -D CMAKE_BUILD_TYPE=Debug -D LT_ENABLE_COVERAGE=TRUE | ||
cmake --build cmake-build-coverage | ||
cd cmake-build-coverage && ctest | ||
|
||
.PHONY: coverage-html | ||
coverage-html: coverage | ||
cd cmake-build-coverage && gcovr --html --html-details --exclude-unreachable-branches -o coverage.html -r ../src -j ${shell nproc} -s . | ||
|
||
.PHONY: coverage-xml | ||
coverage-xml: coverage | ||
cd cmake-build-coverage && gcovr --xml-pretty --exclude-unreachable-branches -o coverage.xml -r ../src -j ${shell nproc} -s . | ||
|
||
.PHONY: stats | ||
stats: | ||
@cloc -by-file-by-lang --exclude-dir=3rd_party --exclude-ext=svg --vcs=git . | ||
|
||
.PHONY: format | ||
format: | ||
@find src -iname '*.hpp' -o -iname '*.h' -o -iname '*.cpp' | xargs ${CLANG_FORMAT_BIN} -i | ||
|
||
.PHONY: format-check | ||
format-check: | ||
@find src -iname '*.hpp' -o -iname '*.h' -o -iname '*.cpp' | xargs -n 1 -P 1 -I{} -t sh -c '${CLANG_FORMAT_BIN} -style=file {} | diff - {}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
#pragma once | ||
|
||
#include <juce_core/juce_core.h> | ||
|
||
namespace ta | ||
{ | ||
|
||
template<typename T> | ||
auto fillArray(T const& obj, int count) -> juce::Array<T> | ||
{ | ||
auto array = juce::Array<T>{}; | ||
array.ensureStorageAllocated(count); | ||
for (auto i{0}; i < count; ++i) { array.add(obj); } | ||
return array; | ||
} | ||
|
||
} // namespace ta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#include "AudioFileSource.hpp" | ||
|
||
namespace ta | ||
{ | ||
|
||
AudioFileSource::AudioFileSource(juce::AudioFormatManager& _formatManager) : formatManager(_formatManager) {} | ||
AudioFileSource::~AudioFileSource() {} | ||
|
||
void AudioFileSource::prepareToPlay(int samplesPerBlockExpected, double sampleRate) | ||
{ | ||
transportSource.prepareToPlay(samplesPerBlockExpected, sampleRate); | ||
resampleSource.prepareToPlay(samplesPerBlockExpected, sampleRate); | ||
} | ||
void AudioFileSource::getNextAudioBlock(juce::AudioSourceChannelInfo const& bufferToFill) | ||
{ | ||
resampleSource.getNextAudioBlock(bufferToFill); | ||
} | ||
void AudioFileSource::releaseResources() | ||
{ | ||
transportSource.releaseResources(); | ||
resampleSource.releaseResources(); | ||
} | ||
|
||
LengthAndSamplerate AudioFileSource::loadFile(juce::File audioFile) | ||
{ | ||
auto sr = 0.0; | ||
auto length = 0; | ||
auto* reader = formatManager.createReaderFor(audioFile); | ||
|
||
if (reader != nullptr) // good file! | ||
{ | ||
length = reader->lengthInSamples; | ||
sr = reader->sampleRate; | ||
std::unique_ptr<juce::AudioFormatReaderSource> newSource(new juce::AudioFormatReaderSource(reader, true)); | ||
transportSource.setSource(newSource.get(), 0, nullptr, reader->sampleRate); | ||
readerSource.reset(newSource.release()); | ||
} | ||
|
||
return LengthAndSamplerate{length, sr}; | ||
} | ||
|
||
void AudioFileSource::setGain(double gain) | ||
{ | ||
if (gain < 0 || gain > 1.0) { std::cout << "AudioFileSource::setGain gain should be between 0 and 1" << std::endl; } | ||
else { transportSource.setGain(gain); } | ||
} | ||
void AudioFileSource::setSpeed(double ratio) | ||
{ | ||
if (ratio <= 0 || ratio > 100.0) | ||
{ | ||
std::cout << "AudioFileSource::setSpeed ratio should be between 0 and 100" << std::endl; | ||
} | ||
else { resampleSource.setResamplingRatio(ratio); } | ||
} | ||
void AudioFileSource::setPosition(double posInSecs) { transportSource.setPosition(posInSecs); } | ||
|
||
void AudioFileSource::setPositionRelative(double pos) | ||
{ | ||
if (pos < 0 || pos > 1.0) | ||
{ | ||
std::cout << "AudioFileSource::setPositionRelative pos should be between 0 and 1" << std::endl; | ||
} | ||
else | ||
{ | ||
double posInSecs = transportSource.getLengthInSeconds() * pos; | ||
setPosition(posInSecs); | ||
} | ||
} | ||
|
||
void AudioFileSource::start() { transportSource.start(); } | ||
void AudioFileSource::stop() { transportSource.stop(); } | ||
|
||
double AudioFileSource::getPositionRelative() | ||
{ | ||
return transportSource.getCurrentPosition() / transportSource.getLengthInSeconds(); | ||
} | ||
|
||
} // namespace ta |
Oops, something went wrong.