1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <ctype.h>
5
6 #include "general.h"
7 #include "fileoutput.h"
8
9 /*
10
11 Ringtone Tools - Copyright 2001-2005 Michael Kohn (mike@mikekohn.net)
12 This falls under the Kohnian license. Please read
13 it at http://ringtonetools.mikekohn.net/
14
15 This program is NOT opensourced. You may not use any part
16 of this program for your own software.
17
18 */
19
20 /* eMelody for older Ericsson */
21
write_emelody_header(FILE * out,struct note_t * note)22 void write_emelody_header(FILE *out, struct note_t *note)
23 {
24
25 }
26
write_emelody_note(FILE * out,struct note_t * note)27 void write_emelody_note(FILE *out, struct note_t *note)
28 {
29 char outchars[5];
30
31 if (note->scale==1)
32 { fprintf(out,"+"); }
33 else
34 if (note->scale>=2)
35 { fprintf(out,"++"); }
36
37 if (note->tone==0) strcpy(outchars,"P");
38 else
39 if (note->tone==1) strcpy(outchars,"C");
40 else
41 if (note->tone==2) strcpy(outchars,"C#");
42 else
43 if (note->tone==3) strcpy(outchars,"D");
44 else
45 if (note->tone==4) strcpy(outchars,"D#");
46 else
47 if (note->tone==5) strcpy(outchars,"E");
48 else
49 if (note->tone==6) strcpy(outchars,"F");
50 else
51 if (note->tone==7) strcpy(outchars,"F#");
52 else
53 if (note->tone==8) strcpy(outchars,"G");
54 else
55 if (note->tone==9) strcpy(outchars,"G#");
56 else
57 if (note->tone==10) strcpy(outchars,"A");
58 else
59 if (note->tone==11) strcpy(outchars,"A#");
60 else
61 if (note->tone==12) strcpy(outchars,"B");
62 else
63 { strcpy(outchars,"C"); }
64
65 if (note->length>=3) outchars[0]=tolower(outchars[0]);
66
67 if (note->modifier>0) strcat(outchars,".");
68
69 fprintf(out,"%s",outchars);
70 }
71
write_emelody_footer(FILE * out,struct note_t * note)72 void write_emelody_footer(FILE *out, struct note_t *note)
73 {
74
75 }
76
77
78