22#include "../lib-src/header-substitutes/allegro.h"
27#include "../NoteTrack.h"
29#include "../ProjectFileIO.h"
31#include "../ProjectWindow.h"
32#include "../SelectUtilities.h"
33#include "../widgets/AudacityMessageBox.h"
34#include "../widgets/FileHistory.h"
41 auto newTrack = std::make_shared<NoteTrack>();
42 bool initiallyEmpty = tracks.empty();
47 auto pTrack = tracks.Add( newTrack );
48 pTrack->SetSelected(
true);
53 const bool projectHasSolo =
55#ifdef EXPERIMENTAL_MIDI_OUT
57 pTrack->SetMute(
true);
62 XO(
"Imported MIDI from '%s'").
Format( fileName ),
71 if (initiallyEmpty && projectFileIO.IsTemporary()) {
72 wxFileName
fn(fileName);
75 projectFileIO.SetProjectTitle();
85 if (fName.length() <= 4){
87 XO(
"Could not open file %s: Filename too short.").
Format( fName ) );
92 if (fName.Right(4).CmpNoCase(wxT(
".mid")) == 0 || fName.Right(5).CmpNoCase(wxT(
".midi")) == 0)
94 else if(fName.Right(4).CmpNoCase(wxT(
".gro")) != 0) {
96 XO(
"Could not open file %s: Incorrect filetype.").
Format( fName ) );
100 wxFFile mf(fName, wxT(
"rb"));
101 if (!mf.IsOpened()) {
103 XO(
"Could not open file %s.").
Format( fName ) );
108 auto new_seq = std::make_unique<Alg_seq>(fName.mb_str(), is_midi, &offset);
111 if(new_seq->get_read_error() == alg_error_open){
113 XO(
"Could not open file %s.").
Format( fName ) );
120 wxString trackNameBase = fName.AfterLast(wxFILE_SEP_PATH).BeforeLast(
'.');
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
bool DoImportMIDI(AudacityProject &project, const FilePath &fileName)
bool ImportMIDI(const FilePath &fName, NoteTrack *dest)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
void SetInitialImportPath(const FilePath &path)
void SetProjectName(const wxString &name)
void Append(const FilePath &file)
static FileHistory & Global()
A Track that is used for Midi notes. (Somewhat old code).
void SetSequence(std::unique_ptr< Alg_seq > &&seq)
void ZoomAllNotes()
Zooms so that all notes are visible.
AudioTrack subclass that can also be audibly replayed by the program.
static ProjectFileIO & Get(AudacityProject &project)
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
void ZoomAfterImport(Track *pTrack)
static ProjectWindow & Get(AudacityProject &project)
virtual void SetOffset(double o)
void SetName(const wxString &n)
static TrackList & Get(AudacityProject &project)
void SelectNone(AudacityProject &project)