X-Git-Url: http://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=common%2Fgsm-ringtones.c;fp=common%2Fgsm-ringtones.c;h=3db43b626198ff4e9fbad10f29337f7b54682388;hp=588ddadfe44392ae537754835d26ff9a34693b93;hb=16d6d9757f8f23ed360af772aea29746f500c4e6;hpb=e1d841a2623bbadcc1b5fa0332acdd6b568720bf diff --git a/common/gsm-ringtones.c b/common/gsm-ringtones.c index 588ddad..3db43b6 100644 --- a/common/gsm-ringtones.c +++ b/common/gsm-ringtones.c @@ -223,62 +223,62 @@ u8 GSM_PackRingtone(GSM_Ringtone *ringtone, unsigned char *package, int *maxleng int DefNoteTempo=63; u8 DefNoteStyle=NaturalStyle; - int buffer[6]; /* Used to find default ringtone parameters */ - int i,j,k=0,thisnote,thisnotelong; + int buffer[6]; /* Used to find default ringtone parameters */ + int i,j,k=0,thisnote,thisnotelong; - /* Find the most frequently used duration and use this for the default */ - for (i=0;i<6;i++) buffer[i]=0; - for (i=0;iNrNotes;i++) { - switch (ringtone->notes[i].duration) { - case 192: buffer[0]++; break; - case 128: buffer[0]++; break; - case 96: buffer[1]++; break; - case 64: buffer[1]++; break; - case 48: buffer[2]++; break; - case 32: buffer[2]++; break; - case 24: buffer[3]++; break; - case 16: buffer[3]++; break; - case 12: buffer[4]++; break; - case 8: buffer[4]++; break; - case 6: buffer[5]++; break; - case 4: buffer[5]++; break; - } - } - - /* Now find the most frequently used */ - j=0; - for (i=0;i<6;i++) { - if (buffer[i]>j) { - k=i; - j=buffer[i]; - } - } - - /* Finally convert the default duration */ - switch (k) { - case 0: DefNoteDuration=128; break; - case 1: DefNoteDuration= 64; break; - case 2: DefNoteDuration= 32; break; - case 3: DefNoteDuration= 16; break; - case 4: DefNoteDuration= 8; break; - case 5: DefNoteDuration= 4; break; - default: DefNoteDuration= 16; break; - } - - /* Find the most frequently used scale and use this for the default */ - for (i=0;i<6;i++) buffer[i]=0; - for (i=0;iNrNotes;i++) { - if (ringtone->notes[i].note!=255) { - buffer[ringtone->notes[i].note/14]++; - } - } - j=0; - for (i=0;i<6;i++) { - if (buffer[i]>j) { - DefNoteScale=i; - j=buffer[i]; - } - } + /* Find the most frequently used duration and use this for the default */ + for (i=0;i<6;i++) buffer[i]=0; + for (i=0;iNrNotes;i++) { + switch (ringtone->notes[i].duration) { + case 192: buffer[0]++; break; + case 128: buffer[0]++; break; + case 96: buffer[1]++; break; + case 64: buffer[1]++; break; + case 48: buffer[2]++; break; + case 32: buffer[2]++; break; + case 24: buffer[3]++; break; + case 16: buffer[3]++; break; + case 12: buffer[4]++; break; + case 8: buffer[4]++; break; + case 6: buffer[5]++; break; + case 4: buffer[5]++; break; + } + } + + /* Now find the most frequently used */ + j=0; + for (i=0;i<6;i++) { + if (buffer[i]>j) { + k=i; + j=buffer[i]; + } + } + + /* Finally convert the default duration */ + switch (k) { + case 0: DefNoteDuration=128; break; + case 1: DefNoteDuration= 64; break; + case 2: DefNoteDuration= 32; break; + case 3: DefNoteDuration= 16; break; + case 4: DefNoteDuration= 8; break; + case 5: DefNoteDuration= 4; break; + default: DefNoteDuration= 16; break; + } + + /* Find the most frequently used scale and use this for the default */ + for (i=0;i<6;i++) buffer[i]=0; + for (i=0;iNrNotes;i++) { + if (ringtone->notes[i].note!=255) { + buffer[ringtone->notes[i].note/14]++; + } + } + j=0; + for (i=0;i<6;i++) { + if (buffer[i]>j) { + DefNoteScale=i; + j=buffer[i]; + } + } StartBit=BitPackByte(package, StartBit, CommandLength, 8); StartBit=BitPackByte(package, StartBit, RingingToneProgramming, 7);