Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux support #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
36 changes: 26 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,37 @@ elseif (WIN32)
MAP_IMPORTED_CONFIG_MINSIZEREL Release
MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release
)
elseif (UNIX)
set_property(TARGET onnxruntime PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/ThirdParty/onnxruntime/lib/libonnxruntime.a)
endif ()


target_include_directories("${BaseTargetName}" PRIVATE ${CMAKE_CURRENT_LIST_DIR}/ThirdParty/onnxruntime/include)

target_link_libraries(${BaseTargetName}
PRIVATE
juce::juce_audio_utils
juce::juce_dsp
BasicPitchCNN
onnxruntime
bin_data
PUBLIC
juce_recommended_config_flags
juce_recommended_lto_flags)
if (UNIX AND NOT APPLE)
target_link_libraries(${BaseTargetName}
Copy link

@dromer dromer Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're mixing tabs and spaces here causing uneven formatting.

The rest of the code uses space, so lets follow the same here.

PRIVATE
juce::juce_audio_utils
juce::juce_dsp
BasicPitchCNN
onnxruntime
bin_data
PUBLIC
juce_recommended_config_flags
)
else ()
target_link_libraries(${BaseTargetName}
PRIVATE
juce::juce_audio_utils
juce::juce_dsp
BasicPitchCNN
onnxruntime
bin_data
PUBLIC
juce_recommended_config_flags
juce_recommended_lto_flags
)
endif ()
# juce_recommended_warning_flags)

if (BUILD_UNIT_TESTS)
Expand Down
2 changes: 1 addition & 1 deletion Lib/Components/Knob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void Knob::paint(Graphics& g)

mSlider.setAlpha(alpha);
g.setColour(juce::Colours::black.withAlpha(alpha));
g.setFont(LABEL_FONT);
g.setFont(UIFonts::get().LABEL_FONT());

if (!mIsMouseOver || !isEnabled()) {
g.drawMultiLineText(mLabel, 0, 73, 66, juce::Justification::centred, 0.0f);
Expand Down
2 changes: 1 addition & 1 deletion Lib/Components/MinMaxNoteSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void MinMaxNoteSlider::resized()
void MinMaxNoteSlider::paint(Graphics& g)
{
g.setColour(juce::Colours::black);
g.setFont(DROPDOWN_FONT);
g.setFont(UIFonts::get().DROPDOWN_FONT());

g.drawText(NoteUtils::midiNoteToStr(int(mSlider.getMinValue())),
Rectangle<int>(0, 0, 22, 12),
Expand Down
2 changes: 1 addition & 1 deletion Lib/Components/QuantizeForceSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void QuantizeForceSlider::resized()
void QuantizeForceSlider::paint(Graphics& g)
{
g.setColour(juce::Colours::black);
g.setFont(DROPDOWN_FONT);
g.setFont(UIFonts::get().DROPDOWN_FONT());

g.drawText(
std::to_string(int(mSlider.getValue())), Rectangle<int>(133, 0, 23, 17), juce::Justification::centredRight);
Expand Down
11 changes: 11 additions & 0 deletions Lib/Components/UIDefines.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "UIDefines.h"

UIFonts* UIFonts::fts = nullptr;;

UIFonts& UIFonts::get() {
if (nullptr == fts) {
fts = new UIFonts();
}

return *fts;
}
38 changes: 25 additions & 13 deletions Lib/Components/UIDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,32 @@
#include "BinaryData.h"

// Fonts
const juce::Typeface::Ptr MONTSERRAT_BOLD =
juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratBold_ttf, BinaryData::MontserratBold_ttfSize);

const juce::Typeface::Ptr MONTSERRAT_SEMIBOLD =
juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratSemiBold_ttf, BinaryData::MontserratSemiBold_ttfSize);

const juce::Typeface::Ptr MONTSERRAT_REGULAR =
juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratRegular_ttf, BinaryData::MontserratRegular_ttfSize);

const Font TITLE_FONT = Font(MONTSERRAT_BOLD).withPointHeight(18.0f);
const Font LARGE_FONT = Font(MONTSERRAT_BOLD).withPointHeight(20.0f);
const Font LABEL_FONT = Font(MONTSERRAT_SEMIBOLD).withPointHeight(10.0f);
const Font DROPDOWN_FONT = Font(MONTSERRAT_REGULAR).withPointHeight(10.0f);
const Font BUTTON_FONT = Font(MONTSERRAT_BOLD).withPointHeight(12.0f);
class UIFonts {
public:
static UIFonts& get();

Font TITLE_FONT() { return Font(pMONTSERRAT_BOLD).withPointHeight(18.0f); }
Font LARGE_FONT() { return Font(pMONTSERRAT_BOLD).withPointHeight(20.0f); }
Font LABEL_FONT() { return Font(pMONTSERRAT_SEMIBOLD).withPointHeight(10.0f); }
Font DROPDOWN_FONT() { return Font(pMONTSERRAT_REGULAR).withPointHeight(10.0f); }
Font BUTTON_FONT() { return Font(pMONTSERRAT_BOLD).withPointHeight(12.0f); }
juce::Typeface::Ptr MONTSERRAT_BOLD() { return pMONTSERRAT_BOLD; }
juce::Typeface::Ptr MONTSERRAT_SEMIBOLD() { return pMONTSERRAT_SEMIBOLD; }
juce::Typeface::Ptr MONTSERRAT_REGULAR() { return pMONTSERRAT_REGULAR; }
protected:
UIFonts() :
pMONTSERRAT_BOLD(juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratBold_ttf, BinaryData::MontserratBold_ttfSize)),
pMONTSERRAT_SEMIBOLD(juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratSemiBold_ttf, BinaryData::MontserratSemiBold_ttfSize)),
pMONTSERRAT_REGULAR(juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratRegular_ttf, BinaryData::MontserratRegular_ttfSize))
{ }
static UIFonts* fts;

