Source

kinect-viewer / KinectViewerAppDelegate.m

Diff from to

KinectViewerAppDelegate.m

 #import "KinectViewerAppDelegate.h"
 #import "KVDepthView.h"
 #import "KVDepthPlayer.h"
+#import "KVDepthRecorder.h"
+#import "KVKinectHardware.h"
 
 @implementation KinectViewerAppDelegate
 
   }
 }
 
+- (IBAction) toggleRecording: sender {
+  if (recorder) {
+    [recorder close];
+    recorder = nil;
+    [sender setState: NSOffState];
+  } else {
+    recorder = [[KVDepthRecorder alloc] init];
+    [recorder open: @"/tmp/depth-recording.bin"];
+    [recorder bind: @"latestDepthSamples" toObject: kinect withKeyPath: @"latestDepthSamples" options: nil];
+    [sender setState: NSOnState];
+  }
+}
+
 @end