MCPcopy Create free account
hub / github.com/DamRsn/NeuralNote / mouseDown

Method mouseDown

NeuralNote/Source/Components/MidiFileDrag.cpp:33–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void MidiFileDrag::mouseDown(const MouseEvent& event)
34{
35 if (!mTempDirectory.isDirectory()) {
36 auto result = mTempDirectory.createDirectory();
37 if (result.failed()) {
38 NativeMessageBox::showMessageBoxAsync(
39 juce::MessageBoxIconType::NoIcon, "Error", "Temporary directory for midi file failed.");
40 }
41 }
42
43 String filename = mProcessor->getSourceAudioManager()->getDroppedFilename();
44
45 if (filename.isEmpty())
46 filename = "NNTranscription.mid";
47 else
48 filename += "_NNTranscription.mid";
49
50 auto out_file = mTempDirectory.getChildFile(filename);
51
52 double export_bpm = mProcessor->getValueTree().getProperty(NnId::ExportTempoId, 120.0);
53
54 auto success_midi_file_creation = mMidiFileWriter.writeMidiFile(
55 mProcessor->getTranscriptionManager()->getNoteEventVector(),
56 out_file,
57 mProcessor->getTranscriptionManager()->getTimeQuantizeOptions().getTimeQuantizeInfo(),
58 export_bpm,
59 static_cast<PitchBendModes>(mProcessor->getParameterValue(ParameterHelpers::PitchBendModeId)));
60
61 if (!success_midi_file_creation) {
62 NativeMessageBox::showMessageBoxAsync(
63 juce::MessageBoxIconType::NoIcon, "Error", "Could not create the midi file.");
64 }
65
66 StringArray out_files = {out_file.getFullPathName()};
67
68 DragAndDropContainer::performExternalDragDropOfFiles(out_files, false, this);
69}
70
71void MidiFileDrag::mouseEnter(const MouseEvent& event)
72{

Callers

nothing calls this directly

Calls 6

getDroppedFilenameMethod · 0.80
getSourceAudioManagerMethod · 0.80
writeMidiFileMethod · 0.80
getTimeQuantizeInfoMethod · 0.80
getParameterValueMethod · 0.80

Tested by

no test coverage detected