예제 #1
0
    public void InitInstrument(Meta_MusicGenerator.EInstrument _instrument, Meta_MusicGenerator.EInstrumenType _type, Meta_MusicGenerator.EKey _key, Meta_MusicGenerator.EMode _mode, int _bpm)
    {
        play = false;

        audioClips = Meta_MusicGenerator.GetScaleAudio(_key, _mode, _instrument);
        instrument = _instrument;
        type       = _type;
        key        = _key;
        mode       = _mode;
        bpm        = _bpm;

        secondsPerQuarter = Meta_MusicGenerator.GetDurationOfOneBeat(bpm);
        audioSources      = new AudioSource[5]; //5 should be enough; there will rarely be more notes playing on top of each other
        for (int i = 0; i < audioSources.Length; i++)
        {
            audioSources[i] = gameObject.AddComponent <AudioSource>();
        }
    }