private Interval AfterWindow(SoundInterval si) { if (si.next != null) { return(new Interval(si.end, si.next.begin)); } else { return(new Interval(si.end, si.end + (UInt32)random.Next((int)interval_min, (int)interval_max))); } }
private Interval BeforeWindow(SoundInterval si) { if (si.previous != null) { return(new Interval(si.previous.end, si.begin)); } else { return(new Interval(si.begin - (UInt32)random.Next((int)interval_min, (int)interval_max), si.end)); } }
private void GeneratePreSounds(ref UInt32 timeMs, ref SoundInterval prevSoundInterval) { for (int i = 0; i < num_presounds; i++) { foreach (Sound s in Sounds) { SoundInterval si = new SoundInterval(s, prevSoundInterval, timeMs, timeMs + s.duration); s.presoundIntervals.Add(si); timeMs += s.duration; timeMs += (UInt32)random.Next((int)interval_min, (int)interval_max); if (prevSoundInterval != null) { prevSoundInterval.next = si; } prevSoundInterval = si; } } }
private void GenerateSoundsAlternating() { uint timeMs = pre_time; SoundInterval prevSoundInterval = null; for (int i = 0; i < num_presounds; i++) { foreach (Sound s in Sounds) { SoundInterval si = new SoundInterval(s, prevSoundInterval, timeMs, timeMs + s.duration); s.presoundIntervals.Add(si); timeMs += s.duration; timeMs += (UInt32)random.Next((int)interval_min, (int)interval_max); if (prevSoundInterval != null) { prevSoundInterval.next = si; } prevSoundInterval = si; } } exp_begin = timeMs; uint potential_end = timeMs; for (int i = 0; i < num_exp_sounds; i++) { foreach (Sound s in Sounds) { SoundInterval si = new SoundInterval(s, prevSoundInterval, timeMs, timeMs + s.duration); s.expSoundIntervals.Add(si); timeMs += s.duration; potential_end = timeMs; timeMs += (UInt32)random.Next((int)interval_min, (int)interval_max); if (prevSoundInterval != null) { prevSoundInterval.next = si; } prevSoundInterval = si; } } exp_end = potential_end; }
private void GenerateExperimentalSounds(ref UInt32 timeMs, ref SoundInterval prevSoundInterval) { exp_begin = timeMs; uint potential_end = timeMs; for (int i = 0; i < num_exp_sounds; i++) { foreach (Sound s in Sounds) { SoundInterval si = new SoundInterval(s, prevSoundInterval, timeMs, timeMs + s.duration); s.expSoundIntervals.Add(si); timeMs += s.duration; potential_end = timeMs; timeMs += (UInt32)random.Next((int)interval_min, (int)interval_max); if (prevSoundInterval != null) { prevSoundInterval.next = si; } prevSoundInterval = si; } } exp_end = potential_end; }
public SoundInterval(Sound sound, SoundInterval previous, uint begin, uint end) : base(begin, end) { this.sound = sound; this.previous = previous; }
private Interval DuringWindow(SoundInterval si) { return((Interval)si); }