Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 50 additions & 94 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,119 +2,75 @@ cmake_minimum_required(VERSION 3.22)

project(kAmp VERSION 0.0.1)

# To get started on a new GUI app, copy this entire folder (containing this file and C++ sources) to
# a convenient location, and then start making modifications. For other examples of CMakeLists for
# GUI apps, check `extras/Projucer` and `examples/DemoRunner` in the JUCE repo.

# If you've installed JUCE somehow (via a package manager, or directly using the CMake install
# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've
# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to
# include that subdirectory as part of the build.

# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system
# or
add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE

# If your app depends the VST2 SDK, perhaps to host VST2 plugins, CMake needs to be told where
# to find the SDK on your system. This setup should be done before calling `juce_add_gui_app`.

# juce_set_vst2_sdk_path(...)

# `juce_add_gui_app` adds an executable target with the name passed as the first argument
# (GuiAppExample here). This target is a normal CMake target, but has a lot of extra properties set
# up by default. This function accepts many optional arguments. Check the readme at
# `docs/CMake API.md` in the JUCE repo for the full list.
# If you've installed JUCE to your system
# find_package(JUCE CONFIG REQUIRED)
# or if JUCE is a subdirectory
add_subdirectory(JUCE)

juce_add_gui_app(kAmp
# ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon
# ICON_SMALL ...
# DOCUMENT_EXTENSIONS ... # Specify file extensions that should be associated with this app
BUNDLE_ID = "eu.k-147.kAmp"
COMPANY_NAME "K-147"
PRODUCT_NAME "kAmp"
ICON_BIG "resources/images/kamp_logo_with_background.png"
ICON_SMALL "resources/images/kamp_logo_with_background.png")
BUNDLE_ID "eu.k-147.kAmp"
COMPANY_NAME "K-147"
PRODUCT_NAME "kAmp"
ICON_BIG "resources/images/kamp_logo_with_background.png"
ICON_SMALL "resources/images/kamp_logo_with_background.png"
)

juce_generate_juce_header(kAmp)

# `target_sources` adds source files to a target. We pass the target that needs the sources as the
# first argument, then a visibility parameter for the sources which should normally be PRIVATE.
# Finally, we supply a list of source files that will be built into the target. This is a standard
# CMake command.

