-rw-r--r-- | gammu/emb/common/service/gsmring.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 @@ -95,26 +95,30 @@ GSM_Error savewav(FILE *file, GSM_Ringtone *ringtone) long i,j,length=0; double phase=0,phase_step; fwrite(&WAV_Header, 1, sizeof(WAV_Header), file); fwrite(&FMT_Header, 1, sizeof(FMT_Header), file); fwrite(&DATA_Header, 1, sizeof(DATA_Header), file); for (i=0;i<ringtone->NoteTone.NrCommands;i++) { if (ringtone->NoteTone.Commands[i].Type == RING_Note) { Note = &ringtone->NoteTone.Commands[i].Note; phase_step = GSM_RingNoteGetFrequency(*Note)*WAV_SAMPLE_RATE*1.5; for (j=0;j<((long)(GSM_RingNoteGetFullDuration(*Note)*WAV_SAMPLE_RATE/70));j++) { - /*DATA_Buffer[j] = ((int)(sin(phase*PI)*50000));*/ +#ifdef DESKTOP_VERSION + DATA_Buffer[j] = ((int)(sin(phase*PI)*50000)); +#else + // we have no sin on Zaurus DATA_Buffer[j] = ((int)(0.5*50000)); +#endif phase = phase + phase_step; length++; } fwrite(&DATA_Buffer,sizeof(short),j,file); } } wavfilesize = sizeof(WAV_Header) + sizeof(FMT_Header) + sizeof(DATA_Header) + length*2; WAV_Header[4] = ((unsigned char)wavfilesize % 256); WAV_Header[5] = ((unsigned char)wavfilesize / 256); WAV_Header[6] = ((unsigned char)wavfilesize / (256*256)); WAV_Header[7] = ((unsigned char)wavfilesize / (256*256*256)); |