Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <cstring>
#include <cstdio>
#include <cassert>
#include <iostream>
#include <glibmm/miscutils.h>
+#include <midi++/events.h>
+
#include <ardour/smf_reader.h>
-#include <ardour/midi_events.h>
#include <ardour/midi_util.h>
using namespace std;
static uint8_t last_status = 0;
static uint32_t last_size = 0;
- *delta_time = read_var_len();
+ *delta_time = read_var_len(_fd);
int status = fgetc(_fd);
if (status == EOF)
throw PrematureEOF();
if (feof(_fd))
throw PrematureEOF();
uint8_t type = fgetc(_fd);
- const uint32_t size = read_var_len();
+ const uint32_t size = read_var_len(_fd);
/*cerr.flags(ios::hex);
cerr << "SMF - meta 0x" << (int)type << ", size = ";
cerr.flags(ios::dec);
uint32_t
-SMFReader::read_var_len() const throw(PrematureEOF)
+SMFReader::read_var_len(FILE* fd) throw (PrematureEOF)
{
- if (feof(_fd))
+ if (feof(fd))
throw PrematureEOF();
uint32_t value;
uint8_t c;
- if ( (value = getc(_fd)) & 0x80 ) {
+ if ( (value = getc(fd)) & 0x80 ) {
value &= 0x7F;
do {
- if (feof(_fd))
+ if (feof(fd))
throw PrematureEOF();
- value = (value << 7) + ((c = getc(_fd)) & 0x7F);
+ value = (value << 7) + ((c = getc(fd)) & 0x7F);
} while (c & 0x80);
}