summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/SMF.cc1
-rw-r--r--lib/message.cc1
-rw-r--r--tools/mididump.cc1
3 files changed, 3 insertions, 0 deletions
diff --git a/lib/SMF.cc b/lib/SMF.cc
index ba3179d..2c62b1f 100644
--- a/lib/SMF.cc
+++ b/lib/SMF.cc
@@ -1,28 +1,29 @@
1#include <iostream> 1#include <iostream>
2#include <fstream> 2#include <fstream>
3#include <algorithm> 3#include <algorithm>
4#include <iterator> 4#include <iterator>
5#include <cstring>
5#include <midillo/SMF.h> 6#include <midillo/SMF.h>
6 7
7namespace midillo { 8namespace midillo {
8 using std::ifstream; 9 using std::ifstream;
9 using std::ofstream; 10 using std::ofstream;
10 using std::cin; 11 using std::cin;
11 using std::cout; 12 using std::cout;
12 using std::copy; 13 using std::copy;
13 using std::ostream_iterator; 14 using std::ostream_iterator;
14 using std::endl; 15 using std::endl;
15 16
16 void SMF_t::load(const char *f,bool stdinable) { 17 void SMF_t::load(const char *f,bool stdinable) {
17 if(stdinable && !strcmp(f,"-")) { 18 if(stdinable && !strcmp(f,"-")) {
18 load(cin); 19 load(cin);
19 }else{ 20 }else{
20 ifstream s(f,std::ios::in|std::ios::binary); 21 ifstream s(f,std::ios::in|std::ios::binary);
21 load(s); 22 load(s);
22 } 23 }
23 } 24 }
24 25
25 void SMF_t::load(istream& s) { 26 void SMF_t::load(istream& s) {
26 mthd.load(s); 27 mthd.load(s);
27 tracks.resize(mthd.ntracks); 28 tracks.resize(mthd.ntracks);
28 tracks_t::iterator i = tracks.begin(); 29 tracks_t::iterator i = tracks.begin();
diff --git a/lib/message.cc b/lib/message.cc
index 8f9e68a..6a5cfd6 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1,26 +1,27 @@
1#include <algorithm> 1#include <algorithm>
2#include <iterator> 2#include <iterator>
3#include <cassert>
3#include <midillo/message.h> 4#include <midillo/message.h>
4#include <midillo/util.h> 5#include <midillo/util.h>
5#include <midillo/exception.h> 6#include <midillo/exception.h>
6 7
7namespace midillo { 8namespace midillo {
8 using std::copy; 9 using std::copy;
9 using std::ostream_iterator; 10 using std::ostream_iterator;
10 11
11 unsigned long message_t::calculate_save_size(int& rs) const { 12 unsigned long message_t::calculate_save_size(int& rs) const {
12 unsigned long rv = 0; 13 unsigned long rv = 0;
13 if(status!=rs) { 14 if(status!=rs) {
14 ++rv; 15 ++rv;
15 rs = status; 16 rs = status;
16 }else if((status&status_event_bits)==status_system) { 17 }else if((status&status_event_bits)==status_system) {
17 rs = -1; 18 rs = -1;
18 ++rv; // XXX: is it really needed? 19 ++rv; // XXX: is it really needed?
19 } 20 }
20 switch(status&status_event_bits) { 21 switch(status&status_event_bits) {
21 case status_note_off: 22 case status_note_off:
22 case status_note_on: 23 case status_note_on:
23 case status_polyphonic_key_pressure: // aka status_aftertouch 24 case status_polyphonic_key_pressure: // aka status_aftertouch
24 case status_control_change: 25 case status_control_change:
25 case status_pitch_wheel_change: 26 case status_pitch_wheel_change:
26 rv += 2; break; 27 rv += 2; break;
diff --git a/tools/mididump.cc b/tools/mididump.cc
index 83b7086..604bcc0 100644
--- a/tools/mididump.cc
+++ b/tools/mididump.cc
@@ -1,29 +1,30 @@
1#include <getopt.h> 1#include <getopt.h>
2#include <iostream> 2#include <iostream>
3#include <fstream> 3#include <fstream>
4#include <string> 4#include <string>
5#include <algorithm> 5#include <algorithm>
6#include <cstring>
6using namespace std; 7using namespace std;
7#include <konforka/exception.h> 8#include <konforka/exception.h>
8#include <midillo/SMF.h> 9#include <midillo/SMF.h>
9using namespace midillo; 10using namespace midillo;
10 11
11#include "config.h" 12#include "config.h"
12#define PHEADER PACKAGE " " VERSION " - mididump - dump midi files" 13#define PHEADER PACKAGE " " VERSION " - mididump - dump midi files"
13#define PCOPY "Copyright (c) 2006 Klever Group" 14#define PCOPY "Copyright (c) 2006 Klever Group"
14 15
15static void usage(const char *p) { 16static void usage(const char *p) {
16 cerr << PHEADER << endl 17 cerr << PHEADER << endl
17 << PCOPY << endl << endl 18 << PCOPY << endl << endl
18 << " " << p << " [options] [<input-file>[ <output-file>]]" << endl << endl 19 << " " << p << " [options] [<input-file>[ <output-file>]]" << endl << endl
19 << " -h, --help" << endl 20 << " -h, --help" << endl
20 << " --usage display this text" << endl 21 << " --usage display this text" << endl
21 << " -V, --version display version number" << endl 22 << " -V, --version display version number" << endl
22 << " -L, --license show license" << endl; 23 << " -L, --license show license" << endl;
23} 24}
24 25
25main(int argc,char **argv) { 26main(int argc,char **argv) {
26 try { 27 try {
27 while(true) { 28 while(true) {
28 static struct option opts[] = { 29 static struct option opts[] = {
29 { "help", no_argument, 0, 'h' }, 30 { "help", no_argument, 0, 'h' },