コード例 #1
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)
            {
                ;
            }
        }
コード例 #2
0
ファイル: ToneGeneratorAdapter.cs プロジェクト: yingted/Myro
        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);
                }
            }
        }
コード例 #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);
                    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)
                    {
                        ;
                    }
                }
            }
        }