1 #ifndef __gsm_ringtones_h
2 #define __gsm_ringtones_h
4 /* --------------- Smart Messaging Specification 2.0 & 3.0 ----------------- */
6 /* Command-Part Encoding */
7 #define RingingToneProgramming (0x25<<1) /* binary 0100 101 */
8 #define Sound (0x1d<<1) /* binary 0011 101 */
11 /* Song-Type Encoding */
12 #define BasicSongType (0x01<<5) /* binary 001 */
15 /* Instruction ID Encoding */
16 #define PatternHeaderId (0x00<<5) /* binary 000 */
17 #define NoteInstructionId (0x01<<5) /* binary 001 */
18 #define ScaleInstructionId (0x02<<5) /* binary 010 */
19 #define StyleInstructionId (0x03<<5) /* binary 011 */
20 #define TempoInstructionId (0x04<<5) /* binary 100 */
21 #define VolumeInstructionId (0x05<<5) /* binary 101 */
23 /* Pattern ID Encoding */
24 #define A_part (0x00<<6) /* binary 00 */
28 #define CommandEnd (0x00) /* binary 00000000 */
30 /* ------ end of Smart Messaging Specification 2.0 & 3.0 definitions ------- */
32 #define MAX_RINGTONE_NOTES 255
34 /* Style-Value Encoding*/
36 NaturalStyle
= (0x00<<6), /* binary 00 */
37 ContinuousStyle
= (0x01<<6), /* binary 01 */
38 StaccatoStyle
= (0x02<<6) /* binary 10 */
41 /* Note-Value Encoding */
43 Note_Pause
= (0x00<<4), /* binary 0000 */
44 Note_C
= (0x01<<4), /* binary 0001 */
45 Note_Cis
= (0x02<<4), /* binary 0010 */
46 Note_D
= (0x03<<4), /* binary 0011 */
47 Note_Dis
= (0x04<<4), /* binary 0100 */
48 Note_E
= (0x05<<4), /* binary 0101 */
49 Note_F
= (0x06<<4), /* binary 0110 */
50 Note_Fis
= (0x07<<4), /* binary 0111 */
51 Note_G
= (0x08<<4), /* binary 1000 */
52 Note_Gis
= (0x09<<4), /* binary 1001 */
53 Note_A
= (0x0a<<4), /* binary 1010 */
54 Note_Ais
= (0x0b<<4), /* binary 1011 */
55 Note_H
= (0x0c<<4) /* binary 1100 */
58 /* Note-Duration Encoding */
60 Duration_Full
= (0x00<<5), /* binary 000 */
61 Duration_1_2
= (0x01<<5), /* binary 001 */
62 Duration_1_4
= (0x02<<5), /* binary 010 */
63 Duration_1_8
= (0x03<<5), /* binary 011 */
64 Duration_1_16
= (0x04<<5), /* binary 100 */
65 Duration_1_32
= (0x05<<5) /* binary 101 */
66 } GSM_RingNoteDuration
;
68 /* Note-Duration-Specifier Encoding */
70 NoSpecialDuration
= (0x00<<6), /* binary 00 */
71 DottedNote
= (0x01<<6), /* binary 01 */
72 DoubleDottedNote
= (0x02<<6), /* binary 10 */
73 Length_2_3
= (0x03<<6), /* binary 11 */
74 } GSM_RingNoteDurationSpec
;
77 Scale_55
= 1, /* 55 Hz for note A */
78 Scale_110
, /* 110 Hz for note A */
80 Scale_440
, /* first scale for Nokia phones */
83 Scale_3520
, /* last scale for Nokia phones */
89 GSM_RingNoteDuration Duration
;
90 GSM_RingNoteDurationSpec DurationSpec
;
91 GSM_RingNoteNote Note
;
92 GSM_RingNoteStyle Style
;
93 GSM_RingNoteScale Scale
;
106 } GSM_RingCommandType
;
109 GSM_RingCommandType Type
;
116 GSM_RingCommand Commands
[MAX_RINGTONE_NOTES
];
120 /* Structure to hold Nokia binary ringtones. */
122 unsigned char Frame
[30000];
124 } GSM_NokiaBinaryRingtone
;
127 unsigned char *Frame
;
135 } GSM_RingtoneFormat
;
138 GSM_NokiaBinaryRingtone NokiaBinary
;
140 GSM_BinaryTone BinaryTone
;
141 GSM_NoteRingtone NoteTone
;
142 GSM_RingtoneFormat Format
;
154 GSM_RingtoneInfo Ringtone
[100];
155 } GSM_AllRingtonesInfo
;
157 GSM_Error
GSM_SaveRingtoneFile(char *FileName
, GSM_Ringtone
*ringtone
);
158 GSM_Error
GSM_ReadRingtoneFile(char *FileName
, GSM_Ringtone
*ringtone
);
160 GSM_Error
saverttl(FILE *file
, GSM_Ringtone
*ringtone
);
162 unsigned char GSM_EncodeNokiaRTTLRingtone (GSM_Ringtone ringtone
, unsigned char *package
, int *maxlength
);
163 unsigned char GSM_EncodeEMSSound (GSM_Ringtone ringtone
, unsigned char *package
, int *maxlength
, double version
, bool start
);
165 GSM_Error
GSM_DecodeNokiaRTTLRingtone (GSM_Ringtone
*ringtone
, unsigned char *package
, int maxlength
);
167 GSM_Error
GSM_RingtoneConvert(GSM_Ringtone
*dest
, GSM_Ringtone
*src
, GSM_RingtoneFormat Format
);
169 int GSM_RTTLGetTempo (int Beats
);
170 int GSM_RingNoteGetFrequency (GSM_RingNote Note
);
171 int GSM_RingNoteGetFullDuration (GSM_RingNote Note
);
173 char *GSM_GetRingtoneName(GSM_AllRingtonesInfo
*Info
, int ID
);
177 /* How should editor hadle tabs in this file? Add editor commands here.
178 * vim: noexpandtab sw=8 ts=8 sts=8: