public void OnRepeatNotePlayed(RepeatNoteArgs e) { int unplayed = -1; List <Instrument> instruments = e.instrumentSet.mInstruments; Instrument instrument = instruments[e.indexA]; int note = instrument.mClipNotes[mMeasureEditor.mCurrentMeasure.value][e.repeatingCount][e.indexB]; if (instrument.mClipNotes[mMeasureEditor.mCurrentMeasure.value][e.repeatingCount][e.indexB] != unplayed) { mMusicGenerator.PlayAudioClip(e.instrumentSet, (int)instrument.InstrumentTypeIndex, note, instrument.mData.Volume, e.indexA); mStaffPlayer.DisplayNote(note, (int)instrument.mData.mStaffPlayerColor, false, e.instrumentSet); } }
/// <summary> /// staggers the playClip() call: /// </summary> /// <param name="clipIN"></param> /// <param name="i"></param> /// <returns></returns> public IEnumerator StrumClip(int[] clipIN, int i) { if (mInstruments[i].mData.mSuccessionType == eSuccessionType.rhythm && mInstruments[i].mData.mArpeggio == false) { Array.Sort(clipIN); } float variation = UnityEngine.Random.Range(0, mInstruments[i].mData.StrumVariation); for (int j = 0; j < clipIN.Length; j++) { if (clipIN[j] != mUnplayed) { mMusicGenerator.PlayAudioClip(this, (int)mInstruments[i].InstrumentTypeIndex, clipIN[j], mInstruments[i].mData.Volume, i); mMusicGenerator.UIStaffNoteStrummed.Invoke(clipIN[j], (int)mInstruments[i].mData.mStaffPlayerColor); yield return(new WaitForSeconds(mInstruments[i].mData.StrumLength + variation)); } } }