:pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
[gnokii.git] / include / fbus-6110-ringtones.h
1 /*
2
3   $Id$
4
5   G N O K I I
6
7   A Linux/Unix toolset and driver for Nokia mobile phones.
8
9   Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml.
10
11   Released under the terms of the GNU GPL, see file COPYING for more details.
12
13   This file provides definitions of macros from the Smart Messaging
14   Specification. It is mainly rewrite of the spec to C :-) Viva Nokia!
15
16   $Log$
17   Revision 1.1.1.1  2001/11/25 21:59:19  short
18   :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
19
20   Revision 1.11  2001/06/28 00:28:45  pkot
21   Small docs updates (Pawel Kot)
22
23
24 */
25
26 #ifndef __fbus_6110_ringtones_h
27 #define __fbus_6110_ringtones_h
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <ctype.h>
33 #include "misc.h"
34 #include "gsm-common.h"
35 #include "fbus-6110.h"
36
37 #define GetBit(Stream,BitNr) Stream[(BitNr)/8] & 1<<(7-((BitNr)%8))
38 #define SetBit(Stream,BitNr) Stream[(BitNr)/8] |= 1<<(7-((BitNr)%8))
39 #define ClearBit(Stream,BitNr) Stream[(BitNr)/8] &= 255 - (1 << (7-((BitNr)%8)))
40
41 /* These values are from Smart Messaging Specification Revision 2.0.0 pages
42    3-23, ..., 3-29 */
43
44 /* Command-Part Encoding */
45
46 #define CancelCommand          (0x05<<1) /* binary 0000 101 */
47 #define RingingToneProgramming (0x25<<1) /* binary 0100 101 */
48 #define Sound                  (0x1d<<1) /* binary 0011 101 */
49 #define Unicode                (0x22<<1) /* binary 0100 010 */
50
51 /* Song-Type Encoding */
52
53 #define BasicSongType     (0x01<<5) /* binary 001 */
54 #define TemporarySongType (0x02<<5) /* binary 010 */
55 #define MidiSongType      (0x03<<5) /* binary 011 */
56 #define DigitizedSongType (0x04<<5) /* binary 100 */
57
58 /* Instruction ID Encoding */
59
60 #define PatternHeaderId      (0x00<<5) /* binary 000 */
61 #define NoteInstructionId    (0x01<<5) /* binary 001 */
62 #define ScaleInstructionId   (0x02<<5) /* binary 010 */
63 #define StyleInstructionId   (0x03<<5) /* binary 011 */
64 #define TempoInstructionId   (0x04<<5) /* binary 100 */
65 #define VolumeInstructionId (0x05<<5) /* binary 101 */
66
67 /* Style-Value Encoding*/
68
69 #define NaturalStyle    (0x00<<6) /* binary 00 */
70 #define ContinuousStyle (0x01<<6) /* binary 01 */
71 #define StaccatoStyle   (0x02<<6) /* binary 11 */
72
73 /* Note-Scale Encoding  */
74
75 #define Scale1 (0x00<<6) /* binary 00 */
76 #define Scale2 (0x01<<6) /* binary 01 */
77 #define Scale3 (0x02<<6) /* binary 10 */
78 #define Scale4 (0x03<<6) /* binary 11 */
79
80 /* Note-Value Encoding */
81
82 #define Note_Pause (0x00<<4) /* binary 0000 */
83 #define Note_C     (0x01<<4) /* binary 0001 */
84 #define Note_Cis   (0x02<<4) /* binary 0010 */
85 #define Note_D     (0x03<<4) /* binary 0011 */
86 #define Note_Dis   (0x04<<4) /* binary 0100 */
87 #define Note_E     (0x05<<4) /* binary 0101 */
88 #define Note_F     (0x06<<4) /* binary 0110 */
89 #define Note_Fis   (0x07<<4) /* binary 0111 */
90 #define Note_G     (0x08<<4) /* binary 1000 */
91 #define Note_Gis   (0x09<<4) /* binary 1001 */
92 #define Note_A     (0x0a<<4) /* binary 1010 */
93 #define Note_Ais   (0x0b<<4) /* binary 1011 */
94 #define Note_H     (0x0c<<4) /* binary 1100 */
95
96 /* Note-Duration Encoding */
97
98 #define Duration_Full (0x00<<5) /* binary 000 */
99 #define Duration_1_2  (0x01<<5) /* binary 001 */
100 #define Duration_1_4  (0x02<<5) /* binary 010 */
101 #define Duration_1_8  (0x03<<5) /* binary 011 */
102 #define Duration_1_16 (0x04<<5) /* binary 100 */
103 #define Duration_1_32 (0x05<<5) /* binary 101 */
104
105 /* Note-Duration-Specifier Encoding */
106
107 #define NoSpecialDuration (0x00<<6) /* binary 00 */
108 #define DottedNote        (0x01<<6) /* binary 01 */
109 #define DoubleDottedNote  (0x02<<6) /* binary 10 */
110 #define Length_2_3        (0x03<<6) /* binary 11 */
111
112 /* Pattern ID Encoding */
113 #define A_part (0x00<<6) /* binary 00 */
114 #define B_part (0x01<<6) /* binary 01 */
115 #define C_part (0x02<<6) /* binary 10 */
116 #define D_part (0x03<<6) /* binary 11 */
117
118 /* Command-End */
119
120 #define CommandEnd (0x00) /* binary 00000000 */
121
122 /* Definition of the Note type */
123
124 typedef struct {
125   int Scale;
126   int NoteID;
127   int Duration;
128   int DurationSpecifier;
129 } Note;
130
131 #define FB61_MAX_RINGTONE_PACKAGE_LENGTH 200
132
133 /* From PC Composer help */
134 #define FB61_MAX_RINGTONE_NOTES 130
135
136 u8 FB61_PackRingtone(GSM_Ringtone *ringtone, char *package, int *maxlength);
137 GSM_Error FB61_UnPackRingtone(GSM_Ringtone *ringtone, char *package, int maxlength);
138 int FB61_GetDuration(int number, unsigned char *spec);
139 int FB61_GetNote(int number);
140 int FB61_GetScale(int number);
141
142 #endif  /* __fbus_6110_ringtones_h */