コード例 #1
0
 private void playTone()
 {
     brick.PlayToneBody play = new brick.PlayToneBody()
     {
         Frequency1 = (int)Math.Round(_state.Values[0]),
         Frequency2 = (int)Math.Round(_state.Values[1]),
         Duration   = (int)Math.Round(_state.Values[2])
     };
     if (play.Frequency1 < 0 || play.Frequency2 < 0 || play.Duration < 0)
     {
         throw new ArgumentOutOfRangeException();
     }
     else
     {
         Activate(Arbiter.Choice(_scribblerPort.PlayTone(play),
                                 delegate(DefaultUpdateResponseType success) { },
                                 delegate(Fault failure) { LogError("Fault playing tone", failure); }));
     }
 }
コード例 #2
0
        private DsspResponsePort <vector.CallbackResponseType> playTone()
        {
            var responsePort = new DsspResponsePort <vector.CallbackResponseType>();

            brick.PlayToneBody play = new brick.PlayToneBody()
            {
                Frequency1 = (int)Math.Round(_state.Values[0]),
                Frequency2 = (int)Math.Round(_state.Values[1]),
                Duration   = (int)Math.Round(_state.Values[2])
            };
            if (play.Frequency1 < 0 || play.Frequency2 < 0 || play.Duration < 0)
            {
                responsePort.Post(RSUtils.FaultOfException(new ArgumentOutOfRangeException()));
            }
            else
            {
                Activate(Arbiter.Choice(_scribblerPort.PlayTone(play),
                                        delegate(DefaultUpdateResponseType success) { responsePort.Post(vector.CallbackResponseType.Instance); },
                                        delegate(Fault failure) { responsePort.Post(failure); }));
            }
            return(responsePort);
        }