1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include "general.h"
6 #include "fileoutput.h"
7
8 /*
9
10 Ringtone Tools - Copyright 2001-2005 Michael Kohn (mike@mikekohn.net)
11 This falls under the Kohnian license. Please read
12 it at http://ringtonetools.mikekohn.net/
13
14 This program is NOT opensourced. You may not use any part
15 of this program for your own software.
16
17 */
18
19 /* Samsung Older Models */
20
write_samsung_header(FILE * out,struct note_t * note)21 void write_samsung_header(FILE *out, struct note_t *note)
22 {
23 note->bytes=0;
24 }
25
write_samsung1_note(FILE * out,struct note_t * note)26 void write_samsung1_note(FILE *out, struct note_t *note)
27 {
28 char outchars[20];
29
30 outchars[0]=0;
31
32 if (note->tone==0) strcpy(outchars,"0");
33 else
34 if (note->tone==1) strcpy(outchars,"1");
35 else
36 if (note->tone==2) strcpy(outchars,"1#");
37 else
38 if (note->tone==3) strcpy(outchars,"2");
39 else
40 if (note->tone==4) strcpy(outchars,"2#");
41 else
42 if (note->tone==5) strcpy(outchars,"3");
43 else
44 if (note->tone==6) strcpy(outchars,"4");
45 else
46 if (note->tone==7) strcpy(outchars,"4#");
47 else
48 if (note->tone==8) strcpy(outchars,"5");
49 else
50 if (note->tone==9) strcpy(outchars,"5#");
51 else
52 if (note->tone==10) strcpy(outchars,"6");
53 else
54 if (note->tone==11) strcpy(outchars,"6#");
55 else
56 if (note->tone==12) strcpy(outchars,"7");
57 else
58 { strcpy(outchars,"0"); }
59
60 if (note->tone!=0)
61 {
62 if (note->transpose==-1)
63 {
64 if (note->scale==0) strcat(outchars,"88");
65 else
66 if (note->scale==2) strcat(outchars,"8");
67 }
68 else
69 {
70 if (note->scale==1) strcat(outchars,"8");
71 }
72 }
73
74 if (note->length==0) strcat(outchars,"**");
75 else
76 if (note->length==1) strcat(outchars,"*");
77 else
78 if (note->length==3) strcat(outchars,"****");
79 else
80 if (note->length==4) strcat(outchars,"***");
81 else
82 if (note->length==5) strcat(outchars,"***");
83
84 if (note->modifier!=0)
85 {
86 if (note->length==0) strcat(outchars," 0*");
87 else
88 if (note->length==1) strcat(outchars," 0");
89 else
90 if (note->length==2) strcat(outchars," 0****");
91 else
92 if (note->length==3) strcat(outchars," 0***");
93 else
94 if (note->length==4) strcat(outchars," 0***");
95 else
96 if (note->length==5) strcat(outchars," 0***");
97 }
98
99 strcat(outchars," ");
100 fprintf(out,"%s",outchars);
101
102 note->bytes=note->bytes+strlen(outchars);
103
104 if (note->bytes>70)
105 {
106 fprintf(out,"\n");
107 note->bytes=0;
108 }
109 }
110
write_samsung2_note(FILE * out,struct note_t * note)111 void write_samsung2_note(FILE *out, struct note_t *note)
112 {
113 char outchars[20];
114
115 outchars[0]=0;
116
117 if (note->tone==1) strcpy(outchars,"1");
118 else
119 if (note->tone==2) strcpy(outchars,"1^");
120 else
121 if (note->tone==3) strcpy(outchars,"2");
122 else
123 if (note->tone==4) strcpy(outchars,"2^");
124 else
125 if (note->tone==5) strcpy(outchars,"3");
126 else
127 if (note->tone==6) strcpy(outchars,"4");
128 else
129 if (note->tone==7) strcpy(outchars,"4^");
130 else
131 if (note->tone==8) strcpy(outchars,"5");
132 else
133 if (note->tone==9) strcpy(outchars,"5^");
134 else
135 if (note->tone==10) strcpy(outchars,"6");
136 else
137 if (note->tone==11) strcpy(outchars,"6^");
138 else
139 if (note->tone==12) strcpy(outchars,"7");
140 else
141 if (note->tone!=0)
142 { strcpy(outchars,"1"); note->tone=1; }
143
144 if (note->tone!=0)
145 {
146 if (note->transpose==-1)
147 {
148 if (note->scale==0) strcat(outchars,"88");
149 else
150 if (note->scale==2) strcat(outchars,"8");
151 }
152 else
153 {
154 if (note->scale==1) strcat(outchars,"8");
155 }
156
157 if (note->length==0) strcat(outchars,"<<<<");
158 else
159 if (note->length==1) strcat(outchars,"<<<");
160 else
161 if (note->length==3) strcat(outchars,"<");
162 else
163 if (note->length==4) strcat(outchars,"<<");
164 else
165 if (note->length==5) strcat(outchars,"<<");
166
167 if (note->modifier!=0)
168 {
169 if (note->length==0) strcat(outchars," >>>");
170 else
171 if (note->length==1) strcat(outchars," 0");
172 else
173 if (note->length==2) strcat(outchars," >");
174 else
175 if (note->length==3) strcat(outchars," >>");
176 else
177 if (note->length==4) strcat(outchars," >>");
178 else
179 if (note->length==5) strcat(outchars," >>");
180 }
181 }
182 else
183 {
184 if (note->length==0) strcat(outchars,">>>>");
185 else
186 if (note->length==1) strcat(outchars,">>>");
187 else
188 if (note->length==2) strcat(outchars,"0");
189 else
190 if (note->length==3) strcat(outchars,">");
191 else
192 if (note->length==4) strcat(outchars,">>");
193 else
194 if (note->length==5) strcat(outchars,">>");
195 }
196 strcat(outchars," ");
197 fprintf(out,"%s",outchars);
198
199 note->bytes=note->bytes+strlen(outchars);
200
201 if (note->bytes>70)
202 {
203 fprintf(out,"\n");
204 note->bytes=0;
205 }
206 }
207
write_samsung_footer(FILE * out,struct note_t * note)208 void write_samsung_footer(FILE *out, struct note_t *note)
209 {
210 fprintf(out,"\n");
211 }
212
213
214