public void PlaySong(MyroInterfaces.IMyroSong song) { MyroSong msong = (MyroSong)song; foreach (MyroSong.ListItem li in msong.songSequence) { if (li.chord) { tonegen.PlayTone2Request request = new tonegen.PlayTone2Request(); request.Duration = (int)(li.duration * 1000f); request.Frequency1 = (int)li.frequency1; request.Frequency2 = (int)li.frequency2; tonegen.PlayTone2 ptone = new tonegen.PlayTone2(request); tonePort.Post(ptone); } else { tonegen.PlayToneRequest request = new tonegen.PlayToneRequest(); request.Duration = (int)(li.duration * 1000f); request.Frequency = (int)li.frequency1; tonegen.PlayTone ptone = new tonegen.PlayTone(request); tonePort.Post(ptone); } } }
public void PlaySong(MyroInterfaces.IMyroSong song) { MyroSong msong = (MyroSong)song; foreach (MyroSong.ListItem li in msong.songSequence) { if (li.chord) { tonegen.PlayTone2Request request = new tonegen.PlayTone2Request(); request.Duration = (int)(li.duration * 1000f); request.Frequency1 = (int)li.frequency1; request.Frequency2 = (int)li.frequency2; tonegen.PlayTone2 ptone = new tonegen.PlayTone2(request); tonePort.Post(ptone); bool done = false; Arbiter.Activate(DssEnvironment.TaskQueue, Arbiter.Receive <DefaultUpdateResponseType>(false, ptone.ResponsePort, delegate(DefaultUpdateResponseType state) { done = true; } )); while (!done) { ; } } else { tonegen.PlayToneRequest request = new tonegen.PlayToneRequest(); request.Duration = (int)(li.duration * 1000f); request.Frequency = (int)li.frequency1; tonegen.PlayTone ptone = new tonegen.PlayTone(request); tonePort.Post(ptone); bool done = false; Arbiter.Activate(DssEnvironment.TaskQueue, Arbiter.Receive <DefaultUpdateResponseType>(false, ptone.ResponsePort, delegate(DefaultUpdateResponseType state) { done = true; } )); while (!done) { ; } } } }
public void beep(float duration, float frequency) { bool flag = false; tonegen.PlayToneRequest request = new tonegen.PlayToneRequest(); request.Duration = (int)duration; request.Frequency = (int)frequency; tonegen.PlayTone ptone = new tonegen.PlayTone(request); tonePort.Post(ptone); Arbiter.Activate(DssEnvironment.TaskQueue, Arbiter.Receive <DefaultUpdateResponseType>(false, ptone.ResponsePort, delegate(DefaultUpdateResponseType state) { flag = true; } )); while (!flag) { ; } }