~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

« back to all changes in this revision

Viewing changes to tutorials/sndkit/ossmplay/mlib.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-16 20:37:48 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110616203748-jbrxik6ql33z54co
Tags: 4.2-build2004-1ubuntu1
* Merge from Debian unstable.
  - Supports our current kernel (LP: #746048)
  Remaining changes:
  - debian/oss4-dkms.dkms.in: s/source/build/ in Kernel headers paths.
* ld-as-needed.patch: Re-order CC arguments to enable building with ld
  --as-needed (LP: #770972)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Event types 0 to 127 are available for private use
 
3
 * by applications
 
4
 */
 
5
 
 
6
#define EV_PRIVATE_META         0
 
7
 
 
8
#define MAX_TRACK       256
 
9
 
 
10
struct midi_hdr
 
11
{
 
12
  int MThd_fmt;
 
13
  int MThd_ntrk;                /* Num of tracks */
 
14
 
 
15
  int time_mode;
 
16
#define TIME_MIDI       1
 
17
  int division;
 
18
#define TIME_SMPTE      2
 
19
  int SMPTE_format;
 
20
  int SMPTE_resolution;
 
21
};
 
22
 
 
23
struct mlib_track
 
24
{
 
25
  int len;
 
26
  unsigned char *events;
 
27
 
 
28
/*
 
29
 * The flags are set when loading the track. Let's hope they are
 
30
 * updated also when the track gets changed.
 
31
 */
 
32
  unsigned long flags;
 
33
#define TRK_MULTICHN            0x00000001      /* More than one channel */
 
34
#define TRK_MULTIPGM            0x00000002      /* More than one program */
 
35
#define TRK_VEL_NOTEON          0x00000004      /* Events with on vel. <> 64 */
 
36
#define TRK_AFTERTOUCH          0x00000008      /* Aftertouch events */
 
37
#define TRK_POLY_AFTERTOUCH     0x00000010      /* Polyph. aftertouch events */
 
38
#define TRK_VEL_NOTEOFF         0x00000020      /* Events with off vel. <> 64 */
 
39
#define TRK_CONTROLS            0x00000040      /* Controller events */
 
40
#define TRK_BENDER              0x00000080      /* Bender events */
 
41
#define TRK_NOTES               0x00000100      /* At least one note on */
 
42
  int init_chn;                 /* First chn referenced by the track */
 
43
  int init_pgm;                 /* First pgm referenced by the track */
 
44
  int chn;                      /* chn assigned to the track */
 
45
  int chnmask;                  /* channel bitmap */
 
46
  int port;                     /* port assigned to the track */
 
47
  int pgm;                      /* pgm assigned to the track */
 
48
  int current_time;
 
49
  int noteon_time;              /* Time of the first noteon */
 
50
  int end_time;
 
51
  int min_note, max_note;       /* Scale info */
 
52
  short pgm_map[128];           /* MIDI pgm mapping table */
 
53
  short drum_map[128];          /* MIDI drum pgm mapping table */
 
54
};
 
55
typedef struct mlib_track mlib_track;
 
56
 
 
57
struct mlib_desc
 
58
{
 
59
  int magic;                    /* 0x121234 */
 
60
  int fd;
 
61
  char path[1024];
 
62
  struct midi_hdr hdr;
 
63
 
 
64
  int curr_trk;
 
65
  int trk_offs;
 
66
  int next_trk_offs;
 
67
 
 
68
  unsigned char buf[1024];
 
69
  int bufcnt, bufp;
 
70
 
 
71
  unsigned int timesig;
 
72
 
 
73
  unsigned char prev_status;    /* For running status */
 
74
 
 
75
  mlib_track *control_track;
 
76
 
 
77
  mlib_track *tracks[MAX_TRACK];
 
78
};
 
79
 
 
80
typedef struct mlib_desc mlib_desc;
 
81
 
 
82
int mlib_chkdesc (mlib_desc * desc);
 
83
mlib_track *mlib_loadtrack (mlib_desc * desc, int *end_detected);
 
84
void mlib_deltrack (mlib_track * track);
 
85
mlib_desc *mlib_open (char *path);
 
86
void mlib_close (mlib_desc * desc);
 
87
char *mlib_errmsg (void);