-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
511 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// AppController.h | ||
// MySpleeter | ||
// | ||
// Created by kyab on 2020/09/01. | ||
// Copyright © 2020 kyab. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <Cocoa/Cocoa.h> | ||
#import "DragAndDropTextField.h" | ||
#import "SpleeterWrapper.h" | ||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface AppController : NSObject{ | ||
|
||
__weak IBOutlet DragAndDropTextField *_txtInputFile; | ||
__weak IBOutlet DragAndDropTextField *_txtOutputDir; | ||
__weak IBOutlet NSButton *_btnDoSpleet; | ||
|
||
SpleeterWrapper *_spleeter; | ||
|
||
} | ||
|
||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// | ||
// AppController.m | ||
// MySpleeter | ||
// | ||
// Created by kyab on 2020/09/01. | ||
// Copyright © 2020 kyab. All rights reserved. | ||
// | ||
|
||
#import "AppController.h" | ||
#import <Cocoa/Cocoa.h> | ||
|
||
@implementation AppController | ||
-(void)awakeFromNib{ | ||
NSLog(@"AppController awakeFromNib"); | ||
_spleeter = [[SpleeterWrapper alloc] init]; | ||
} | ||
|
||
- (IBAction)testClicked:(id)sender { | ||
NSLog(@"test"); | ||
} | ||
|
||
- (IBAction)selectInputFile:(id)sender { | ||
NSLog(@"Select input file"); | ||
NSOpenPanel *panel = [[NSOpenPanel alloc] init]; | ||
[panel setCanChooseFiles:YES]; | ||
[panel setAllowsMultipleSelection:NO]; | ||
[panel setCanChooseDirectories:NO]; | ||
if ([panel runModal] == NSModalResponseOK){ | ||
NSURL *url = [panel URL]; | ||
NSLog(@"path = %@", [url path]); | ||
[_txtInputFile setStringValue:[url path]]; | ||
}else{ | ||
//User cancelled | ||
} | ||
} | ||
|
||
- (IBAction)selectOutputDir:(id)sender { | ||
NSLog(@"Select output dir"); | ||
NSOpenPanel *panel = [[NSOpenPanel alloc] init]; | ||
[panel setCanCreateDirectories:YES]; | ||
[panel setCanChooseFiles:NO]; | ||
[panel setAllowsMultipleSelection:NO]; | ||
[panel setCanChooseDirectories:YES]; | ||
|
||
if ([panel runModal] == NSModalResponseOK){ | ||
NSURL *url = [panel URL]; | ||
NSLog(@"path = %@", [url path]); | ||
[_txtOutputDir setStringValue:[url path]]; | ||
}else{ | ||
//User cancelled | ||
} | ||
|
||
} | ||
- (IBAction)doSeparate:(id)sender { | ||
NSString *inFile = [_txtInputFile stringValue]; | ||
NSString *outDir = [_txtOutputDir stringValue]; | ||
|
||
if ([inFile length] ==0 || [outDir length] == 0){ | ||
//empty infile or outdir | ||
NSAlert *alert = [[NSAlert alloc] init]; | ||
[alert setInformativeText:@"Please select input file and output directory."]; | ||
[alert setMessageText:@"error"]; | ||
[alert runModal]; | ||
return; | ||
} | ||
//this is what we need. | ||
|
||
[_spleeter makeSeparator5stems]; | ||
NSString *ret = [_spleeter separate_file:inFile outDir:outDir]; | ||
|
||
NSAlert *alert = [[NSAlert alloc] init]; | ||
[alert setInformativeText:ret]; | ||
[alert setMessageText:@"result"]; | ||
[alert runModal]; | ||
|
||
|
||
} | ||
|
||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.