																		  //
//  MIDI_Scaler.swift
//  iRoadMovie
//
//  Created by Yoshihito Nakanishi on 2015/05/26.
//  Edited by Morishita Yasuhiko on 2016/05/10
//  Copyright (c) 2015�N lis2qn. All rights reserved.
//
    ////////////////Scale Tables////////////////
    uint16_t IonianTable[75] = {
        0,  2,  4,  5,  7,  9,  11,
        12, 14, 16, 17, 19, 21, 23,
        24, 26, 28, 29, 31, 33, 35,
        36, 38, 40, 41, 43, 45, 47,
        48, 50, 52, 53, 55, 57, 59,
        60, 62, 64, 65, 67, 69, 71,
        72, 74, 76, 77, 79, 81, 83,
        84, 86, 88, 89, 91, 93, 95,
        96, 98, 100, 101, 103, 105, 107,
        108, 110, 112, 113, 115, 117, 119,
        120, 122, 124, 125, 127
    };
    uint16_t DorianTable[75] = {
        0,  2,  3,  5,  7,  9,  10,
        12, 14, 15, 17, 19, 21, 22,
        24, 26, 27, 29, 31, 33, 34,
        36, 38, 39, 41, 43, 45, 46,
        48, 50, 51, 53, 55, 57, 58,
        60, 62, 63, 65, 67, 69, 70,
        72, 74, 75, 77, 79, 81, 82,
        84, 86, 87, 89, 91, 93, 94,
        96, 98, 99, 101, 103, 105, 106,
        108, 110, 111, 113, 115, 117, 118,
        120, 122, 123, 125, 127
    };
    uint16_t PhrygianTable[75] = {
        0,  1,  3,  5,  7,  8,  10,
        12, 13, 15, 17, 19, 20, 22,
        24, 25, 27, 29, 31, 32, 34,
        36, 37, 39, 41, 43, 44, 46,
        48, 49, 51, 53, 55, 56, 58,
        60, 61, 63, 65, 67, 68, 70,
        72, 73, 75, 77, 79, 80, 82,
        84, 85, 87, 89, 91, 92, 94,
        96, 97, 99, 101, 103, 104, 106,
        108, 109, 111, 113, 115, 116, 118,
        120, 121, 123, 125, 127
    };
    uint16_t LydianTable[75] = {
        0,  2,  4,  6,  7,  9,  11,
        12, 14, 16, 18, 19, 21, 23,
        24, 26, 28, 30, 31, 33, 35,
        36, 38, 40, 42, 43, 45, 47,
        48, 50, 52, 54, 55, 57, 59,
        60, 62, 64, 66, 67, 69, 71,
        72, 74, 76, 78, 79, 81, 83,
        84, 86, 88, 90, 91, 93, 95,
        96, 98, 100, 102, 103, 105, 107,
        108, 110, 112, 114, 115, 117, 119,
        120, 122, 124, 126, 127
    };
    uint16_t MixolydianTable[75] = {
        0,  2,  4,  5,  7,  9,  10,
        12, 14, 16, 17, 19, 21, 22,
        24, 26, 28, 29, 31, 33, 34,
        36, 38, 40, 41, 43, 45, 46,
        48, 50, 52, 53, 55, 57, 58,
        60, 62, 64, 65, 67, 69, 70,
        72, 74, 76, 77, 79, 81, 83,
        84, 86, 88, 89, 91, 93, 95,
        96, 98, 100, 101, 103, 105, 107,
        108, 110, 112, 113, 115, 117, 119,
        120, 122, 124, 125, 127
    };
    uint16_t AeolianTable[75] = {
        0,  2,  3,  5,  7,  8,  10,
        12, 14, 15, 17, 19, 20, 22,
        24, 26, 27, 29, 31, 32, 34,
        36, 38, 39, 41, 43, 44, 46,
        48, 50, 51, 53, 55, 56, 58,
        60, 62, 63, 65, 67, 68, 70,
        72, 74, 75, 77, 79, 80, 82,
        84, 86, 87, 89, 91, 92, 94,
        96, 98, 99, 101, 103, 104, 106,
        108, 110, 111, 113, 115, 116, 118,
        120, 122, 123, 125, 127
    };
    uint16_t LocrianTable[75] = {
        0,  1,  3,  5,  6,  8,  10,
        12, 13, 15, 17, 18, 20, 22,
        24, 25, 27, 29, 30, 32, 34,
        36, 37, 39, 41, 42, 44, 46,
        48, 49, 51, 53, 54, 56, 58,
        60, 61, 63, 65, 66, 68, 70,
        72, 73, 75, 77, 78, 80, 82,
        84, 85, 87, 89, 90, 92, 94,
        96, 97, 99, 101, 102, 104, 106,
        108, 109, 111, 113, 115, 117, 119,
        120, 121, 123, 125, 127
    };
    uint16_t WholetoneTable[64] = {
        0,  2,  4,  6,  8,  10,
        12, 14, 16, 18, 20, 22,
        24, 26, 28, 30, 32, 34,
        36, 38, 40, 42, 44, 46,
        48, 50, 52, 54, 56, 58,
        60, 62, 64, 66, 68, 70,
        72, 74, 76, 78, 80, 82,
        84, 86, 88, 90, 92, 94,
        96, 98, 100, 102, 104, 106,
        108, 110, 112, 114, 116, 118,
        120, 122, 124, 126
    };
    uint16_t octaveTable[11] = {
        0,  12, 24, 36, 48,
        60, 72, 84, 96, 108,
        120
    };
    uint16_t Octatonic2_1Table[85] = {
        0,  2,  3,  5,  6,  8,  9, 11,
        12, 14, 15, 17, 18, 20, 21, 23,
        24, 26, 27, 29, 30, 32, 33, 35,
        36, 38, 39, 41, 42, 44, 45, 47,
        48, 50, 51, 53, 54, 56, 57, 59,
        60, 62, 63, 65, 66, 68, 69, 71,
        72, 74, 75, 77, 78, 80, 81, 83,
        84, 86, 87, 89, 90, 92, 93, 95,
        96, 98, 99, 101, 102, 104, 105, 107,
        108, 110, 111, 113, 114, 116, 117, 119,
        120, 122, 123, 125, 127
    };
    uint16_t Octatonic1_2Table[85] = {
        0,  1,  3,  4,  6,  7,  9,  10,
        12, 13, 15, 16, 18, 19, 21, 22,
        24, 25, 27, 28, 30, 31, 33, 34,
        36, 37, 39, 40, 42, 43, 45, 46,
        48, 49, 51, 52, 54, 55, 57, 58,
        60, 61, 63, 64, 66, 67, 69, 70,
        72, 73, 75, 76, 78, 79, 81, 82,
        84, 85, 87, 88, 90, 91, 93, 94,
        96, 97, 99, 100, 102, 103, 105, 106,
        108, 109, 111, 113, 115, 116, 118, 119,
        120, 121, 123, 125, 127
    };
    uint16_t minPentaTable[54] = {
        0,  3,  5,  7,  10,
        12, 15, 17, 19, 22,
        24, 27, 29, 31, 34,
        36, 39, 41, 43, 46,
        48, 51, 53, 55, 58,
        60, 63, 65, 67, 70,
        72, 75, 77, 79, 82,
        84, 87, 89, 91, 94,
        96, 99, 101, 103, 106,
        108, 111, 113, 115, 118,
        120, 123, 125, 127
    };
    uint16_t majPentaTable[54] = {
        0,  2,  4,  7,  9,
        12, 14, 16, 19, 21,
        24, 26, 28, 31, 33,
        36, 38, 40, 43, 45,
        48, 50, 52, 55, 57,
        60, 62, 64, 67, 69,
        72, 74, 76, 79, 81,
        84, 86, 88, 91, 93,
        96, 98, 100, 103, 105,
        108, 110, 112, 115, 117,
        120, 122, 124, 127
    };
    uint16_t maj3rdTable[32] = {
        0,  4,  8,
        12, 16, 20,
        24, 28, 32,
        36, 40, 44,
        48, 52, 56,
        60, 64, 68,
        72, 76, 80,
        84, 88, 92,
        96, 100, 104,
        108, 112, 116,
        120, 124
    };
    uint16_t min3rdTable[43] = {
        0,  3,  6,  9,
        12, 15, 18, 21,
        24, 27, 30, 33,
        36, 39, 42, 45,
        48, 51, 54, 57,
        60, 63, 66, 69,
        72, 75, 78, 81,
        84, 87, 90, 93,
        96, 99, 102, 105,
        108, 111, 114, 117,
        120, 123, 126
    };
    uint16_t RyukyuTable[54] = {
        0,  4,  5,  7,  11,
        12, 16, 17, 19, 23,
        24, 28, 29, 31, 35,
        36, 40, 41, 43, 47,
        48, 52, 53, 55, 59,
        60, 64, 65, 67, 71,
        72, 76, 77, 79, 83,
        84, 88, 89, 91, 95,
        96, 100, 101, 103, 107,
        108, 112, 113, 115, 119,
        120, 124, 125, 127
    };
    uint16_t ChromaTable[128] = {
        0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11,
        12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
        24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
        36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
        48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
        60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
        72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
        84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
        96, 97, 98, 99, 100, 101, 102,103,104,105,106,107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
        120, 121, 122, 123, 124, 125, 126, 127
    };

    uint8_t scale_num_def[17] = {74,74,74,74,74,74,74,63,10,84,84,53,53,31,42,53,127};

    uint16_t *scale_address[17] =
    {
        IonianTable,
        DorianTable,
        PhrygianTable,
        LydianTable,
        MixolydianTable,
        AeolianTable,
        LocrianTable,
        WholetoneTable,
        octaveTable,
        Octatonic2_1Table,
        Octatonic1_2Table,
        minPentaTable,
        majPentaTable,
        maj3rdTable,
        min3rdTable,
        RyukyuTable,
        ChromaTable
    };
