public Context(Player player) { m_Player = player; m_States = new Stack<ContextState>(); var state = new ContextState(); m_States.Push(state); }
private int GetTotalDuration(ContextState state) { var oneMinute = new TimeSpan(0, 1, 0); int l4TotalLength = (int)oneMinute.TotalMilliseconds/state.Tempo; int l1TotalLength = l4TotalLength*4; int currentTotalLength = l1TotalLength/(int) state.Length; return currentTotalLength; }
public void Play(ContextState state) { var currentTotalLength = GetTotalDuration(state); int soundDuration; int pauseDuration; GetDurations(currentTotalLength, state.Duration, out soundDuration, out pauseDuration); int stepsToA4 = StepsToA4(state.Octave, state.Note, state.Accidental); PlaySound(soundDuration, stepsToA4); PlayPause(pauseDuration); }