Skip to content

Commit 35f3335

Browse files
committed
use bundled presets, skip config file. make self-contained
1 parent 019f00f commit 35f3335

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

src/projectM-iTunes/iprojectM.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,14 @@
8080

8181
struct VisualPluginData;
8282

83-
#if TARGET_OS_MAC
8483
#import <Cocoa/Cocoa.h>
8584
#import <AppKit/AppKit.h>
8685

8786
// "namespace" our ObjC classname to avoid load conflicts between multiple visualizer plugins
8887
#define VisualView iProjectM_VisualView
89-
#define GLVisualView iProjectM_GLVisualView
9088

9189
@class VisualView;
92-
@class GLVisualView;
9390

94-
#endif
9591

9692
#define kInfoTimeOutInSeconds 10 // draw info/artwork for N seconds when it changes or playback starts
9793
#define kPlayingPulseRateInHz 60 // when iTunes is playing, draw N times a second
@@ -162,7 +158,7 @@ void InvalidateVisual( VisualPluginData * visualPluginData );
162158

163159
OSStatus ConfigureVisual( VisualPluginData * visualPluginData );
164160

165-
void initProjectM( VisualPluginData * visualPluginData );
161+
void initProjectM( VisualPluginData * visualPluginData, std::string presetPath );
166162
void renderProjectMTexture( VisualPluginData * visualPluginData );
167163
void keypressProjectM( VisualPluginData * visualPluginData, projectMEvent event, projectMKeycode keycode, projectMModifier mod );
168164

src/projectM-iTunes/iprojectM.mm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
// projectM
10-
void initProjectM( VisualPluginData * visualPluginData ) {
10+
void initProjectM( VisualPluginData * visualPluginData, std::string presetPath ) {
1111
// std::string config_filename = getConfigFilename();
1212
std::string cfg_path = "/usr/local/share/projectM/config.inp";
1313

@@ -20,23 +20,24 @@ void initProjectM( VisualPluginData * visualPluginData ) {
2020
settings.windowWidth = 1920;
2121
settings.windowHeight = 1280;
2222
settings.smoothPresetDuration = 1; // seconds
23-
settings.presetDuration = 5; // seconds
23+
settings.presetDuration = 1; // seconds
2424
settings.beatSensitivity = 0.8;
2525
settings.aspectCorrection = 1;
2626
settings.easterEgg = 0; // ???
2727
settings.shuffleEnabled = 1;
2828
settings.softCutRatingsEnabled = 1; // ???
29-
settings.presetURL = "/usr/local/share/projectM/presets";
29+
30+
settings.presetURL = presetPath;
3031
settings.titleFontURL = "/usr/local/share/projectM/fonts/Vera.ttf";
3132
settings.menuFontURL = "/usr/local/share/projectM/fonts/VeraMono.ttf";
32-
//projectM *pm = new projectM(settings, 0);
33+
projectM *pm = new projectM(settings, 0);
3334

3435
NSLog(@"GL_VERSION: %s", glGetString(GL_VERSION));
3536
NSLog(@"GL_SHADING_LANGUAGE_VERSION: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
3637
NSLog(@"GL_VENDOR: %s", glGetString(GL_VENDOR));
3738

3839
// use config file
39-
projectM *pm = new projectM(cfg_path);
40+
// projectM *pm = new projectM(cfg_path);
4041

4142
visualPluginData->pm = pm;
4243

src/projectM-iTunes/iprojectM_mac.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void DrawVisual( VisualPluginData * visualPluginData )
5555
// [[drawView openGLContext] flushBuffer];
5656
glFlush();
5757

58-
return;
58+
// return;
5959

6060
// TODO: artwork overlay
6161

@@ -166,7 +166,13 @@ OSStatus ActivateVisual( VisualPluginData * visualPluginData, VISUAL_PLATFORM_VI
166166
#endif
167167
NSLog(@"activate visual");
168168
if (visualPluginData->pm == NULL) {
169-
initProjectM(visualPluginData);
169+
170+
NSBundle* me = [NSBundle bundleForClass: VisualView.class];
171+
NSLog(@"main bundle: %@", [me bundlePath]);
172+
NSString* presetsPath = [me pathForResource:@"presets" ofType:nil];
173+
NSLog(@"presets path %@", presetsPath);
174+
175+
initProjectM(visualPluginData, std::string([presetsPath UTF8String]));
170176

171177
// correctly size it
172178
ResizeVisual(visualPluginData);

src/projectM-iTunes/projectM Visualizer.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@
495495
);
496496
runOnlyForDeploymentPostprocessing = 0;
497497
shellPath = /bin/bash;
498-
shellScript = "mkdir -p \"$DSTROOT/usr/local/share/projectM/presets\"\n#cp -r \"$SRCROOT\"/../../presets/custom/* \"$DSTROOT/usr/local/share/projectM/presets/\"\ncp -r \"$SRCROOT\"/../../presets/presets_tryptonaut/* \"$DSTROOT/usr/local/share/projectM/presets/\"\ncp -r \"$SRCROOT\"/../../presets/presets_bltc201/* \"$DSTROOT/usr/local/share/projectM/presets/\"\n#rm -rf \"$SRCROOT/iProjectM.bundle\"\n#cp -r \"$DSTROOT/Library/iTunes/iTunes Plug-ins/iProjectM.bundle\" $SRCROOT/\ninstall_name_tool -change @executable_path/../Frameworks/Cg.framework/Cg @loader_path/../Frameworks/Cg.framework/Cg \"$DSTROOT/Library/iTunes/iTunes Plug-ins/iProjectM.bundle/Contents/MacOS/iProjectM\"\ncp -r $CONFIGURATION_BUILD_DIR/share/* \"$DSTROOT/usr/local/share/projectM\"\npkgbuild --component-plist \"$SRCROOT/iProjectM-pkg.plist\" --root \"$DSTROOT\" \"$SRCROOT/iProjectM.pkg\"\n";
498+
shellScript = "POUT=\"$BUILT_PRODUCTS_DIR\"/\"$CONTENTS_FOLDER_PATH/Resources/presets\"\nPIN=\"$SRCROOT\"/../../presets\n\nmkdir -p \"$POUT\"\nfor preset_dir in \"$PIN/\"*; do\ncp \"$preset_dir/\"* \"$POUT/\"\ndone\necho \"Copied presets to $POUT\"\n\n\npkgbuild --component-plist \"$SRCROOT/iProjectM-pkg.plist\" --root \"$DSTROOT\" \"$SRCROOT/iTunes Visualizer.pkg\"\n";
499499
};
500500
/* End PBXShellScriptBuildPhase section */
501501

0 commit comments

Comments
 (0)