2010-07-18 20:28:15 +00:00
|
|
|
#ifndef __HMP_H
|
|
|
|
#define __HMP_H
|
|
|
|
|
|
|
|
#ifdef WIN32
|
2006-04-03 17:51:13 +00:00
|
|
|
#include <windows.h>
|
|
|
|
#include <mmsystem.h>
|
2010-07-18 20:28:15 +00:00
|
|
|
#endif
|
2006-04-03 17:51:13 +00:00
|
|
|
|
|
|
|
#define HMP_TRACKS 32
|
2010-07-18 20:28:15 +00:00
|
|
|
#ifdef WIN32
|
2006-04-03 17:51:13 +00:00
|
|
|
#define HMP_BUFFERS 4
|
|
|
|
#define HMP_BUFSIZE 1024
|
2010-07-18 20:28:15 +00:00
|
|
|
#define HMP_INVALID_FILE -1
|
|
|
|
#define HMP_OUT_OF_MEM -2
|
|
|
|
#define HMP_MM_ERR -3
|
|
|
|
#define HMP_EOF 1
|
|
|
|
#endif
|
2006-04-03 17:51:13 +00:00
|
|
|
|
2010-07-18 20:28:15 +00:00
|
|
|
#ifdef WIN32
|
2006-04-03 17:51:13 +00:00
|
|
|
typedef struct event {
|
|
|
|
unsigned int delta;
|
|
|
|
unsigned char msg[3];
|
|
|
|
unsigned char *data;
|
|
|
|
unsigned int datalen;
|
|
|
|
} event;
|
2010-07-18 20:28:15 +00:00
|
|
|
#endif
|
2006-04-03 17:51:13 +00:00
|
|
|
|
|
|
|
typedef struct hmp_track {
|
|
|
|
unsigned char *data;
|
|
|
|
unsigned int len;
|
|
|
|
unsigned char *cur;
|
|
|
|
unsigned int left;
|
|
|
|
unsigned int cur_time;
|
|
|
|
} hmp_track;
|
|
|
|
|
|
|
|
typedef struct hmp_file {
|
|
|
|
int num_trks;
|
|
|
|
hmp_track trks[HMP_TRACKS];
|
|
|
|
unsigned int cur_time;
|
|
|
|
int tempo;
|
2010-07-18 20:28:15 +00:00
|
|
|
#ifdef WIN32
|
2006-04-03 17:51:13 +00:00
|
|
|
MIDIHDR *evbuf;
|
2010-07-18 20:28:15 +00:00
|
|
|
HMIDISTRM hmidi;
|
2006-04-03 17:51:13 +00:00
|
|
|
UINT devid;
|
2010-07-18 20:28:15 +00:00
|
|
|
#endif
|
2006-04-03 17:51:13 +00:00
|
|
|
unsigned char *pending;
|
|
|
|
unsigned int pending_size;
|
|
|
|
unsigned int pending_event;
|
|
|
|
int stop;
|
|
|
|
int bufs_in_mm;
|
2010-07-18 20:28:15 +00:00
|
|
|
int bLoop;
|
|
|
|
unsigned int midi_division;
|
2006-04-03 17:51:13 +00:00
|
|
|
} hmp_file;
|
|
|
|
|
|
|
|
hmp_file *hmp_open(const char *filename);
|
|
|
|
void hmp_close(hmp_file *hmp);
|
2010-10-29 15:40:21 +00:00
|
|
|
void hmp2mid(char *hmp_name, unsigned char **midbuf, unsigned int *midlen);
|
2010-07-18 20:28:15 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
int hmp_play(hmp_file *hmp, int bLoop);
|
|
|
|
#endif
|
2008-06-01 12:53:03 +00:00
|
|
|
|
2006-04-03 17:51:13 +00:00
|
|
|
#endif
|