private:
juce::Typeface::Ptr pMONTSERRAT_BOLD;
juce::Typeface::Ptr pMONTSERRAT_SEMIBOLD;
juce::Typeface::Ptr pMONTSERRAT_REGULAR;
};

// Colors
static const juce::Colour BLACK(juce::uint8(14), juce::uint8(14), juce::uint8(14));
Expand Down
2 changes: 1 addition & 1 deletion NeuralNote/PluginSources/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ NeuralNoteEditor::NeuralNoteEditor(NeuralNoteAudioProcessor& p)
addAndMakeVisible(*mMainView);
setSize(1000, 640);

getLookAndFeel().setDefaultSansSerifTypeface(MONTSERRAT_REGULAR);
getLookAndFeel().setDefaultSansSerifTypeface(UIFonts::get().MONTSERRAT_REGULAR());

mMainView->setLookAndFeel(&mNeuralNoteLnF);
}
Expand Down
2 changes: 1 addition & 1 deletion NeuralNote/Source/Components/AudioRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void AudioRegion::paint(Graphics& g)
g.fillRoundedRectangle(getLocalBounds().toFloat(), 4.0f);

g.setColour(BLACK);
g.setFont(LARGE_FONT);
g.setFont(UIFonts::get().LARGE_FONT());

if (mIsFileOver)
g.drawText("YUMMY!", getLocalBounds(), juce::Justification::centred);
Expand Down
2 changes: 1 addition & 1 deletion NeuralNote/Source/Components/MidiFileDrag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void MidiFileDrag::paint(Graphics& g)
g.fillRoundedRectangle(getLocalBounds().toFloat(), 4.0f);

g.setColour(BLACK);
g.setFont(LABEL_FONT);
g.setFont(UIFonts::get().LABEL_FONT());
g.drawText("DRAG THE MIDI FILE FROM HERE", getLocalBounds(), juce::Justification::centred);
}

Expand Down
2 changes: 1 addition & 1 deletion NeuralNote/Source/Components/MidiFileDrag.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MidiFileDrag : public Component
private:
NeuralNoteAudioProcessor* mProcessor;

juce::File mTempDirectory = juce::File::getSpecialLocation(juce::File::tempDirectory);
juce::File mTempDirectory = juce::File::getSpecialLocation(juce::File::tempDirectory).getChildFile("neuralnote");

MidiFileWriter mMidiFileWriter;
};
Expand Down
8 changes: 4 additions & 4 deletions NeuralNote/Source/Components/NeuralNoteLNF.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class NeuralNoteLNF : public juce::LookAndFeel_V4
public:
NeuralNoteLNF();

Font getComboBoxFont(ComboBox& /*box*/) override { return LABEL_FONT; }
Font getComboBoxFont(ComboBox& /*box*/) override { return UIFonts::get().LABEL_FONT(); }

Font getPopupMenuFont() override { return LABEL_FONT; }
Font getPopupMenuFont() override { return UIFonts::get().LABEL_FONT(); }

Font getTextButtonFont(TextButton&, int buttonHeight) override { return LARGE_FONT; };
Font getTextButtonFont(TextButton&, int buttonHeight) override { return UIFonts::get().LARGE_FONT(); };

Font getLabelFont(juce::Label&) override { return DROPDOWN_FONT; };
Font getLabelFont(juce::Label&) override { return UIFonts::get().DROPDOWN_FONT(); };

