예제 #1
0
        private void KStudioClient_Playback_StateChanged(object sender, EventArgs e)
        {
            LogConsole.WriteLine("Playback state: {0}", playback.State.ToString());

            if (playback.State == KStudioPlaybackState.Stopped)
            {
                CloseRecording();
            }
        }
예제 #2
0
        public void StopRecording()
        {
            if (recording != null)
            {
                recording.Stop();
                recording.Dispose();
                recording = null;
            }
            if (client != null)
            {
                client.DisconnectFromService();
                client.Dispose();
                client = null;
            }

            LogConsole.WriteLine("Recording stopped");
        }
예제 #3
0
        public void CloseRecording()
        {
            OnRecordingStopped();

            if (playback != null)
            {
                playback.Stop();
                playback.Dispose();
                playback = null;
            }
            if (client != null)
            {
                client.DisconnectFromService();
                client.Dispose();
                client = null;
            }

            LogConsole.WriteLine("Recording stopped");
        }
예제 #4
0
        public void StartRecording(string filePath)
        {
            client = KStudio.CreateClient();

            client.ConnectToService();

            KStudioEventStreamSelectorCollection streamCollection = new KStudioEventStreamSelectorCollection();

            streamCollection.Add(KStudioEventStreamDataTypeIds.UncompressedColor);
            streamCollection.Add(KStudioEventStreamDataTypeIds.Depth);
            // The enum value for Audio is missing. The GUID below was taken from Kinect Studio.
            var Audio = new Guid(0x787c7abd, 0x9f6e, 0x4a85, 0x8d, 0x67, 0x63, 0x65, 0xff, 0x80, 0xcc, 0x69);

            streamCollection.Add(Audio);

            recording = client.CreateRecording(filePath, streamCollection, KStudioRecordingFlags.IgnoreOptionalStreams);
            recording.Start();

            LogConsole.WriteLine("File opened and recording ...");
        }
예제 #5
0
        public void OpenRecording(string filePath)
        {
            client = KStudio.CreateClient();

            client.ConnectToService();

            KStudioEventStreamSelectorCollection streamCollection = new KStudioEventStreamSelectorCollection();

            streamCollection.Add(KStudioEventStreamDataTypeIds.UncompressedColor);
            streamCollection.Add(KStudioEventStreamDataTypeIds.Depth);
            Guid Audio = new Guid(0x787c7abd, 0x9f6e, 0x4a85, 0x8d, 0x67, 0x63, 0x65, 0xff, 0x80, 0xcc, 0x69);

            streamCollection.Add(Audio);

            playback = client.CreatePlayback(filePath, streamCollection);
            playback.StateChanged += KStudioClient_Playback_StateChanged;
            playback.Start();

            OnKinectAvailabilityChanged(this, true);

            LogConsole.WriteLine("Recording opened and playing ...");
        }