Permalink
Browse files

addition and fix

fixed a stupid bug with the ISF quicklook plugin where the R and B channels were getting swapped :: added a super-simple app that sends MTC, because i find myself needing one of these surprisingly often
  • Loading branch information...
1 parent 8159bf0 commit e185b3a2bb981b5fe3c25631fa81a7b4a15a6eea @mrRay committed Jun 2, 2016
@@ -162,6 +162,7 @@ - (void) renderThumbnailForPath:(NSString *)n sized:(NSSize)s {
ISFGLScene *scene = [[ISFGLScene alloc] initWithSharedContext:[_globalVVBufferPool sharedContext] pixelFormat:[GLScene defaultPixelFormat] sized:renderSize];
//NSLog(@"\t\tscene is %@",scene);
VVBuffer *renderBuffer = [_globalVVBufferPool allocBGRTexSized:renderSize];
+ VVBuffer *swizzleBuffer = nil;
BOOL problemRendering = NO;
[scene setThrowExceptions:YES];
@@ -173,14 +174,22 @@ - (void) renderThumbnailForPath:(NSString *)n sized:(NSSize)s {
}
[scene renderToBuffer:renderBuffer sized:renderSize];
+
+ // it's not really flipped, but CGImage stuff wants a flipped buffer...
+ [renderBuffer setFlipped:YES];
+
+ // swizzle the colors!
+ [_swizzleScene setSize:[renderBuffer srcRect].size];
+ [_swizzleScene setFilterInputImageBuffer:renderBuffer];
+ swizzleBuffer = [_swizzleScene allocAndRenderABuffer];
}
@catch (NSException *err) {
problemRendering = YES;
}
- [renderBuffer setFlipped:YES]; // it's not really flipped, but CGImage stuff wants a flipped buffer...
- //NSLog(@"\t\trenderBuffer is %@",renderBuffer);
+
+ //NSLog(@"\t\tswizzleBuffer is %@",swizzleBuffer);
@@ -196,7 +205,7 @@ - (void) renderThumbnailForPath:(NSString *)n sized:(NSSize)s {
// else rendering happened without issue- download the image we rendered, then pass it back to the ROP
else {
TexRangeGLCPUStreamer *streamer = [[TexRangeGLCPUStreamer alloc] init];
- [streamer setNextTexBufferForStream:renderBuffer];
+ [streamer setNextTexBufferForStream:swizzleBuffer];
VVBuffer *cpuBuffer = nil;
while (cpuBuffer == nil) {
cpuBuffer = [streamer copyAndGetCPUBackedBufferForStream];
@@ -224,6 +233,7 @@ - (void) renderThumbnailForPath:(NSString *)n sized:(NSSize)s {
VVRELEASE(streamer);
}
+ VVRELEASE(swizzleBuffer);
VVRELEASE(renderBuffer);
VVRELEASE(scene);
@@ -9,11 +9,13 @@
#import <Cocoa/Cocoa.h>
#import "ISFQLRendererAgent.h"
#import <VVBufferPool/VVBufferPool.h>
+#import <VVISFKit/VVISFKit.h>
extern VVBuffer *_globalColorBars;
+extern ISFGLScene *_swizzleScene;
@@ -6,6 +6,7 @@
VVBuffer *_globalColorBars = nil;
+ISFGLScene *_swizzleScene = nil;
#define LOCK OSSpinLockLock
@@ -36,6 +37,11 @@ - (id) init {
[bars release];
bars = nil;
+ // load the swizzle scene
+ _swizzleScene = [[ISFGLScene alloc] initWithSharedContext:sharedContext pixelFormat:pf sized:NSMakeSize(800,600)];
+ NSString *swizzleSrc = [[NSBundle mainBundle] pathForResource:@"SwizzleISF-RGBAtoBGRA" ofType:@"fs"];
+ [_swizzleScene useFile:swizzleSrc];
+
// spawn a thread- the listener will run on this thread
[NSThread detachNewThreadSelector:@selector(threadLaunch:) toTarget:self withObject:nil];
@@ -0,0 +1,58 @@
+{
+ "images" : [
+ {
+ "idiom" : "mac",
+ "size" : "16x16",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "16x16",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "32x32",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "32x32",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "128x128",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "128x128",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "256x256",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "256x256",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "512x512",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "512x512",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
Oops, something went wrong.
View
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
@@ -0,0 +1,6 @@
+#import <Foundation/Foundation.h>
+#import <VVMIDI/VVMIDI.h>
+
+@interface MTCMIDIManager : VVMIDIManager
+
+@end
@@ -0,0 +1,13 @@
+#import "MTCMIDIManager.h"
+
+@implementation MTCMIDIManager
+
+// these methods exist so subclasses of me can override them to change the name of the default midi destinations/receivers
+- (NSString *) receivingNodeName {
+ return @"To MTC Tester";
+}
+- (NSString *) sendingNodeName {
+ return @"From MTC Tester";
+}
+
+@end
@@ -0,0 +1,52 @@
+#import <Cocoa/Cocoa.h>
+#import <VVMIDI/VVMIDI.h>
+#import "MTCMIDIManager.h"
+
+
+
+
+/* From CoreAudioTypes.h:
+ enum {
+ kSMPTETimeType24 = 0,
+ kSMPTETimeType25 = 1,
+ kSMPTETimeType30Drop = 2,
+ kSMPTETimeType30 = 3,
+ kSMPTETimeType2997 = 4,
+ kSMPTETimeType2997Drop = 5
+ };
+*/
+
+
+
+
+@interface MTCSenderAppDelegate : NSObject <NSApplicationDelegate,VVMIDIDelegateProtocol> {
+ IBOutlet NSTextField *startTimeField;
+ IBOutlet NSPopUpButton *formatPUB;
+ IBOutlet NSPopUpButton *targetDevicePUB;
+
+ MTCMIDIManager *mm;
+ VVMIDINode *outputNode; // this is the output node chosen by the midi manager
+ long smpteFormat;
+ double startTimeInSeconds;
+ BOOL running;
+ CAClockRef outputClock;
+
+ NSTimer *statusTimer;
+ IBOutlet NSTextField *statusField;
+}
+
+- (IBAction) startTimeFieldUsed:(id)sender;
+- (IBAction) formatPUBUsed:(id)sender;
+- (IBAction) targetDevicePUBUsed:(id)sender;
+
+- (IBAction) startClicked:(id)sender;
+- (IBAction) stopClicked:(id)sender;
+
+- (void) start;
+- (void) stop;
+- (BOOL) running;
+- (double) startTimeInSeconds;
+- (double) fps;
+
+@end
+
Oops, something went wrong.

0 comments on commit e185b3a

Please sign in to comment.