Example #1
0
        public virtual IEnumerator <ITask> PlayTone2Handler(tone.PlayTone2 request)
        {
            if (request.Body.Frequency1 < 0 || request.Body.Frequency2 < 0 || request.Body.Duration < 0)
            {
                LogError("Improper PlayTone2 Frequency or Duration");
                request.ResponsePort.Post(new Fault());
                yield break;
            }

            brick.PlayToneBody play = new brick.PlayToneBody();
            play.Frequency1 = request.Body.Frequency1;
            play.Frequency2 = request.Body.Frequency2;
            play.Duration   = request.Body.Duration;

            Activate(Arbiter.Choice(_scribblerPort.PlayTone(play),
                                    delegate(DefaultUpdateResponseType response)
            {
                request.ResponsePort.Post(DefaultUpdateResponseType.Instance);
            },
                                    delegate(Fault fault)
            {
                request.ResponsePort.Post(new Fault());
            }
                                    ));

            yield break;
        }
Example #2
0
        public void beep(float duration, float frequency1, float frequency2)
        {
            bool flag = false;

            tonegen.PlayTone2Request request = new tonegen.PlayTone2Request();
            request.Duration   = (int)duration;
            request.Frequency1 = (int)frequency1;
            request.Frequency2 = (int)frequency2;

            tonegen.PlayTone2 ptone = new tonegen.PlayTone2(request);
            tonePort.Post(ptone);

            Arbiter.Activate(DssEnvironment.TaskQueue,
                             Arbiter.Receive <DefaultUpdateResponseType>(false, ptone.ResponsePort,
                                                                         delegate(DefaultUpdateResponseType state)
            {
                flag = true;
            }
                                                                         ));

            while (!flag)
            {
                ;
            }
        }
Example #3
0
        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);
                }
            }
        }
Example #4
0
        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)
                    {
                        ;
                    }
                }
            }
        }