2 * \file gammu-ringtone.h
5 * Ringtone data and functions.
7 #ifndef __gammu_ringtone_h
8 #define __gammu_ringtone_h
11 * \defgroup Ringtone Ringtone
12 * Ringtones manipulations.
15 #include <gammu-types.h>
16 #include <gammu-error.h>
17 #include <gammu-limits.h>
18 #include <gammu-statemachine.h>
24 * Natural style (rest between notes)
26 NaturalStyle
= 0x00 << 6,
28 * Continuous style (no rest between notes)
30 ContinuousStyle
= 0x01 << 6,
32 * Staccato style (shorter notes and longer rest period)
34 StaccatoStyle
= 0x02 << 6
38 Note_Pause
= 0x00 << 4,
54 Duration_Full
= 0x00 << 5,
55 Duration_1_2
= 0x01 << 5,
56 Duration_1_4
= 0x02 << 5,
57 Duration_1_8
= 0x03 << 5,
58 Duration_1_16
= 0x04 << 5,
59 Duration_1_32
= 0x05 << 5
60 } GSM_RingNoteDuration
;
63 NoSpecialDuration
= 0x00 << 6,
64 DottedNote
= 0x01 << 6,
65 DoubleDottedNote
= 0x02 << 6,
66 Length_2_3
= 0x03 << 6
67 } GSM_RingNoteDurationSpec
;
80 * first scale for Nokia
86 * last scale for Nokia
94 GSM_RingNoteDuration Duration
;
95 GSM_RingNoteDurationSpec DurationSpec
;
96 GSM_RingNoteNote Note
;
97 GSM_RingNoteStyle Style
;
98 GSM_RingNoteScale Scale
;
111 } GSM_RingCommandType
;
114 GSM_RingCommandType Type
;
121 gboolean AllNotesScale
;
122 GSM_RingCommand Commands
[GSM_MAX_RINGTONE_NOTES
];
125 /* FIXME: should use BinaryTone instead? */
126 /* Structure to hold Nokia binary ringtones. */
128 unsigned char Frame
[50000];
130 } GSM_NokiaBinaryRingtone
;
133 unsigned char *Buffer
;
142 } GSM_RingtoneFormat
;
145 * Structure for saving various ringtones formats
149 * Ringtone saved in one of three formats
151 GSM_NokiaBinaryRingtone NokiaBinary
;
152 GSM_BinaryTone BinaryTone
;
153 GSM_NoteRingtone NoteTone
;
157 GSM_RingtoneFormat Format
;
161 unsigned char Name
[(GSM_MAX_RINGTONE_NAME_LENGTH
+ 1) * 2];
174 unsigned char Name
[30 * 2];
179 GSM_RingtoneInfo
*Ringtone
;
180 } GSM_AllRingtonesInfo
;
183 * Play one note using state machine interface.
185 GSM_Error
PHONE_RTTLPlayOneNote(GSM_StateMachine
* s
, GSM_RingNote note
,
189 * Makes phone beek using state machine interface.
191 GSM_Error
PHONE_Beep(GSM_StateMachine
* s
);
194 * Gets ringtone from phone.
196 GSM_Error
GSM_GetRingtone(GSM_StateMachine
* s
, GSM_Ringtone
* Ringtone
,
197 gboolean PhoneRingtone
);
199 * Sets ringtone in phone.
201 GSM_Error
GSM_SetRingtone(GSM_StateMachine
* s
, GSM_Ringtone
* Ringtone
,
204 * Acquires ringtone informaiton.
206 GSM_Error
GSM_GetRingtonesInfo(GSM_StateMachine
* s
,
207 GSM_AllRingtonesInfo
* Info
);
209 * Deletes user defined ringtones from phone.
211 GSM_Error
GSM_DeleteUserRingtones(GSM_StateMachine
* s
);
216 GSM_Error
GSM_PlayTone(GSM_StateMachine
* s
, int Herz
, unsigned char Volume
,
219 GSM_Error
GSM_RingtoneConvert(GSM_Ringtone
* dest
, GSM_Ringtone
* src
,
220 GSM_RingtoneFormat Format
);
221 GSM_Error
GSM_ReadRingtoneFile(char *FileName
, GSM_Ringtone
* ringtone
);
223 GSM_Error
GSM_SaveRingtoneFile(char *FileName
, GSM_Ringtone
* ringtone
);
225 GSM_Error
GSM_SaveRingtoneOtt(FILE * file
, GSM_Ringtone
* ringtone
);
227 GSM_Error
GSM_SaveRingtoneMidi(FILE * file
, GSM_Ringtone
* ringtone
);
229 GSM_Error
GSM_SaveRingtoneIMelody(FILE * file
, GSM_Ringtone
* ringtone
);
231 GSM_Error
GSM_SaveRingtoneWav(FILE * file
, GSM_Ringtone
* ringtone
);
233 GSM_Error
GSM_SaveRingtoneRttl(FILE * file
, GSM_Ringtone
* ringtone
);
236 * Returns ringtone name, NULL if not found.
238 const unsigned char *GSM_GetRingtoneName(const GSM_AllRingtonesInfo
* Info
, const int ID
);
240 int GSM_RTTLGetTempo(int Beats
);
244 /* Editor configuration
245 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: