RoboPlay - Multi format music player in Fusion-C

Page 12/12
5 | 6 | 7 | 8 | 9 | 10 | 11 |

By Parn

Hero (552)

Parn's picture

30-06-2020, 21:40

That would be very cool. Looking forward to it. Another question about FM MIDI: how are you treating track 10 note events? I'm curious... Are you using rhythm mode at all? If so, are you translating all track 10 events into those 5 internal instruments? Or just those 5 instruments, while others play in melodic channels?

By ToriHino

Hero (523)

ToriHino's picture

30-06-2020, 23:45

Channel 10 is completely handled by the rhythm mode, with a mapping of a number of instruments on to these 5, see this part of the code:

    /* Bass drum */
    if (number == 35 || number == 36 || number == 41 || number == 43) 
    {  
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd);
        g_roboplay_interface->write_opl_fm_1(0x53, velocity);
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd | 16);
    }

    /* HiHat */
    else if (number == 37 || number == 39 || number == 42 || number == 44 ||
             number == 46 || number == 56 || number == 62 || number == 69 ||
             number == 70 || number == 71 || number == 72 || number == 78) 
    {       
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd);
        g_roboplay_interface->write_opl_fm_1(0x51, velocity);
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd | 1);
    }

    /* Snare drum */
    else if (number == 38 || number == 40) 
    {       
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd);
        g_roboplay_interface->write_opl_fm_1(0x54, velocity);
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd | 8);
    }

    /* TomTom */
    else if (number == 45 || number == 47 || number == 48 || number == 50 ||
             number == 60 || number == 61 || number == 63 || number == 64 ||
             number == 65 || number == 66 || number == 67 || number == 68 ||
             number == 73 || number == 74 || number == 75 || number == 76 ||
             number == 77) 
    {       
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd);
        g_roboplay_interface->write_opl_fm_1(0x52, velocity);
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd | 4);
    }

    /* Cymbal */
    else if (number == 49 || number == 51 || number == 52 || number == 53 ||
             number == 54 || number == 55 || number == 57 || number == 58 ||
             number == 59 || number == 79 || number == 80 || number == 81) 
    {
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd);
        g_roboplay_interface->write_opl_fm_1(0xBD, g_byte_bd | 2);
        g_roboplay_interface->write_opl_fm_1(0x53, velocity);
    }

By Parn

Hero (552)

Parn's picture

01-07-2020, 16:40

Oh, I see. Nice and easy to understand. Thanks! Wink

Page 12/12
5 | 6 | 7 | 8 | 9 | 10 | 11 |