return MMFILE_FORMAT_SUCCESS;
}
+static void
+__init_imelody_data(void)
+{
+ int idx = 0;
+
+ for (idx = 0; idx < AV_MIDI_NOTE_MAX; idx++) {
+ restSpec[idx] = 0;
+ durationSpec[idx] = 0;
+ }
+
+ for (idx = 0; idx < AV_MIDI_NOTE_MAX; idx++)
+ octave[idx] = '%';
+
+ for (idx = 0; idx < AV_MIDI_NOTE_MAX; idx++) {
+ Melody[idx].flat_sharp = '%';
+ Melody[idx].note = '%';
+ Melody[idx].duration = '%';
+ Melody[idx].duration_specifier = '%';
+ Melody[idx].rest = '%';
+ Melody[idx].rest_specifier = '%';
+ Melody[idx].vol = '%';
+ }
+
+ for (idx = 0; idx < AV_MIDI_NOTE_MAX; idx++) {
+ noteData[idx].note = 0;
+ noteData[idx].duration_on = 0;
+ noteData[idx].duration_off = 0;
+ }
+
+ memset(midiData, 0, sizeof(midiData));
+ memcpy(midiData, midiHeader, MIDI_HEADER_LENGTH);
+}
+
+static void
+__get_imelody_duration(char style, int number)
+{
+ if (style == '0') {
+ switch (Melody[number].duration) {
+ case '0':
+ noteData[number].duration_on = 183;
+ noteData[number].duration_off = 9;
+ break;
+ case '1':
+ noteData[number].duration_on = 91;
+ noteData[number].duration_off = 5;
+ break;
+ case '2':
+ noteData[number].duration_on = 46;
+ noteData[number].duration_off = 2;
+ break;
+ case '3':
+ noteData[number].duration_on = 23;
+ noteData[number].duration_off = 1;
+ break;
+ case '4':
+ noteData[number].duration_on = 11;
+ noteData[number].duration_off = 1;
+ break;
+ case '5':
+ noteData[number].duration_on = 5;
+ noteData[number].duration_off = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ else if (style == '1') {
+ switch (Melody[number].duration) {
+ case '0':
+ noteData[number].duration_on = 192;
+ noteData[number].duration_off = 0;
+ break;
+ case '1':
+ noteData[number].duration_on = 96;
+ noteData[number].duration_off = 0;
+ break;
+ case '2':
+ noteData[number].duration_on = 48;
+ noteData[number].duration_off = 0;
+ break;
+ case '3':
+ noteData[number].duration_on = 24;
+ noteData[number].duration_off = 0;
+ break;
+ case '4':
+ noteData[number].duration_on = 12;
+ noteData[number].duration_off = 0;
+ break;
+ case '5':
+ noteData[number].duration_on = 6;
+ noteData[number].duration_off = 0;
+ break;
+ default:
+ break;
+ }
+ }
+
+ else {
+ switch (Melody[number].duration) {
+ case '0':
+ noteData[number].duration_on = 96;
+ noteData[number].duration_off = 96;
+ break;
+ case '1':
+ noteData[number].duration_on = 48;
+ noteData[number].duration_off = 48;
+ break;
+ case '2':
+ noteData[number].duration_on = 24;
+ noteData[number].duration_off = 24;
+ break;
+ case '3':
+ noteData[number].duration_on = 12;
+ noteData[number].duration_off = 12;
+ break;
+ case '4':
+ noteData[number].duration_on = 6;
+ noteData[number].duration_off = 6;
+ break;
+ case '5':
+ noteData[number].duration_on = 3;
+ noteData[number].duration_off = 3;
+ break;
+ default:
+ break;
+ }
+ }
+
+ switch (Melody[number].duration) {
+ case '0':
+ durationSpec[number] = 192;
+ break;
+ case '1':
+ durationSpec[number] = 96;
+ break;
+ case '2':
+ durationSpec[number] = 48;
+ break;
+ case '3':
+ durationSpec[number] = 24;
+ break;
+ case '4':
+ durationSpec[number] = 12;
+ break;
+ case '5':
+ durationSpec[number] = 6;
+ break;
+ default:
+ break;
+ }
+
+ if (Melody[number].duration_specifier != '%') {
+ switch (Melody[number].duration_specifier) {
+ case '.':
+ noteData[number].duration_on += (durationSpec[number] / 2);
+ break;
+ case ':':
+ noteData[number].duration_on += durationSpec[number];
+ break;
+ case ';':
+ noteData[number].duration_on -= (durationSpec[number] / 3);
+ break;
+ default:
+ break;
+ }
+
+ if (noteData[number].duration_on > MIDI_MAX)
+ noteData[number].duration_on = MIDI_LIMIT;
+ }
+}
+
+static void
+__get_imelody_melody(int number, int octaveValue)
+{
+ if (Melody[number].flat_sharp == '#') {
+ switch (Melody[number].note) {
+ case 'c':
+ noteData[number].note = octaveValue + 1;
+ break;
+ case 'd':
+ noteData[number].note = octaveValue + 3;
+ break;
+ case 'f':
+ noteData[number].note = octaveValue + 6;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 8;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 10;
+ break;
+ default:
+ break;
+ }
+ }
+
+ else if (Melody[number].flat_sharp == '&') {
+ switch (Melody[number].note) {
+ case 'd':
+ noteData[number].note = octaveValue + 1;
+ break;
+ case 'e':
+ noteData[number].note = octaveValue + 3;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 6;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 8;
+ break;
+ case 'b':
+ noteData[number].note = octaveValue + 10;
+ break;
+ default:
+ break;
+ }
+ }
+
+ else {
+ switch (Melody[number].note) {
+ case 'c':
+ noteData[number].note = octaveValue;
+ break;
+ case 'd':
+ noteData[number].note = octaveValue + 2;
+ break;
+ case 'e':
+ noteData[number].note = octaveValue + 4;
+ break;
+ case 'f':
+ noteData[number].note = octaveValue + 5;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 7;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 9;
+ break;
+ case 'b':
+ noteData[number].note = octaveValue + 11;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void
+__get_imelody_reset(int number)
+{
+ if (Melody[number].rest >= '0' && Melody[number].rest <= '5') {
+ switch (Melody[number].rest) {
+ case '0':
+ noteData[number - 1].duration_off += 192;
+ restSpec[number] = 192;
+ break;
+ case '1':
+ noteData[number - 1].duration_off += 96;
+ restSpec[number] = 96;
+ break;
+ case '2':
+ noteData[number - 1].duration_off += 48;
+ restSpec[number] = 48;
+ break;
+ case '3':
+ noteData[number - 1].duration_off += 24;
+ restSpec[number] = 24;
+ break;
+ case '4':
+ noteData[number - 1].duration_off += 12;
+ restSpec[number] = 12;
+ break;
+ case '5':
+ noteData[number - 1].duration_off += 6;
+ restSpec[number] = 6;
+ break;
+ default:
+ break;
+ }
+
+ if (noteData[number - 1].duration_off > MIDI_MAX && Melody[number].rest_specifier == '%')
+ noteData[number - 1].duration_off = MIDI_LIMIT;
+ }
+
+ if (Melody[number].rest_specifier != '%') {
+ switch (Melody[number].rest_specifier) {
+ case '.':
+ noteData[number - 1].duration_off += (restSpec[number] / 2);
+ break;
+ case ':':
+ noteData[number - 1].duration_off += restSpec[number];
+ break;
+ case ';':
+ noteData[number - 1].duration_off -= (restSpec[number] / 3);
+ break;
+ default:
+ break;
+ }
+
+ if (noteData[number - 1].duration_off > MIDI_MAX)
+ noteData[number - 1].duration_off = MIDI_LIMIT;
+ }
+}
+
+static void
+__get_imelody_notetotal(int number)
+{
+ char noteBase[6];
+
+ memset(noteBase, 0, sizeof(noteBase));
+
+ noteBase[0] = noteData[number].note;
+ noteBase[2] = noteData[number].duration_on;
+ noteBase[3] = noteData[number].note;
+ noteBase[5] = noteData[number].duration_off;
+
+ noteTotal[6 * number] = noteBase[0];
+ noteTotal[6 * number + 2] = noteBase[2];
+ noteTotal[6 * number + 3] = noteBase[3];
+ noteTotal[6 * number + 5] = noteBase[5];
+ noteTotal[6 * number + 4] = 0;
+
+ if (noteTotal[6 * number + 2] > MIDI_LIMIT)
+ noteTotal[6 * number + 2] = MIDI_LIMIT;
+
+ if (noteTotal[6 * number + 5] > MIDI_LIMIT)
+ noteTotal[6 * number + 5] = MIDI_LIMIT;
+}
static unsigned char *
__AvConvertIMelody2MIDI(char *pMelodyBuf, unsigned int *pBufLen)
unsigned char *pConvertBuf;
char *pStart;
char *pMelodyStart;
- char noteBase[6];
int octaveCount;
int octaveValue;
int count;
int noteCount = 0;
- int MelodyCount;
int number;
int numberCount;
char style = '0';
int repeat = 0;
int repeatCount = 0;
- for (count = 0; count < AV_MIDI_NOTE_MAX; count++) {
- restSpec[count] = 0;
- durationSpec[count] = 0;
- }
-
- for (octaveCount = 0; octaveCount < AV_MIDI_NOTE_MAX; octaveCount++)
- octave[octaveCount] = '%';
-
- for (MelodyCount = 0; MelodyCount < AV_MIDI_NOTE_MAX; MelodyCount++) {
- Melody[MelodyCount].flat_sharp = '%';
- Melody[MelodyCount].note = '%';
- Melody[MelodyCount].duration = '%';
- Melody[MelodyCount].duration_specifier = '%';
- Melody[MelodyCount].rest = '%';
- Melody[MelodyCount].rest_specifier = '%';
- Melody[MelodyCount].vol = '%';
- }
-
- for (MelodyCount = 0; MelodyCount < AV_MIDI_NOTE_MAX; MelodyCount++) {
- noteData[MelodyCount].note = 0;
- noteData[MelodyCount].duration_on = 0;
- noteData[MelodyCount].duration_off = 0;
- }
-
-
- memset(midiData, 0, sizeof(midiData));
- memcpy(midiData, midiHeader, MIDI_HEADER_LENGTH);
+ __init_imelody_data();
pStart = pMelodyBuf;
octaveValue = octaveValue * 12;
- if (Melody[number].flat_sharp == '#') {
- switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue + 1;
- break;
- case 'd':
- noteData[number].note = octaveValue + 3;
- break;
- case 'f':
- noteData[number].note = octaveValue + 6;
- break;
- case 'g':
- noteData[number].note = octaveValue + 8;
- break;
- case 'a':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
- }
- }
-
- else if (Melody[number].flat_sharp == '&') {
- switch (Melody[number].note) {
- case 'd':
- noteData[number].note = octaveValue + 1;
- break;
- case 'e':
- noteData[number].note = octaveValue + 3;
- break;
- case 'g':
- noteData[number].note = octaveValue + 6;
- break;
- case 'a':
- noteData[number].note = octaveValue + 8;
- break;
- case 'b':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
- }
- }
-
- else {
- switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue;
- break;
- case 'd':
- noteData[number].note = octaveValue + 2;
- break;
- case 'e':
- noteData[number].note = octaveValue + 4;
- break;
- case 'f':
- noteData[number].note = octaveValue + 5;
- break;
- case 'g':
- noteData[number].note = octaveValue + 7;
- break;
- case 'a':
- noteData[number].note = octaveValue + 9;
- break;
- case 'b':
- noteData[number].note = octaveValue + 11;
- break;
- default:
- break;
- }
- }
+ __get_imelody_melody(number, octaveValue);
}
pMelodyBuf = pMelodyStart;
style = __AvMIDISetStyle(pMelodyBuf);
- for (number = 0; number < noteCount; number++) {
- if (style == '0') {
- switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 183;
- noteData[number].duration_off = 9;
- break;
- case '1':
- noteData[number].duration_on = 91;
- noteData[number].duration_off = 5;
- break;
- case '2':
- noteData[number].duration_on = 46;
- noteData[number].duration_off = 2;
- break;
- case '3':
- noteData[number].duration_on = 23;
- noteData[number].duration_off = 1;
- break;
- case '4':
- noteData[number].duration_on = 11;
- noteData[number].duration_off = 1;
- break;
- case '5':
- noteData[number].duration_on = 5;
- noteData[number].duration_off = 1;
- break;
- default:
- break;
- }
- }
-
- else if (style == '1') {
- switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 192;
- noteData[number].duration_off = 0;
- break;
- case '1':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 0;
- break;
- case '2':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 0;
- break;
- case '3':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 0;
- break;
- case '4':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 0;
- break;
- case '5':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 0;
- break;
- default:
- break;
- }
- }
-
- else {
- switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 96;
- break;
- case '1':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 48;
- break;
- case '2':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 24;
- break;
- case '3':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 12;
- break;
- case '4':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 6;
- break;
- case '5':
- noteData[number].duration_on = 3;
- noteData[number].duration_off = 3;
- break;
- default:
- break;
- }
- }
-
- switch (Melody[number].duration) {
- case '0':
- durationSpec[number] = 192;
- break;
- case '1':
- durationSpec[number] = 96;
- break;
- case '2':
- durationSpec[number] = 48;
- break;
- case '3':
- durationSpec[number] = 24;
- break;
- case '4':
- durationSpec[number] = 12;
- break;
- case '5':
- durationSpec[number] = 6;
- break;
- default:
- break;
- }
-
- if (Melody[number].duration_specifier != '%') {
- switch (Melody[number].duration_specifier) {
- case '.':
- noteData[number].duration_on += (durationSpec[number] / 2);
- break;
- case ':':
- noteData[number].duration_on += durationSpec[number];
- break;
- case ';':
- noteData[number].duration_on -= (durationSpec[number] / 3);
- break;
- default:
- break;
- }
-
- if (noteData[number].duration_on > MIDI_MAX)
- noteData[number].duration_on = MIDI_LIMIT;
- }
- }
-
- for (number = 1; number < noteCount; number++) {
- if (Melody[number].rest >= '0' && Melody[number].rest <= '5') {
- switch (Melody[number].rest) {
- case '0':
- noteData[number - 1].duration_off += 192;
- restSpec[number] = 192;
- break;
- case '1':
- noteData[number - 1].duration_off += 96;
- restSpec[number] = 96;
- break;
- case '2':
- noteData[number - 1].duration_off += 48;
- restSpec[number] = 48;
- break;
- case '3':
- noteData[number - 1].duration_off += 24;
- restSpec[number] = 24;
- break;
- case '4':
- noteData[number - 1].duration_off += 12;
- restSpec[number] = 12;
- break;
- case '5':
- noteData[number - 1].duration_off += 6;
- restSpec[number] = 6;
- break;
- default:
- break;
- }
-
- if (noteData[number - 1].duration_off > MIDI_MAX && Melody[number].rest_specifier == '%')
- noteData[number - 1].duration_off = MIDI_LIMIT;
- }
-
- if (Melody[number].rest_specifier != '%') {
- switch (Melody[number].rest_specifier) {
- case '.':
- noteData[number - 1].duration_off += (restSpec[number] / 2);
- break;
- case ':':
- noteData[number - 1].duration_off += restSpec[number];
- break;
- case ';':
- noteData[number - 1].duration_off -= (restSpec[number] / 3);
- break;
- default:
- break;
- }
+ for (number = 0; number < noteCount; number++)
+ __get_imelody_duration(style, number);
- if (noteData[number - 1].duration_off > MIDI_MAX)
- noteData[number - 1].duration_off = MIDI_LIMIT;
- }
- }
+ for (number = 1; number < noteCount; number++)
+ __get_imelody_reset(number);
if (Melody[0].rest >= '0' && Melody[0].rest <= '5') {
switch (Melody[0].rest) {
midiData[50] = MIDI_LIMIT;
}
- for (number = 0; number < noteCount; number++) {
- noteBase[0] = noteData[number].note;
- noteBase[2] = noteData[number].duration_on;
- noteBase[3] = noteData[number].note;
- noteBase[5] = noteData[number].duration_off;
-
- noteTotal[6 * number] = noteBase[0];
- noteTotal[6 * number + 2] = noteBase[2];
- noteTotal[6 * number + 3] = noteBase[3];
- noteTotal[6 * number + 5] = noteBase[5];
- noteTotal[6 * number + 4] = 0;
-
- if (noteTotal[6 * number + 2] > MIDI_LIMIT)
- noteTotal[6 * number + 2] = MIDI_LIMIT;
-
- if (noteTotal[6 * number + 5] > MIDI_LIMIT)
- noteTotal[6 * number + 5] = MIDI_LIMIT;
- }
+ for (number = 0; number < noteCount; number++)
+ __get_imelody_notetotal(number);
for (number = 1; number < noteCount; number++) {
noteTotal[1] = 84;
octaveValue = octaveValue * 12;
- if (Melody[number].flat_sharp == '#') {
- switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue + 1;
- break;
- case 'd':
- noteData[number].note = octaveValue + 3;
- break;
- case 'f':
- noteData[number].note = octaveValue + 6;
- break;
- case 'g':
- noteData[number].note = octaveValue + 8;
- break;
- case 'a':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
- }
- }
-
- else if (Melody[number].flat_sharp == '&') {
- switch (Melody[number].note) {
- case 'd':
- noteData[number].note = octaveValue + 1;
- break;
- case 'e':
- noteData[number].note = octaveValue + 3;
- break;
- case 'g':
- noteData[number].note = octaveValue + 6;
- break;
- case 'a':
- noteData[number].note = octaveValue + 8;
- break;
- case 'b':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
- }
- }
-
- else {
- switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue;
- break;
- case 'd':
- noteData[number].note = octaveValue + 2;
- break;
- case 'e':
- noteData[number].note = octaveValue + 4;
- break;
- case 'f':
- noteData[number].note = octaveValue + 5;
- break;
- case 'g':
- noteData[number].note = octaveValue + 7;
- break;
- case 'a':
- noteData[number].note = octaveValue + 9;
- break;
- case 'b':
- noteData[number].note = octaveValue + 11;
- break;
- default:
- break;
- }
- }
-
-
- if (style == '0') {
- switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 183;
- noteData[number].duration_off = 9;
- break;
- case '1':
- noteData[number].duration_on = 91;
- noteData[number].duration_off = 5;
- break;
- case '2':
- noteData[number].duration_on = 46;
- noteData[number].duration_off = 2;
- break;
- case '3':
- noteData[number].duration_on = 23;
- noteData[number].duration_off = 1;
- break;
- case '4':
- noteData[number].duration_on = 11;
- noteData[number].duration_off = 1;
- break;
- case '5':
- noteData[number].duration_on = 5;
- noteData[number].duration_off = 1;
- break;
- default:
- break;
- }
- }
-
- else if (style == '1') {
- switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 192;
- noteData[number].duration_off = 0;
- break;
- case '1':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 0;
- break;
- case '2':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 0;
- break;
- case '3':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 0;
- break;
- case '4':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 0;
- break;
- case '5':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 0;
- break;
- default:
- break;
- }
- }
-
- else {
- switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 96;
- break;
- case '1':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 48;
- break;
- case '2':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 24;
- break;
- case '3':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 12;
- break;
- case '4':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 6;
- break;
- case '5':
- noteData[number].duration_on = 3;
- noteData[number].duration_off = 3;
- break;
- default:
- break;
- }
- }
-
- switch (Melody[number].duration) {
- case '0':
- durationSpec[number] = 192;
- break;
- case '1':
- durationSpec[number] = 96;
- break;
- case '2':
- durationSpec[number] = 48;
- break;
- case '3':
- durationSpec[number] = 24;
- break;
- case '4':
- durationSpec[number] = 12;
- break;
- case '5':
- durationSpec[number] = 6;
- break;
- default:
- break;
- }
-
- if (Melody[number].duration_specifier != '%') {
- switch (Melody[number].duration_specifier) {
- case '.':
- noteData[number].duration_on += (durationSpec[number] / 2);
- break;
- case ':':
- noteData[number].duration_on += durationSpec[number];
- break;
- case ';':
- noteData[number].duration_on -= (durationSpec[number] / 3);
- break;
- default:
- break;
- }
-
- if (noteData[number].duration_on > MIDI_MAX)
- noteData[number].duration_on = MIDI_LIMIT;
- }
+ __get_imelody_melody(number, octaveValue);
+ __get_imelody_duration(style, number);
}
- for (number = count + 1; number < noteCount && number < AV_MIDI_NOTE_MAX; number++) {
- if (Melody[number].rest >= '0' && Melody[number].rest <= '5') {
- switch (Melody[number].rest) {
- case '0':
- noteData[number - 1].duration_off += 192;
- restSpec[number] = 192;
- break;
- case '1':
- noteData[number - 1].duration_off += 96;
- restSpec[number] = 96;
- break;
- case '2':
- noteData[number - 1].duration_off += 48;
- restSpec[number] = 48;
- break;
- case '3':
- noteData[number - 1].duration_off += 24;
- restSpec[number] = 24;
- break;
- case '4':
- noteData[number - 1].duration_off += 12;
- restSpec[number] = 12;
- break;
- case '5':
- noteData[number - 1].duration_off += 6;
- restSpec[number] = 6;
- break;
- default:
- break;
- }
-
- if (noteData[number - 1].duration_off > MIDI_MAX && Melody[number].rest_specifier == '%')
- noteData[number - 1].duration_off = MIDI_LIMIT;
- }
-
- if (Melody[number].rest_specifier != '%') {
- switch (Melody[number].rest_specifier) {
- case '.':
- noteData[number - 1].duration_off += (restSpec[number] / 2);
- break;
- case ':':
- noteData[number - 1].duration_off += restSpec[number];
- break;
- case ';':
- noteData[number - 1].duration_off -= (restSpec[number] / 3);
- break;
- default:
- break;
- }
-
- if (noteData[number - 1].duration_off > MIDI_MAX)
- noteData[number - 1].duration_off = MIDI_LIMIT;
- }
- }
+ for (number = count + 1; number < noteCount && number < AV_MIDI_NOTE_MAX; number++)
+ __get_imelody_reset(number);
if (Melody[count].rest >= '0' && Melody[count].rest <= '5') {
switch (Melody[count].rest) {
midiData[52 + (6 * count * (repeat + 1) - 1)] = MIDI_LIMIT;
}
- for (number = count; number < noteCount; number++) {
- noteBase[0] = noteData[number].note;
- noteBase[2] = noteData[number].duration_on;
- noteBase[3] = noteData[number].note;
- noteBase[5] = noteData[number].duration_off;
-
- noteTotal[6 * number] = noteBase[0];
- noteTotal[6 * number + 2] = noteBase[2];
- noteTotal[6 * number + 3] = noteBase[3];
- noteTotal[6 * number + 5] = noteBase[5];
- noteTotal[6 * number + 4] = 0;
-
- if (noteTotal[6 * number + 2] > MIDI_LIMIT)
- noteTotal[6 * number + 2] = MIDI_LIMIT;
-
- if (noteTotal[6 * number + 5] > MIDI_LIMIT)
- noteTotal[6 * number + 5] = MIDI_LIMIT;
- }
+ for (number = count; number < noteCount; number++)
+ __get_imelody_notetotal(number);
for (number = count + 1; number < noteCount; number++) {
noteTotal[6 * count + 1] = midiData[52 + (6 * count * (repeat + 1) - 5)];
return styleValue;
}
-
-