4 Copyright 1999 by Daisuke Nagano <breeze.nagano@nifty.ne.jp>
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
34 #define RCP_HEADER_STRING "RCM-PC98V2.0(C)COME ON MUSIC"
35 #define STEDDATA_HEADER_STRING "STEDDATAx.xxDedicatedToTURBO"
37 #define RCP_MAX_TRACKS 36
38 #define RCP_MAX_USER_EXCLUSIVE 8
39 #define RCP_MAX_COMMENT_SIZE 36
40 #define RCP_MAX_NOTES 128
41 #define RCP_MAX_LOOPS 128
43 #define RCP_MAX_RESULT_SMF_SIZE 256
44 #define RCP_USER_EXCLUSIVE_SIZE 24
46 #define RCP_DEFAULT_SMF_SIZE 65536
48 #define ENABLE_PORT_CHANGE
53 typedef struct _LOOP_DATA {
54 int top_ptr;/**< 開始位置 */
55 int loop_count;/**< ループ回数 */
56 int same_measure_flag;/**< */
57 int same_measure_ptr;/**< */
61 typedef struct _RCP_TRACK {
62 int top; /**< base pointer */
63 int size; /**< data size */
64 int midi_ch; /**< midi channel */
65 int port; /**< midi port (0 to 15 ) */
66 int key; /**< key offset */
67 int st; /**< step offset */
68 int mode; /**< mode */
70 unsigned char comment[RCP_MAX_COMMENT_SIZE];
86 int notes[RCP_MAX_NOTES];
89 int all_notes_expired;
95 LOOP_DATA loop[RCP_MAX_LOOPS];
97 int same_measure_flag;
105 typedef struct _RCP_DATA {
107 unsigned char *data; /* data */
108 size_t length; /* data length */
109 unsigned char *file_name; /* original RCP/G36 filename */
110 unsigned char *date; /* original RCP/R36 timestamp */
111 unsigned char *command_name;/* command name ( typically "rcptomid" ) */
112 unsigned char *copyright; /* copyright notice */
114 int g36; /* flag for G18/G36 format */
115 int rcp; /* flag for RCP/R36 format */
116 int steddata; /* flag for STED3 format */
118 unsigned char title[65]; /* data title ( perhaps SJIS ) */
119 unsigned char memo[337]; /* memo */
121 int timebase; /* timebase */
122 int tempo; /* tempo */
123 int realtempo; /* tempo (Beat per minute) */
124 int rtm_delta; /* timebase / 24 */
125 int beat_h; /* beat */
126 int beat_l; /* beat */
129 int play_bias; /* play bias */
131 int tracks; /* track number (RCP:18 R36:26) */
133 long step; /* total step */
136 int user_exclusive[RCP_MAX_USER_EXCLUSIVE][24];
142 /* track work area */
144 RCP_TRACK track[RCP_MAX_TRACKS];
146 int result_smf[RCP_MAX_RESULT_SMF_SIZE];
148 unsigned char *smf_tempo_track;
149 int smf_tempo_track_ptr;
151 unsigned char *smf_data;
154 int enable_converter_notice;
157 /* player's informations */
170 void error_end( char *);
171 RCP_DATA *rcp_read_file( char * );
172 int rcp_close( RCP_DATA * );
174 unsigned char *rcptomid( RCP_DATA * );
177 /* RCP data structure definition */
179 #define RCP_USER_EXCLUSIVE_1 0x90
180 #define RCP_USER_EXCLUSIVE_2 0x91
181 #define RCP_USER_EXCLUSIVE_3 0x92
182 #define RCP_USER_EXCLUSIVE_4 0x93
183 #define RCP_USER_EXCLUSIVE_5 0x94
184 #define RCP_USER_EXCLUSIVE_6 0x95
185 #define RCP_USER_EXCLUSIVE_7 0x96
186 #define RCP_USER_EXCLUSIVE_8 0x97
187 #define RCP_CH_EXCLUSIVE 0x98
188 #define RCP_EXEC_EXTERN_PROG 0x99
189 #define RCP_BANK_AND_PROG 0xe2
190 #define RCP_KEY_SCAN 0xe5
191 #define RCP_MIDI_CH_CHANGE 0xe6
192 #define RCP_TEMPO_CHANGE 0xe7
193 #define RCP_AFTER_TOUCH 0xea
194 #define RCP_CONTROL_CHANGE 0xeb
195 #define RCP_PROGRAM_CHANGE 0xec
196 #define RCP_AFTER_TOUCH_POLY 0xed
197 #define RCP_PITCH_BEND 0xee
198 #define RCP_YAMAHA_BASE 0xd0
199 #define RCP_YAMAHA_DEV_NUM 0xd1
200 #define RCP_YAMAHA_ADDR 0xd2
201 #define RCP_YAMAHA_XG_AD 0xd3
202 #define RCP_ROLAND_BASE 0xdd
203 #define RCP_ROLAND_PARA 0xde
204 #define RCP_ROLAND_DEV 0xdf
205 #define RCP_KEY_CHANGE 0xf5
206 #define RCP_COMMENT_START 0xf6
207 #define RCP_LOOP_END 0xf8
208 #define RCP_LOOP_START 0xf9
209 #define RCP_SAME_MEASURE 0xfc
210 #define RCP_MEASURE_END 0xfd
211 #define RCP_END_OF_TRACK 0xfe
212 #define RCP_DX7_FUNCTION 0xc0
213 #define RCP_DX_PARAMETER 0xc1
214 #define RCP_DX_RERF 0xc2
215 #define RCP_TX_FUNCTION 0xc3
216 #define RCP_FB01_PARAMETER 0xc5
217 #define RCP_FB01_SYSTEM 0xc6
218 #define RCP_TX81Z_VCED 0xc7
219 #define RCP_TX81Z_ACED 0xc8
220 #define RCP_TX81Z_PCED 0xc9
221 #define RCP_TX81Z_SYSTEM 0xca
222 #define RCP_TX81Z_EFFECT 0xcb
223 #define RCP_DX7_2_REMOTE_SW 0xcc
224 #define RCP_DX7_2_ACED 0xcd
225 #define RCP_DX7_2_PCED 0xce
226 #define RCP_TX802_PCED 0xcf
227 #define RCP_MKS_7 0xdc
229 #define RCP_2ND_EVENT 0xf7