コード例 #1
0
ファイル: GamePage.xaml.cs プロジェクト: ARChess/ARChess
        public GamePage()
        {
            InitializeComponent();

            // Get the application's ContentManager
            content = (Application.Current as App).Content;

            timer = new GameTimer {
                UpdateInterval = TimeSpan.FromTicks(333333)
            };
            timer.Update += OnUpdate;
            timer.Draw   += OnDraw;

            dispatcherTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(50)
            };
            dispatcherTimer.Tick += (sender, e1) => Detect();

            if (GameState.getInstance(false) != null)
            {
                GameState.getInstance().resetTurn();
            }

            //setup microphone and configure delegates that handle events
            microphone.BufferDuration = TimeSpan.FromSeconds(1);
            microphoneBuffer          = new byte[microphone.GetSampleSizeInBytes(microphone.BufferDuration)];

            BasicHttpBinding binding = new BasicHttpBinding()
            {
                MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue
            };
            EndpointAddress address = new EndpointAddress(voiceRecognitionServerIP);

            speechRecognitionClient = new ARVRClient(binding, address);

            microphone.BufferReady += delegate
            {
                microphone.GetData(microphoneBuffer);
                microphoneMemoryStream.Write(microphoneBuffer, 0, microphoneBuffer.Length);
            };
            speechRecognitionClient.RecognizeSpeechCompleted += new EventHandler <RecognizeSpeechCompletedEventArgs>(_client_RecognizeSpeechCompleted);
        }
コード例 #2
0
ファイル: GamePage.xaml.cs プロジェクト: ARChess/ARChess
        public GamePage()
        {
            InitializeComponent();

            // Get the application's ContentManager
            content = (Application.Current as App).Content;

            timer = new GameTimer { UpdateInterval = TimeSpan.FromTicks(333333) };
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

            dispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(50) };
            dispatcherTimer.Tick += (sender, e1) => Detect();

            if (GameState.getInstance(false) != null)
            {
                GameState.getInstance().resetTurn();
            }

            //setup microphone and configure delegates that handle events
            microphone.BufferDuration = TimeSpan.FromSeconds(1);
            microphoneBuffer = new byte[microphone.GetSampleSizeInBytes(microphone.BufferDuration)];

            BasicHttpBinding binding = new BasicHttpBinding() { MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue };
            EndpointAddress address = new EndpointAddress(voiceRecognitionServerIP);
            speechRecognitionClient = new ARVRClient(binding, address);

            microphone.BufferReady += delegate
            {
                microphone.GetData(microphoneBuffer);
                microphoneMemoryStream.Write(microphoneBuffer, 0, microphoneBuffer.Length);
            };
            speechRecognitionClient.RecognizeSpeechCompleted += new EventHandler<RecognizeSpeechCompletedEventArgs>(_client_RecognizeSpeechCompleted);
        }