Skip to content

Commit

Permalink
Disable the metronome when writing out MIDI files.
Browse files Browse the repository at this point in the history
Bug: #55
  • Loading branch information
cameronwhite committed Jun 28, 2015
1 parent 33de6f4 commit 3ce7c95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/formats/midi/midiexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void MidiExporter::save(const std::string &filename, const Score &score)
os.exceptions(std::ios::failbit | std::ios::badbit | std::ios::eofbit);

MidiFile file;
file.load(score);
file.load(score, /* metronome */ false);
writeHeader(os, file);

for (const MidiEventList &track : file.getTracks())
Expand Down
5 changes: 3 additions & 2 deletions source/midi/midifile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ MidiFile::MidiFile() : myTicksPerBeat(0)
{
}

void MidiFile::load(const Score &score)
void MidiFile::load(const Score &score, bool enable_metronome)
{
myTicksPerBeat = DEFAULT_PPQ;

Expand Down Expand Up @@ -150,7 +150,8 @@ void MidiFile::load(const Score &score)

myTracks.push_back(master_track);
myTracks.insert(myTracks.end(), regular_tracks.begin(), regular_tracks.end());
myTracks.push_back(metronome_track);
if (enable_metronome)
myTracks.push_back(metronome_track);

for (MidiEventList &track : myTracks)
{
Expand Down
2 changes: 1 addition & 1 deletion source/midi/midifile.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MidiFile
public:
MidiFile();

void load(const Score &score);
void load(const Score &score, bool enable_metronome);

int getTicksPerBeat() const { return myTicksPerBeat; }
const std::vector<MidiEventList> &getTracks() const { return myTracks; }
Expand Down

0 comments on commit 3ce7c95

Please sign in to comment.