http://marcin-wiacek.fkn.pl/english/zips/mygnokii.tar.gz
[gnokii.git] / include / gsm-ringtones.h
index 11c44b5..92e439e 100644 (file)
@@ -1,26 +1,14 @@
 /*
 
-  $Id$
-
   G N O K I I
 
   A Linux/Unix toolset and driver for Nokia mobile phones.
 
-  Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml.
-
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
   This file provides definitions of macros from the Smart Messaging
   Specification. It is mainly rewrite of the spec to C :-) Viva Nokia!
 
-  $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:20  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.2  2001/06/28 00:28:46  pkot
-  Small docs updates (Pawel Kot)
-
-
 */
 
 #ifndef __gsm_ringtones_h
 #include <ctype.h>
 #include "misc.h"
 #include "gsm-common.h"
+#include "gsm-sms.h"
+
+#define MAX_RINGTONE_NOTES 255
+
+/* Structure to hold note of ringtone. */
+/* NoteValue is encoded as octave(scale)*14 + note */
+/* where for note: c=0, d=2, e=4 .... */
+/* ie. c#=1 and 5 and 13 are invalid */
+/* note=255 means a pause */
+typedef struct {
+  u8 duration;
+  u8 note;
+  int tempo;
+  u8 style;
+} GSM_RingtoneNote;
+
+/* Structure to hold ringtones. */
+typedef struct {
+  char name[20];
+  unsigned char Loop;
+  u8 NrNotes;
+  GSM_RingtoneNote notes[256];
+  bool allnotesscale; /* Some Nokia phones doesn't receive correctly some
+                         ringtones without it. N3310 4.02 */
+  int location;
+} GSM_Ringtone;
+  
+/* Structure to hold binary ringtones. */
+
+typedef struct {
+  char name[20];
+  unsigned char frame[1000];
+  int length;
+  int location;
+} GSM_BinRingtone;
 
 #define GetBit(Stream,BitNr) Stream[(BitNr)/8] & 1<<(7-((BitNr)%8))
 #define SetBit(Stream,BitNr) Stream[(BitNr)/8] |= 1<<(7-((BitNr)%8))
@@ -45,6 +68,8 @@
 #define CancelCommand          (0x05<<1) /* binary 0000 101 */
 #define RingingToneProgramming (0x25<<1) /* binary 0100 101 */
 #define Sound                  (0x1d<<1) /* binary 0011 101 */
+/* MW: I didn't find phone, which can unpack ringtone with Unicode
+   command. Tested 3310, 6150 */
 #define Unicode                (0x22<<1) /* binary 0100 010 */
 
 /* Song-Type Encoding */
 #define ScaleInstructionId   (0x02<<5) /* binary 010 */
 #define StyleInstructionId   (0x03<<5) /* binary 011 */
 #define TempoInstructionId   (0x04<<5) /* binary 100 */
-#define VolumeInstructionId (0x05<<5) /* binary 101 */
+#define VolumeInstructionId  (0x05<<5) /* binary 101 */
 
 /* Style-Value Encoding*/
 
 #define NaturalStyle    (0x00<<6) /* binary 00 */
 #define ContinuousStyle (0x01<<6) /* binary 01 */
-#define StaccatoStyle   (0x02<<6) /* binary 11 */
+#define StaccatoStyle   (0x02<<6) /* binary 10 */
 
 /* Note-Scale Encoding  */
 
 #define D_part (0x03<<6) /* binary 11 */
 
 /* Command-End */
-
 #define CommandEnd (0x00) /* binary 00000000 */
 
-/* Definition of the Note type */
+u8 GSM_PackRingtone(GSM_Ringtone *ringtone, unsigned char *package, int *maxlength);
+GSM_Error GSM_UnPackRingtone(GSM_Ringtone *ringtone, char *package, int maxlength);
+
+int GSM_GetDuration(int number, unsigned char *spec);
+int GSM_GetNote(int number);
+int GSM_GetScale(int number);
+int GSM_GetTempo(int Beats);
 
-typedef struct {
-  int Scale;
-  int NoteID;
-  int Duration;
-  int DurationSpecifier;
-} Note;
+void GSM_PlayOneNote (GSM_RingtoneNote note);
+void GSM_PlayRingtone (GSM_Ringtone *ringtone);
 
-#define GSM_MAX_RINGTONE_PACKAGE_LENGTH 200
+int GSM_GetFrequency(int number);
 
-/* From PC Composer help */
-#define GSM_MAX_RINGTONE_NOTES 130
+GSM_Error GSM_ReadRingtone(GSM_SMSMessage *message, GSM_Ringtone *ringtone);
 
-u8 GSM_PackRingtone(GSM_Ringtone *ringtone, char *package, int *maxlength);
-GSM_Error GSM_UnPackRingtone(GSM_Ringtone *ringtone, char *package, int maxlength);
+int GSM_SaveRingtoneToSMS(GSM_MultiSMSMessage *SMS,
+                          GSM_Ringtone *ringtone,bool profilestyle);
 
-int GSM_GetNote(int number);
+/* FIXME: For each phone probaby different */
+#define FB61_MAX_RINGTONE_FRAME_LENGTH 200
+
+/* Smart Messaging 3.0 says: 16*9=144 bytes,
+   but on 3310 4.02 it was possible to save about 196 chars (without cutting) */
+#define SM30_MAX_RINGTONE_FRAME_LENGTH 196
+
+/* Like PC Composer help say */
+#define FB61_MAX_RINGTONE_NOTES 130
+
+/* Nokia ringtones codes. */
+
+struct OneRingtone {
+  char name[30];
+  int menu;
+  int code;
+};
+
+void PrepareRingingTones(char model[64], char rev[64]);
+
+/* returns names from code or number in menu */
+char *RingingToneName(int code, int menu);
+
+/* returns code from number in menu */
+int RingingToneCode(int menu);
+
+/* returns number in menu from code */
+int RingingToneMenu(int code);
+
+int NumberOfRingtones();
 
 #endif /* __gsm_ringtones_h */