public PlayInstructs(Actions newAct, ConstFile.Notes newNote, float yPos, Puppet u) { action = newAct; note = newNote; y = yPos; unit = u; }
public ConditionalItem() { cond1Val = 0; cond2Val = 0; cond1Ind = ConstFile.ConditionOptions.ENEMY_DISTANCE; greater = true; cond2Ind = ConstFile.ConditionOptions.VALUE; action = ConstFile.Actions.REST; note = ConstFile.Notes.QUARTER; }
public static GATEnvelope CreateEnvelope(ConstFile.Notes note, float BPM) { float sampleRate = 44100; int len = Mathf.FloorToInt((ConstFile.NoteBPMCalcs[(int)note] / ConstFile.BPM) * sampleRate); int fadeIn = Mathf.FloorToInt((sampleRate * len) / 135000); int fadeOut = Mathf.FloorToInt((sampleRate * len) / 4); int offset = 0; bool normalize = false; return(new GATEnvelope(len, fadeIn, fadeOut, offset, normalize)); }
void Play(List <PlayInstructs> instructs, ConstFile.Notes note) { DebugPanel.Log(note.ToString(), "W/E", instructs.Count); IGATProcessedSample sample; string[] noteArr; while (GATManager.DefaultPlayer.NbOfTracks < 20) { GATManager.DefaultPlayer.AddTrack <GATTrack>(); /* * noteArr = chords[chordIndex]; * * sample = sampleBank.GetProcessedSample(string.Format(noteArr[0], 3), wholeEnv); * sample.Play(0); * sample = sampleBank.GetProcessedSample(string.Format(noteArr[1], 3), wholeEnv); * sample.Play(0); * sample = sampleBank.GetProcessedSample(string.Format(noteArr[2], 3), wholeEnv); * sample.Play(0); */ } noteArr = chords[chordIndex]; GATData mySampleData; switch (note) { case ConstFile.Notes.WHOLE: chordIndex++; chordIndex = chordIndex % chords.Count; wholeCnt++; halfCnt = -1; quarterCnt = -1; eigthCnt = -1; sixteenthCnt = -1; sampleBank.FlushCacheForEnvelope(wholeEnv); sampleBank.FlushCacheForEnvelope(halfEnv); sampleBank.FlushCacheForEnvelope(quarterEnv); sampleBank.FlushCacheForEnvelope(eigthEnv); sampleBank.FlushCacheForEnvelope(sixteenthEnv); break; case ConstFile.Notes.HALF: halfCnt++; break; case ConstFile.Notes.QUARTER: quarterCnt++; if (quarterCnt % 4 == 1 || quarterCnt % 4 == 3) { mySampleData = sampleBank.GetAudioData("clap-808"); GATManager.DefaultPlayer.PlayData(mySampleData, 1, 1); } break; case ConstFile.Notes.EIGHTH: eigthCnt++; if (eigthCnt % 8 == 0 || eigthCnt % 8 == 1 || eigthCnt % 8 == 5) { mySampleData = sampleBank.GetAudioData("kick-gritty"); GATManager.DefaultPlayer.PlayData(mySampleData, 1, 1); } mySampleData = sampleBank.GetAudioData(string.Format(noteArr[0], 2)); GATManager.DefaultPlayer.PlayData(mySampleData, 3, .2f); break; case ConstFile.Notes.SIXTEENTH: sixteenthCnt++; if ((sixteenthCnt % 16 == 14 || sixteenthCnt % 16 == 15) && wholeCnt % 2 == 0) { mySampleData = sampleBank.GetAudioData("hihat-808"); GATManager.DefaultPlayer.PlayData(mySampleData, 2, 1); } break; } if (instructs.Count == 0) { return; } GATEnvelope env; switch (instructs[0].note) { case ConstFile.Notes.WHOLE: env = wholeEnv; break; case ConstFile.Notes.HALF: env = halfEnv; break; case ConstFile.Notes.QUARTER: env = quarterEnv; break; case ConstFile.Notes.EIGHTH: env = eigthEnv; break; case ConstFile.Notes.SIXTEENTH: env = sixteenthEnv; break; default: throw new System.Exception(string.Format("Invalid note: {0}", instructs[0].note)); } for (int i = 0; i < instructs.Count; i++) { if (instructs[i].Alive()) { instructs[i].MakeMove(); if (instructs[i].action != ConstFile.Actions.REST || instructs[i].puppetType() == ConstFile.PuppetType.TOWER) { // Attempt to double size of note area for more variance. int noteInd = ArenaGrid.FindSubsection(noteArr.Length * 2, instructs[i].y); int octave = instructs[i].puppetType() == PuppetType.BASS ? 2 : 4; if (noteInd > noteArr.Length) { octave++; } noteInd = noteInd % noteArr.Length; sample = sampleBank.GetProcessedSample(string.Format(noteArr[noteInd], octave), env); sample.Play(0); //Debug.Log("Played " + instructs[i].note); } } } }