| 31 | } |
| 32 | |
| 33 | void 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 | |
| 71 | void MidiFileDrag::mouseEnter(const MouseEvent& event) |
| 72 | { |
nothing calls this directly
no test coverage detected