private void KeepPlaying() { while (ALsetup.SLtoneupdate()) { ; } }
private void Foot_FootDownDetected(Foot foot) { if (footDown == true) { ALsetup.SLvarygain((float)(1 / ((Math.Abs(foot.CurrentMarker.xCoordinate) / 10) + 0.05f))); ALsetup.SLPlayWAV(); } }
public void StartSound() { stopUpdate = false; //soundon = true; ALsetup.SLplayTone(300); Thread updateThread = new Thread(new ThreadStart(KeepPlaying)); updateThread.IsBackground = true; updateThread.Start(); }
public void EndCurrentEnvironment() { //try //{ //updateThread.Abort(); //} //catch (ThreadAbortException) //{ // System.Diagnostics.Debug.WriteLine("Thread aborted"); //} ALsetup.SLcloseEnvironment(); }
public ALSoundEnvironment(TestSubject person) { this.person = person; left = person.Left; right = person.Right; ALsetup.SLsetenvironment(); //if (!ALsetup.SLsetenvironment()) //{ // MessageBox.Show("Sound is not fully functioning!"); //} StartSound(); }
public ALSoundEnvironment() { //left = person.Left; //right = person.Right; ALsetup.SLsetenvironment(); ALsetup.SLreadWAV(52280); //if (!ALsetup.SLsetenvironment()) //{ // MessageBox.Show("Sound is not fully functioning!"); //} }
private void StartSound() { float pitch; ALsetup.SLplayTone(); while (ALsetup.SLtoneupdate()) { pitch = (float)Foot.Frontfoot.CurrentMarker.xCoordinate / 100; ALsetup.SLchangepitch(pitch); } //update = new Thread(new ThreadStart(KeepPlaying)); //monitor = new Thread(new ThreadStart(Monitor)); }
private void Monitor() { float pitch = (float)Foot.Frontfoot.CurrentMarker.xCoordinate / 100; ALsetup.SLchangepitch(pitch); }
private void KeepPlaying() { int st = Environment.TickCount; float pitchparameter, distance; try { while ((ALsetup.SLtoneupdate())) { //System.Diagnostics.Debug.WriteLine("In >KeepPlaying< " + tc.ToString()); //tc++; if (stopUpdate) { Thread.CurrentThread.Abort(); } //if (Foot.Frontfoot != null) //{ if ((left.CurrentMarker != null) && (right.CurrentMarker != null)) { if (left.CurrentMarker.zCoordinate > right.CurrentMarker.zCoordinate) { distance = (float)(Math.Abs(left.CurrentMarker.xCoordinate)); } else { distance = (float)(Math.Abs(right.CurrentMarker.xCoordinate)); } //distance = (float)(Math.Abs(Foot.Frontfoot.CurrentMarker.xCoordinate)); /*} * else * { * double zL = -9999; * double zR = -9999; * if (left.CurrentMarker != null) zL = left.CurrentMarker.zCoordinate; * if (right.CurrentMarker != null) zR = right.CurrentMarker.zCoordinate; * if (zL > zR) * { * distance = (float)(Math.Abs(left.CurrentMarker.xCoordinate)); * } * else * { * distance = (float)(Math.Abs(right.CurrentMarker.xCoordinate)); * } * * }*/ //System.Diagnostics.Debug.WriteLine("Frontfoot x:" + distance); //if (distance < 450) //{ if (distance < 5) { pitchparameter = 0.005f; } else { pitchparameter = (float)(1 / (2 * Math.Log10((double)(1.1 + (distance * 0.01))) + 0.02f)); } ALsetup.SLchangepitch(pitchparameter); //} //else //{ // System.Diagnostics.Debug.WriteLine("----> Distance >450 <----"); //ALsetup.SLstoptone(); //} //if (distance < 400) ALsetup.SLplayTone(250); } else { System.Diagnostics.Debug.WriteLine("---->Frontfoot NULL<----"); } } System.Diagnostics.Debug.WriteLine("Sound. Update loop ceased:" + (Environment.TickCount - st).ToString()); } catch (NullReferenceException) { System.Diagnostics.Debug.WriteLine("Null in Foot.Frontfoot"); } catch (ThreadAbortException) { System.Diagnostics.Debug.WriteLine("Update thread has aborted"); } }
public void StopPlaying() { ALsetup.SLstoptone(); //updateThread.Abort(); }
public void LoadWAV() { ALsetup.SLreadWAV(52280); ALsetup.SLPlayWAV(); }