1 /*----------------------------------------------------------------------------
2  *
3  * File:
4  * eas_imelodydata.h
5  *
6  * Contents and purpose:
7  * SMF File Parser
8  *
9  * This file contains data declarations for the iMelody parser.
10  *
11  * Copyright Sonic Network Inc. 2005
12 
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  *      http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  *
25  *----------------------------------------------------------------------------
26  * Revision Control:
27  *   $Revision: 778 $
28  *   $Date: 2007-07-23 16:45:17 -0700 (Mon, 23 Jul 2007) $
29  *----------------------------------------------------------------------------
30 */
31 
32 #ifndef EAS_IMELODYDATA_H
33 #define EAS_IMELODYDATA_H
34 
35 #include "eas_data.h"
36 
37 /* maximum line size as specified in iMelody V1.2 spec */
38 #define MAX_LINE_SIZE           75
39 
40 /*----------------------------------------------------------------------------
41  *
42  * S_IMELODY_DATA
43  *
44  * This structure contains the state data for the iMelody parser
45  *----------------------------------------------------------------------------
46 */
47 
48 typedef struct
49 {
50     EAS_FILE_HANDLE fileHandle;                 /* file handle */
51     S_SYNTH         *pSynth;                    /* pointer to synth */
52     EAS_I32         fileOffset;                 /* offset to start of data */
53     EAS_I32         time;                       /* current time in 256ths of a msec */
54     EAS_I32         tickBase;                   /* basline length of 32nd note in 256th of a msec */
55     EAS_I32         tick;                       /* actual length of 32nd note in 256th of a msec */
56     EAS_I32         restTicks;                  /* ticks to rest after current note */
57     EAS_I32         startLine;                  /* file offset at start of line (for repeats) */
58     EAS_I32         repeatOffset;               /* file offset to start of repeat section */
59     EAS_I32         repeatTime;                 /* time at start of repeat section */
60     S_METADATA_CB   metadata;                   /* metadata callback */
61     EAS_I16         repeatCount;                /* repeat counter */
62     EAS_U8          state;                      /* current state EAS_STATE_XXXX */
63     EAS_U8          style;                      /* from STYLE */
64     EAS_U8          index;                      /* index into buffer */
65     EAS_U8          octave;                     /* octave prefix */
66     EAS_U8          volume;                     /* current volume */
67     EAS_U8          note;                       /* MIDI note number */
68     EAS_I8          noteModifier;               /* sharp or flat */
69     EAS_I8          buffer[MAX_LINE_SIZE+1];    /* buffer for ASCII data */
70 } S_IMELODY_DATA;
71 
72 #endif
73 
74 
75