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
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,16 @@ if (WIN32)
)

# Set the base path for Visual Studio 2022 redistributable DLLs
set(VS_CRT_BASE_PATH "C:/Program Files/Microsoft Visual Studio/2022/*/VC/Redist/MSVC/*/x64/Microsoft.VC143.CRT")
set(VS_CRT_BASE_PATH
"C:/Program Files/Microsoft Visual Studio/2022/*/VC/Redist/MSVC/*/x64/Microsoft.VC143.CRT"
"C:/Program Files (x86)/Microsoft Visual Studio/2022/*/VC/Redist/MSVC/*/x64/Microsoft.VC143.CRT"
)

# Search for the DLLs in the specified base path
file(GLOB_RECURSE all_runtime_dlls
LIST_DIRECTORIES false
"${VS_CRT_BASE_PATH}/*.dll"
LIST_DIRECTORIES false
${VS_CRT_BASE_PATH}/*.dll
)

set(runtime_dlls)

foreach(dll ${all_runtime_dlls})
Expand Down
10 changes: 5 additions & 5 deletions src/media/MidiDisplayComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ void MidiDisplayComponent::loadMediaFile(const URL& filePath)

int channel = midiMessage.getChannel();

if (channel == 10)
{
// TODO - handle drums channel
}
// Handle drums channel
bool isDrum = (channel == 10);


if (midiMessage.isProgramChange())
{
Expand Down Expand Up @@ -137,7 +136,8 @@ void MidiDisplayComponent::loadMediaFile(const URL& filePath)
startTime,
duration,
static_cast<unsigned char>(velocity),
static_cast<unsigned char>(instrument));
static_cast<unsigned char>(instrument),
isDrum);
pianoRoll.insertNote(n);
}
}
Expand Down
46 changes: 33 additions & 13 deletions src/media/pianoroll/NoteGridComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,46 @@ void NoteGridComponent::paint(Graphics& g)

Rectangle<float> bounds(noteXPos, noteYPos, jmax(3.0f, noteWidth), noteHeight - 1.0f);

float maxDrumWidth = 0.01f * getParentComponent()->getWidth();

float hue = static_cast<float>(n->instrument) / 127.0f;

Colour color = Colour::fromHSV(hue, 1.0f, 1.0f, 1.0f).brighter();

// Note fill
g.setColour(color.withAlpha(0.75f));
g.fillRect(bounds.toNearestInt());

if (n->isDrum)
{
g.setColour(color);

const float thickness = jmax(2.0f, noteHeight * 0.18f);
const float pad = jmax(1.0f, thickness * 0.5f);

if ((noteWidth >= 5) & (noteHeight >= 8))
const float x1 = noteXPos - maxDrumWidth/2;
const float y1 = bounds.getY() + pad;
const float x2 = noteXPos + maxDrumWidth/2;
const float y2 = bounds.getBottom() - pad;

g.drawLine(x1, y1, x2, y2, thickness);
g.drawLine(x2, y1, x1, y2, thickness);
}
else
{
const float maxVelocityWidth = static_cast<float>(noteWidth - 4);
const float verticalOffset = static_cast<float>(noteHeight) * 0.5f - 2.0f;
const float velocityHeight = 4.0f;

// Velocity fill
g.setColour(color.brighter());
g.fillRect(bounds.translated(2, verticalOffset)
.withWidth(maxVelocityWidth * n->velocity / 127.0f)
.withHeight(velocityHeight)
.toNearestInt());
g.setColour(color.withAlpha(0.75f));
g.fillRect(bounds.toNearestInt());

if ((noteWidth >= 5) && (noteHeight >= 8))
{
const float maxVelocityWidth = static_cast<float>(noteWidth - 4);
const float verticalOffset = static_cast<float>(noteHeight) * 0.5f - 2.0f;
const float velocityHeight = 4.0f;

g.setColour(color.brighter());
g.fillRect(bounds.translated(2, verticalOffset)
.withWidth(maxVelocityWidth * n->velocity / 127.0f)
.withHeight(velocityHeight)
.toNearestInt());
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/media/pianoroll/NoteGridComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ using namespace juce;
struct MidiNote
{
public:
MidiNote(unsigned char n, double s, double d, unsigned char v, unsigned char i = 0)
: noteNumber(n), startTime(s), duration(d), velocity(v), instrument(i)
MidiNote(unsigned char n, double s, double d, unsigned char v, unsigned char i = 0, bool drum = false)
: noteNumber(n), startTime(s), duration(d), velocity(v), instrument(i), isDrum(drum)
{
}

Expand All @@ -27,13 +27,15 @@ struct MidiNote
duration = other.duration;
velocity = other.velocity;
instrument = other.instrument;
isDrum = other.isDrum;
}

unsigned char noteNumber;
double startTime;
double duration;
unsigned char velocity;
unsigned char instrument;
bool isDrum;
};

class NoteGridComponent : public KeyboardComponent
Expand Down
Loading