file(
GLOB_RECURSE
SOURCES
CONFIGURE_DEPENDS
src/*.cpp
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp)

juce_add_binary_data(ResourcesBinary
SOURCES
resources/images/background.png
resources/images/kamp_logo_with_background.png
resources/icons/account.png
resources/icons/export.png
resources/icons/mute.png
resources/icons/power.png
resources/icons/settings.png
resources/icons/sync.png
resources/icons/unmute.png
resources/icons/xmark.png
resources/icons/tuner.png
)

if(APPLE)
# Sur macOS, copie dans le bundle app (Contents/Resources)
add_custom_command(TARGET kAmp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/resources
$<TARGET_FILE_DIR:kAmp>/../Resources/resources
)
else()
# Sur Linux/Windows, copie dans le dossier de build à côté de l'exe
add_custom_command(TARGET kAmp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/resources
$<TARGET_FILE_DIR:kAmp>/resources
)
endif()

target_include_directories(kAmp PRIVATE "${CMAKE_BINARY_DIR}/juce_binarydata_ResourcesBinary/JuceLibraryCode")

file(GLOB_RECURSE RESOURCE_FILES "${CMAKE_SOURCE_DIR}/resources/*.*")

foreach(RESOURCE_FILE IN LISTS RESOURCE_FILES)
file(RELATIVE_PATH REL_PATH "${CMAKE_SOURCE_DIR}/resources" "${RESOURCE_FILE}")
set(DEST_PATH "${CMAKE_BINARY_DIR}/resources/${REL_PATH}")
add_custom_command(
TARGET kAmp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${RESOURCE_FILE}" "${DEST_PATH}"
)
endforeach()

target_sources(kAmp
PRIVATE
${SOURCES})

target_include_directories(kAmp
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_sources(kAmp PRIVATE ${SOURCES})

# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
# of compile definitions to switch certain features on/off, so if there's a particular feature you
# need that's not on by default, check the module header for the correct flag to set here. These
# definitions will be visible both to your code, and also the JUCE module code, so for new
# definitions, pick unique names that are unlikely to collide! This is a standard CMake command.
target_include_directories(kAmp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)

target_compile_definitions(kAmp
PRIVATE
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
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_IOS=1
PRIVATE
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
#JUCE_IOS=1
JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:kAmp,JUCE_PRODUCT_NAME>"
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:kAmp,JUCE_VERSION>")

# If your target needs extra binary assets, you can add them here. The first argument is the name of
# a new static library target that will include all the binary resources. There is an optional
# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally,
# the SOURCES argument should be followed by a list of source files that should be built into the
# static library. These source files can be of any kind (wav data, images, fonts, icons etc.).
# Conversion to binary-data will happen when your target is built.

# juce_add_binary_data(GuiAppData SOURCES ...)

# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here,
# we're linking our executable target to the `juce::juce_gui_extra` module. Inter-module
# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be
# linked automatically. If we'd generated a binary data target above, we would need to link to it
# here too. This is a standard CMake command.
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:kAmp,JUCE_VERSION>"
)

target_link_libraries(kAmp
PRIVATE
# GuiAppData # If we'd created a binary data target, we'd link to it here
PRIVATE
juce::juce_audio_basics
juce::juce_audio_utils
juce::juce_gui_extra
juce::juce_dsp
PUBLIC
ResourcesBinary
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
juce::juce_recommended_warning_flags
)


2 changes: 1 addition & 1 deletion JUCE
Submodule JUCE updated 393 files
1 change: 1 addition & 0 deletions include/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class MainComponent final : public AudioAppComponent {

private:


ImageComponent backgroundImage;

/**
Expand Down
14 changes: 6 additions & 8 deletions src/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ MainComponent::MainComponent(const Manager& manager):
topMenuBarComponent(this->deviceManager, &isSoundMuted, &tuningFunction), manager(manager) {
setAudioChannels(2, 2);

const Image background = ResourceManager::loadImage("resources/images/background.png");
if (background.isValid()) {
backgroundImage.setImage(background);
backgroundImage.setImagePlacement(RectanglePlacement::stretchToFit);
addAndMakeVisible(backgroundImage);
} else {
DBG("Error : resources/images/background.png not found.");
}

juce::Image img = juce::ImageFileFormat::loadFrom(BinaryData::background_png, BinaryData::background_pngSize);
backgroundImage.setImage(img);

pedalboardContainer.setViewedComponent(&pedalboardComponent, true);
pedalboardContainer.setScrollBarsShown(true, false);

addAndMakeVisible(backgroundImage);
addAndMakeVisible(pedalboardContainer);
addAndMakeVisible(topMenuBarComponent);
addAndMakeVisible(bottomMenuBarComponent);
Expand Down Expand Up @@ -69,3 +65,5 @@ void MainComponent::getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill
}

void MainComponent::releaseResources() {}


104 changes: 43 additions & 61 deletions src/components/TopMenuBarComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,38 @@
#include "ResourceManager.h"
#include "SettingsComponent.h"
#include "TopMenuBarComponent.h"

TopMenuBarComponent::TopMenuBarComponent(AudioDeviceManager& deviceManager, bool* isSoundMuted, std::function<void(const AudioSourceChannelInfo&)>* tuningFunction) {
this->isSoundMuted = isSoundMuted;
this->tuningFunction = tuningFunction;
Image settingsImage = ResourceManager::loadImage("resources/icons/settings.png");
if (settingsImage.isValid()) {
settingsButton.setImages(true, true, true, settingsImage, 1.0f, {}, settingsImage, 1.0f, {},settingsImage, 1.0f, {});
settingsButton.setSize(settingsImage.getWidth(), settingsImage.getHeight());
addAndMakeVisible(settingsButton);
} else {
DBG("Erreur : image settings.png introuvable ou invalide.");
}

Image accountImage = ResourceManager::loadImage(
"resources/icons/account.png");
if (accountImage.isValid()) {
accountButton.setImages(true, true, true, accountImage, 1.0f, {},
accountImage, 1.0f, {}, accountImage, 1.0f, {});
accountButton.setSize(accountImage.getWidth(),
accountImage.getHeight());
addAndMakeVisible(accountButton);
} else {
DBG("Erreur : image account.png introuvable ou invalide.");
}

Image muteImage = ResourceManager::loadImage("resources/icons/unmute.png");
if (muteImage.isValid()) {
muteButton.setImages(true, true, true, muteImage, 1.0f, {}, muteImage,
1.0f, {}, muteImage, 1.0f, {});
muteButton.setSize(muteImage.getWidth(), muteImage.getHeight());
addAndMakeVisible(muteButton);
} else {
DBG("Erreur : image mute.png introuvable ou invalide.");
}

Image tunerImage = ResourceManager::loadImage("resources/icons/tuner.png");
if (tunerImage.isValid()) {
tunerButton.setImages(true, true, true, tunerImage, 1.0f, {}, tunerImage, 1.0f, {}, tunerImage, 1.0f, {});
tunerButton.setSize(tunerImage.getWidth(), tunerImage.getHeight());
addAndMakeVisible(tunerButton);
} else {
DBG("Erreur : image tuner.png introuvable ou invalide.");
}
#include "ResourceManager.h"
#include "BinaryData.h"

TopMenuBarComponent::TopMenuBarComponent(AudioDeviceManager& deviceManager,
bool* isMuted, std::function<void(const AudioSourceChannelInfo&)>* tuningFunction) {
this->isSoundMuted = isMuted;
this->tuningFunction = tuningFunction;

juce::Image settingsImage = juce::ImageFileFormat::loadFrom(BinaryData::settings_png, BinaryData::settings_pngSize);
settingsButton.setImages(true, true, true, settingsImage, 1.0f, {},
settingsImage, 1.0f, {}, settingsImage, 1.0f,
{});
addAndMakeVisible(settingsButton);


juce::Image accountImage = juce::ImageFileFormat::loadFrom(BinaryData::account_png, BinaryData::account_pngSize);
accountButton.setImages(true, true, true, accountImage, 1.0f, {},
accountImage, 1.0f, {}, accountImage, 1.0f,
{});
addAndMakeVisible(accountButton);

juce::Image muteImage = juce::ImageFileFormat::loadFrom(BinaryData::mute_png, BinaryData::mute_pngSize);
muteButton.setImages(true, true, true, muteImage, 1.0f, {},
muteImage, 1.0f, {}, muteImage, 1.0f,
{});
addAndMakeVisible(muteButton);


juce::Image tunerImage = juce::ImageFileFormat::loadFrom(BinaryData::tuner_png, BinaryData::tuner_pngSize);
tunerButton.setImages(true, true, true, tunerImage, 1.0f, {}, tunerImage, 1.0f, {}, tunerImage, 1.0f, {});
tunerButton.setSize(tunerImage.getWidth(), tunerImage.getHeight());
addAndMakeVisible(tunerButton);

#if !JUCE_IOS
settingsButton.onClick = [this, &deviceManager] {
Expand Down Expand Up @@ -90,6 +79,7 @@ void TopMenuBarComponent::paint(Graphics& g) {
g.drawText("kAmp", gap, topMargin, 80, 24, Justification::left);
}


void TopMenuBarComponent::resized() {
auto* mainWindow = getTopLevelComponent();
if (mainWindow == nullptr) return;
Expand Down Expand Up @@ -139,25 +129,17 @@ void TopMenuBarComponent::openAccountPopup() {

void TopMenuBarComponent::toggleMute() {
if (*this->isSoundMuted) {
Image muteImage = ResourceManager::loadImage(
"resources/icons/unmute.png");
if (muteImage.isValid()) {
muteButton.setImages(false, true, true, muteImage, 1.0f, {},
muteImage, 1.0f, {}, muteImage, 1.0f, {});
addAndMakeVisible(muteButton);
} else {
DBG("Erreur : image mute.png introuvable ou invalide.");
}
juce::Image muteImage = juce::ImageFileFormat::loadFrom(BinaryData::unmute_png, BinaryData::unmute_pngSize);
muteButton.setImages(false, true, true, muteImage, 1.0f, {},
muteImage, 1.0f, {}, muteImage, 1.0f,
{});
addAndMakeVisible(muteButton);
} else {
Image muteImage =
ResourceManager::loadImage("resources/icons/mute.png");
if (muteImage.isValid()) {
muteButton.setImages(false, true, true, muteImage, 1.0f, {},
muteImage, 1.0f, {}, muteImage, 1.0f, {});
addAndMakeVisible(muteButton);
} else {
DBG("Erreur : image mute.png introuvable ou invalide.");
}
juce::Image muteImage = juce::ImageFileFormat::loadFrom(BinaryData::mute_png, BinaryData::mute_pngSize);
muteButton.setImages(false, true, true, muteImage, 1.0f, {},
muteImage, 1.0f, {}, muteImage, 1.0f,
{});
addAndMakeVisible(muteButton);
}
*this->isSoundMuted = !*this->isSoundMuted;
}
Expand Down
21 changes: 8 additions & 13 deletions src/components/effects/BasePedalComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,14 @@ void BasePedalComponent::initializePedal() {
pedalLabel->setJustificationType(Justification::centred);
pedalLabel->setFont(FontOptions(30.0f, Font::bold));

Image powerImage = ResourceManager::loadImage("resources/icons/power.png");
if (powerImage.isValid()) {
enablePedalButton.setImages(true, true, true,
powerImage, 1.0f, {},
powerImage, 1.0f, {},
powerImage, 1.0f, {});
enablePedalButton.onClick = [this] {
this->onEnableButtonClicked();
};
addAndMakeVisible(enablePedalButton);
} else {
DBG("Erreur : image power.png introuvable ou invalide.");
}
juce::Image powerImage = juce::ImageFileFormat::loadFrom(BinaryData::power_png, BinaryData::power_pngSize);
enablePedalButton.setImages(true, true, true, powerImage, 1.0f, {},
powerImage, 1.0f, {}, powerImage, 1.0f,
{});
enablePedalButton.onClick = [this] {
this->onEnableButtonClicked();
};
addAndMakeVisible(enablePedalButton);

addAndMakeVisible(*pedalLabel);
addAndMakeVisible(*isEnabledIndicator);
Expand Down
Empty file.