void drawRotarySlider(Graphics&,
int x,
Expand Down
2 changes: 1 addition & 1 deletion NeuralNote/Source/Components/NeuralNoteMainView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void NeuralNoteMainView::paint(Graphics& g)
auto background_image = juce::ImageCache::getFromMemory(BinaryData::background_png, BinaryData::background_pngSize);

g.drawImage(background_image, getLocalBounds().toFloat());
g.setFont(LABEL_FONT);
g.setFont(UIFonts::get().LABEL_FONT());
g.drawFittedText("MUTE OUT", juce::Rectangle<int>(939, 63, 31, 23), juce::Justification::centred, 2);
}

Expand Down
4 changes: 2 additions & 2 deletions NeuralNote/Source/Components/Views/NoteOptionsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void NoteOptionsView::paint(Graphics& g)
mMinMaxNoteSlider->setAlpha(alpha);
g.setColour(BLACK.withAlpha(alpha));

g.setFont(TITLE_FONT);
g.setFont(UIFonts::get().TITLE_FONT());
g.drawText("SCALE QUANTIZE", Rectangle<int>(24, 0, 274, 17), juce::Justification::centredLeft);

auto enable_rectangle = juce::Rectangle<int>(0, 0, 17, 17);
Expand All @@ -83,7 +83,7 @@ void NoteOptionsView::paint(Graphics& g)
else
g.drawRoundedRectangle(enable_rectangle.toFloat(), 4.0f, 1.0f);

g.setFont(LABEL_FONT);
g.setFont(UIFonts::get().LABEL_FONT());
g.drawText("RANGE", juce::Rectangle<int>(19, mMinMaxNoteSlider->getY(), 80, 17), juce::Justification::centredLeft);

g.drawText("KEY", juce::Rectangle<int>(19, mKeyDropdown->getY(), 80, 17), juce::Justification::centredLeft);
Expand Down
4 changes: 2 additions & 2 deletions NeuralNote/Source/Components/Views/RhythmOptionsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void RhythmOptionsView::paint(Graphics& g)

mQuantizationForceSlider->setAlpha(alpha);
g.setColour(BLACK.withAlpha(alpha));
g.setFont(TITLE_FONT);
g.setFont(UIFonts::get().TITLE_FONT());
g.drawText("TIME QUANTIZE", Rectangle<int>(24, 0, 210, 17), juce::Justification::centredLeft);

auto enable_rectangle = juce::Rectangle<int>(0, 0, 17, 17);
Expand All @@ -53,7 +53,7 @@ void RhythmOptionsView::paint(Graphics& g)
else
g.drawRoundedRectangle(enable_rectangle.toFloat(), 4.0f, 1.0f);

g.setFont(LABEL_FONT);
g.setFont(UIFonts::get().LABEL_FONT());

g.drawText("TEMPO " + mProcessor.getTempoStr(),
juce::Rectangle<int>(19, LEFT_SECTIONS_TOP_PAD + 47, 75, 10),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void TranscriptionOptionsView::paint(Graphics& g)
float alpha = isEnabled() ? 1.0f : 0.5f;

g.setColour(BLACK.withAlpha(alpha));
g.setFont(TITLE_FONT);
g.setFont(UIFonts::get().TITLE_FONT());
g.drawText("TRANSCRIPTION", Rectangle<int>(24, 0, 250, 17), juce::Justification::centredLeft);

auto enable_rectangle = juce::Rectangle<int>(0, 0, 17, 17);
Expand All @@ -82,7 +82,7 @@ void TranscriptionOptionsView::paint(Graphics& g)
else
g.drawRoundedRectangle(enable_rectangle.toFloat(), 4.0f, 1.0f);

g.setFont(LABEL_FONT);
g.setFont(UIFonts::get().LABEL_FONT());
g.drawText(
"PITCH BEND", juce::Rectangle<int>(19, mPitchBendDropDown->getY(), 67, 17), juce::Justification::centredLeft);
}
Expand Down
4 changes: 2 additions & 2 deletions NeuralNote/Source/Components/Views/VisualizationPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ VisualizationPanel::VisualizationPanel(NeuralNoteAudioProcessor* processor)
mFileTempo->setMultiLine(false, false);
mFileTempo->setReadOnly(false);

mFileTempo->setFont(LABEL_FONT);
mFileTempo->setFont(UIFonts::get().LABEL_FONT());
mFileTempo->setJustification(juce::Justification::centred);

mFileTempo->setColour(TextEditor::backgroundColourId, juce::Colours::transparentWhite);
Expand Down Expand Up @@ -110,7 +110,7 @@ void VisualizationPanel::paint(Graphics& g)
Rectangle<int>(0, 0, KEYBOARD_WIDTH, mCombinedAudioMidiRegion.mAudioRegionHeight).toFloat(), 4);

g.setColour(BLACK);
g.setFont(LABEL_FONT);
g.setFont(UIFonts::get().LABEL_FONT());
g.drawFittedText(
"MIDI\nFILE\nTEMPO", Rectangle<int>(0, 0, KEYBOARD_WIDTH, 55), juce::Justification::centred, 3);
}
Expand Down