~ubuntu-branches/ubuntu/precise/csound/precise

« back to all changes in this revision

Viewing changes to frontends/CsoundAC/mfmidi.h

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2012-04-19 09:26:46 UTC
  • mfrom: (3.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20120419092646-96xbj1n6atuqosk2
Tags: 1:5.17.6~dfsg-1
* New upstream release
 - Do not build the wiimote opcodes (we need wiiuse).
* Add new API function to symbols file
* Disable lua opcodes, they were broken. Requires OpenMP to be enabled.
* Backport fixes from upstream:
  - Link dssi4cs with dl. Backport
  - Fix building of CsoundAC

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define NOTEOFF 0x80
 
2
#define NOTEON 0x90
 
3
#define PRESSURE 0xa0
 
4
#define CONTROLLER 0xb0
 
5
#define PITCHBEND 0xe0
 
6
#define PROGRAM 0xc0
 
7
#define CHANPRESSURE 0xd0
 
8
 
 
9
/* These are the strings used in keynote to identify Standard MIDI File */
 
10
/* meta text messages. */
 
11
 
 
12
#define METATEXT                "Text Event"
 
13
#define METACOPYRIGHT           "Copyright Notice"
 
14
#define METASEQUENCE            "Sequence/Track Name"
 
15
#define METAINSTRUMENT          "Instrument Name"
 
16
#define METALYRIC               "Lyric"
 
17
#define METAMARKER              "Marker"
 
18
#define METACUE                 "Cue Point"
 
19
#define METAUNRECOGNIZED        "Unrecognized"
 
20
 
 
21
 
 
22
class Midifile_reader {
 
23
public:
 
24
    void midifile();
 
25
    int Mf_nomerge; /* 1 => continue'ed system exclusives are */
 
26
                                        /* not collapsed. */
 
27
    long Mf_currtime; /* current time in delta-time units */
 
28
    int Mf_skipinit;   /* 1 if initial garbage should be skipped */
 
29
    Midifile_reader();
 
30
        // call finalize() when done or you may leak memory.
 
31
        void finalize();  /* clean up before deletion */
 
32
        // Note: rather than finalize, we should have ~Midifile_reader(),
 
33
        // but at least VC++ complains that there is no Mf_free(), even
 
34
        // though Mf_free is declared as virtual and this is an abstract
 
35
        // class. I don't understand this, so finalize() is a workaround. -RBD
 
36
 
 
37
protected:
 
38
    int midifile_error;
 
39
 
 
40
    virtual void *Mf_malloc(size_t size) = 0; /* malloc() */
 
41
    virtual void Mf_free(void *obj, size_t size) = 0; /* free() */
 
42
    /* Methods to be called while processing the MIDI file. */
 
43
    virtual void Mf_starttrack() = 0;
 
44
    virtual void Mf_endtrack() = 0;
 
45
    virtual int Mf_getc() = 0;
 
46
    virtual void Mf_chanprefix(int) = 0;
 
47
    virtual void Mf_portprefix(int) = 0;
 
48
    virtual void Mf_eot() = 0;
 
49
    virtual void Mf_error(char *) = 0;
 
50
    virtual void Mf_header(int,int,int) = 0;
 
51
    virtual void Mf_on(int,int,int) = 0;
 
52
    virtual void Mf_off(int,int,int) = 0;
 
53
    virtual void Mf_pressure(int,int,int) = 0;
 
54
    virtual void Mf_controller(int,int,int) = 0;
 
55
    virtual void Mf_pitchbend(int,int,int) = 0;
 
56
    virtual void Mf_program(int,int) = 0;
 
57
    virtual void Mf_chanpressure(int,int) = 0;
 
58
    virtual void Mf_sysex(int,unsigned char*) = 0;
 
59
    virtual void Mf_arbitrary(int,unsigned char*) = 0;
 
60
    virtual void Mf_metamisc(int,int,unsigned char*) = 0;
 
61
    virtual void Mf_seqnum(int) = 0;
 
62
    virtual void Mf_smpte(int,int,int,int,int) = 0;
 
63
    virtual void Mf_timesig(int,int,int,int) = 0;
 
64
    virtual void Mf_tempo(int) = 0;
 
65
    virtual void Mf_keysig(int,int) = 0;
 
66
    virtual void Mf_sqspecific(int,unsigned char*) = 0;
 
67
    virtual void Mf_text(int,int,unsigned char*) = 0;
 
68
 
 
69
private:
 
70
    long Mf_toberead;
 
71
 
 
72
    long readvarinum();
 
73
    long read32bit();
 
74
    int read16bit();
 
75
    void msgenlarge();
 
76
    unsigned char *msg();
 
77
    int readheader();
 
78
    void readtrack();
 
79
    void sysex();
 
80
    void msginit();
 
81
    int egetc();
 
82
    int msgleng();
 
83
 
 
84
    int readmt(char*,int);
 
85
    long to32bit(int,int,int,int);
 
86
    int to16bit(int,int);
 
87
    void mferror(char *);
 
88
    void badbyte(int);
 
89
    void metaevent(int);
 
90
    void msgadd(int);
 
91
    void chanmessage(int,int,int);
 
92
 
 
93
    unsigned char *Msgbuff;
 
94
    long Msgsize;
 
95
    long Msgindex;
 
96
};
 
97
 
 
98