-rw-r--r-- | gammu/emb/common/common.pro | 1 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmring.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gammu/emb/common/common.pro b/gammu/emb/common/common.pro index 9342cb7..0e719ee 100644 --- a/gammu/emb/common/common.pro +++ b/gammu/emb/common/common.pro | |||
@@ -151,36 +151,37 @@ protocol/alcatel/alcabus.c \ | |||
151 | protocol/nokia/mbus2.c \ | 151 | protocol/nokia/mbus2.c \ |
152 | protocol/nokia/fbus2.c \ | 152 | protocol/nokia/fbus2.c \ |
153 | protocol/nokia/phonet.c \ | 153 | protocol/nokia/phonet.c \ |
154 | protocol/obex/obex.c \ | 154 | protocol/obex/obex.c \ |
155 | protocol/symbian/mrouter.c \ | 155 | protocol/symbian/mrouter.c \ |
156 | phone/pfunc.c \ | 156 | phone/pfunc.c \ |
157 | phone/at/atgen.c \ | 157 | phone/at/atgen.c \ |
158 | phone/at/siemens.c \ | 158 | phone/at/siemens.c \ |
159 | phone/at/sonyeric.c \ | 159 | phone/at/sonyeric.c \ |
160 | phone/alcatel/alcatel.c \ | 160 | phone/alcatel/alcatel.c \ |
161 | phone/nokia/dct3/n6110.c \ | 161 | phone/nokia/dct3/n6110.c \ |
162 | phone/nokia/dct3/n7110.c \ | 162 | phone/nokia/dct3/n7110.c \ |
163 | phone/nokia/dct3/n9210.c \ | 163 | phone/nokia/dct3/n9210.c \ |
164 | phone/nokia/dct3/dct3func.c \ | 164 | phone/nokia/dct3/dct3func.c \ |
165 | phone/nokia/dct4/n3320.c \ | 165 | phone/nokia/dct4/n3320.c \ |
166 | phone/nokia/dct4/n3650.c \ | 166 | phone/nokia/dct4/n3650.c \ |
167 | phone/nokia/dct4/n6510.c \ | 167 | phone/nokia/dct4/n6510.c \ |
168 | phone/nokia/dct4/dct4func.c \ | 168 | phone/nokia/dct4/dct4func.c \ |
169 | phone/nokia/nauto.c \ | 169 | phone/nokia/nauto.c \ |
170 | phone/nokia/nfunc.c \ | 170 | phone/nokia/nfunc.c \ |
171 | phone/nokia/nfuncold.c \ | 171 | phone/nokia/nfuncold.c \ |
172 | phone/obex/obexgen.c \ | 172 | phone/obex/obexgen.c \ |
173 | phone/symbian/mroutgen.c | 173 | phone/symbian/mroutgen.c |
174 | 174 | ||
175 | DEFINES += DESKTOP_VERSION | ||
175 | TARGET = microgammu | 176 | TARGET = microgammu |
176 | CONFIG = warn_off release console | 177 | CONFIG = warn_off release console |
177 | DESTDIR = ../../../bin | 178 | DESTDIR = ../../../bin |
178 | OBJECTS_DIR = obj/unix | 179 | OBJECTS_DIR = obj/unix |
179 | MOC_DIR = moc/unix | 180 | MOC_DIR = moc/unix |
180 | 181 | ||
181 | unix: { | 182 | unix: { |
182 | SOURCES += device/serial/ser_unx.c | 183 | SOURCES += device/serial/ser_unx.c |
183 | } | 184 | } |
184 | win32:{ | 185 | win32:{ |
185 | SOURCES += device/serial/ser_w32.c | 186 | SOURCES += device/serial/ser_w32.c |
186 | } | 187 | } |
diff --git a/gammu/emb/common/service/gsmring.c b/gammu/emb/common/service/gsmring.c index f7f7082..7df46f1 100644 --- a/gammu/emb/common/service/gsmring.c +++ b/gammu/emb/common/service/gsmring.c | |||
@@ -83,50 +83,54 @@ GSM_Error savewav(FILE *file, GSM_Ringtone *ringtone) | |||
83 | 'R','I','F','F', | 83 | 'R','I','F','F', |
84 | 0x00,0x00,0x00,0x00,/* Length */ | 84 | 0x00,0x00,0x00,0x00,/* Length */ |
85 | 'W','A','V','E'}; | 85 | 'W','A','V','E'}; |
86 | unsigned char FMT_Header[] = {'f','m','t',' ', | 86 | unsigned char FMT_Header[] = {'f','m','t',' ', |
87 | 0x10,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x44,0xac, | 87 | 0x10,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x44,0xac, |
88 | 0x00,0x00,0x88,0x58,0x01,0x00,0x02,0x00,0x10,0x00}; | 88 | 0x00,0x00,0x88,0x58,0x01,0x00,0x02,0x00,0x10,0x00}; |
89 | unsigned char DATA_Header[] = { | 89 | unsigned char DATA_Header[] = { |
90 | 'd','a','t','a', | 90 | 'd','a','t','a', |
91 | 0x00,0x00,0x00,0x00};/* Length */ | 91 | 0x00,0x00,0x00,0x00};/* Length */ |
92 | short DATA_Buffer[60000]; | 92 | short DATA_Buffer[60000]; |
93 | long wavfilesize; | 93 | long wavfilesize; |
94 | GSM_RingNote *Note; | 94 | GSM_RingNote *Note; |
95 | long i,j,length=0; | 95 | long i,j,length=0; |
96 | double phase=0,phase_step; | 96 | double phase=0,phase_step; |
97 | 97 | ||
98 | fwrite(&WAV_Header, 1, sizeof(WAV_Header),file); | 98 | fwrite(&WAV_Header, 1, sizeof(WAV_Header),file); |
99 | fwrite(&FMT_Header, 1, sizeof(FMT_Header),file); | 99 | fwrite(&FMT_Header, 1, sizeof(FMT_Header),file); |
100 | fwrite(&DATA_Header, 1, sizeof(DATA_Header),file); | 100 | fwrite(&DATA_Header, 1, sizeof(DATA_Header),file); |
101 | 101 | ||
102 | for (i=0;i<ringtone->NoteTone.NrCommands;i++) { | 102 | for (i=0;i<ringtone->NoteTone.NrCommands;i++) { |
103 | if (ringtone->NoteTone.Commands[i].Type == RING_Note) { | 103 | if (ringtone->NoteTone.Commands[i].Type == RING_Note) { |
104 | Note = &ringtone->NoteTone.Commands[i].Note; | 104 | Note = &ringtone->NoteTone.Commands[i].Note; |
105 | phase_step = GSM_RingNoteGetFrequency(*Note)*WAV_SAMPLE_RATE*1.5; | 105 | phase_step = GSM_RingNoteGetFrequency(*Note)*WAV_SAMPLE_RATE*1.5; |
106 | for (j=0;j<((long)(GSM_RingNoteGetFullDuration(*Note)*WAV_SAMPLE_RATE/70));j++) { | 106 | for (j=0;j<((long)(GSM_RingNoteGetFullDuration(*Note)*WAV_SAMPLE_RATE/70));j++) { |
107 | /*DATA_Buffer[j] = ((int)(sin(phase*PI)*50000));*/ | 107 | #ifdef DESKTOP_VERSION |
108 | DATA_Buffer[j] = ((int)(sin(phase*PI)*50000)); | ||
109 | #else | ||
110 | // we have no sin on Zaurus | ||
108 | DATA_Buffer[j] = ((int)(0.5*50000)); | 111 | DATA_Buffer[j] = ((int)(0.5*50000)); |
112 | #endif | ||
109 | phase = phase + phase_step; | 113 | phase = phase + phase_step; |
110 | length++; | 114 | length++; |
111 | } | 115 | } |
112 | fwrite(&DATA_Buffer,sizeof(short),j,file); | 116 | fwrite(&DATA_Buffer,sizeof(short),j,file); |
113 | } | 117 | } |
114 | } | 118 | } |
115 | 119 | ||
116 | wavfilesize = sizeof(WAV_Header) + sizeof(FMT_Header) + sizeof(DATA_Header) + length*2; | 120 | wavfilesize = sizeof(WAV_Header) + sizeof(FMT_Header) + sizeof(DATA_Header) + length*2; |
117 | WAV_Header[4] = ((unsigned char)wavfilesize % 256); | 121 | WAV_Header[4] = ((unsigned char)wavfilesize % 256); |
118 | WAV_Header[5] = ((unsigned char)wavfilesize / 256); | 122 | WAV_Header[5] = ((unsigned char)wavfilesize / 256); |
119 | WAV_Header[6] = ((unsigned char)wavfilesize / (256*256)); | 123 | WAV_Header[6] = ((unsigned char)wavfilesize / (256*256)); |
120 | WAV_Header[7] = ((unsigned char)wavfilesize / (256*256*256)); | 124 | WAV_Header[7] = ((unsigned char)wavfilesize / (256*256*256)); |
121 | wavfilesize = wavfilesize - 54; | 125 | wavfilesize = wavfilesize - 54; |
122 | DATA_Header[4] = ((unsigned char)wavfilesize % 256); | 126 | DATA_Header[4] = ((unsigned char)wavfilesize % 256); |
123 | DATA_Header[5] = ((unsigned char)wavfilesize / 256); | 127 | DATA_Header[5] = ((unsigned char)wavfilesize / 256); |
124 | DATA_Header[6] = ((unsigned char)wavfilesize / (256*256)); | 128 | DATA_Header[6] = ((unsigned char)wavfilesize / (256*256)); |
125 | DATA_Header[7] = ((unsigned char)wavfilesize / (256*256*256)); | 129 | DATA_Header[7] = ((unsigned char)wavfilesize / (256*256*256)); |
126 | 130 | ||
127 | fseek( file, 0, SEEK_SET); | 131 | fseek( file, 0, SEEK_SET); |
128 | fwrite(&WAV_Header, 1, sizeof(WAV_Header),file); | 132 | fwrite(&WAV_Header, 1, sizeof(WAV_Header),file); |
129 | fwrite(&FMT_Header, 1, sizeof(FMT_Header),file); | 133 | fwrite(&FMT_Header, 1, sizeof(FMT_Header),file); |
130 | fwrite(&DATA_Header, 1, sizeof(DATA_Header),file); | 134 | fwrite(&DATA_Header, 1, sizeof(DATA_Header),file); |
131 | 135 | ||
132 | return ERR_NONE; | 136 | return ERR_NONE; |