Skip to content

Commit

Permalink
Modified install document of README.md, and Adjusted iSCApp & iSCAppS…
Browse files Browse the repository at this point in the history
…wift
  • Loading branch information
kengo watanabe committed Oct 17, 2015
1 parent c535372 commit a52bcbd
Show file tree
Hide file tree
Showing 17 changed files with 175 additions and 173 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ Project directory must be located same position of iSCKit directory like to iSCA


2. 'Header Search Path' (Build Settings)
Add [project root] > [iSCKit] path.
ex. *$(PROJECT_DIR)/../../iSCKit*
Add [project root] > [iSupercolliderKit] path.
ex. *$(PROJECT_DIR)/../../*


3. 'Library Search Path' (Build Settings)
Add [project root] > [lib] path.
ex. *$(PROJECT_DIR)/../../lib*
ex. *$(PROJECT_DIR)/../../iSupercolliderKit/lib*


4. 'Objective-C Automatic Reference Counting' (Build Setting)
Expand Down
2 changes: 1 addition & 1 deletion iSCKit/iSC.mm
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ - (void) interpretSCMessage:(NSString *)string

if (pthread_mutex_trylock(&gLangMutex) == 0)
{
NSLog(@"%d,%s, interpret: runLibary()", __LINE__, __FUNCTION__);
//NSLog(@"%d,%s, interpret: runLibary()", __LINE__, __FUNCTION__);
runLibrary(s_interpretPrintCmdLine);
pthread_mutex_unlock(&gLangMutex);
}
Expand Down
27 changes: 0 additions & 27 deletions projects/iSCApp/Codes/LoggingViewController.h

This file was deleted.

39 changes: 0 additions & 39 deletions projects/iSCApp/Codes/LoggingViewController.m

This file was deleted.

16 changes: 16 additions & 0 deletions projects/iSCApp/Codes/TouchView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// TouchView.h
// iSCApp
//
// Created by kengo on 2015/10/17.
//
//

#import <UIKit/UIKit.h>

@interface TouchView : UIView

@property id delegate;
@property SEL ev_touches_began;

@end
25 changes: 25 additions & 0 deletions projects/iSCApp/Codes/TouchView.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// TouchView.m
// iSCApp
//
// Created by kengo on 2015/10/17.
//
//

#import "TouchView.h"
#import <objc/message.h>

@implementation TouchView

@synthesize delegate;
@synthesize ev_touches_began;

-(void) touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
if(self.delegate != nil && self.ev_touches_began != nil && [self.delegate respondsToSelector:self.ev_touches_began])
{
((void (*)(id, SEL, NSSet<UITouch *>*, UIEvent *))objc_msgSend)(self.delegate, self.ev_touches_began, touches, event);
}
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@

#import <UIKit/UIKit.h>

@interface LiveViewController : UIViewController
@interface ViewController : UIViewController<UITextViewDelegate>

@end
71 changes: 71 additions & 0 deletions projects/iSCApp/Codes/ViewController.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
iSuperCollider Kit (iSCKit) - SuperCollider for iOS 7 later
Copyright (c) 2015 Kengo Watanabe <kengo@wdkk.co.jp>. All rights reserved.
http://wdkk.co.jp/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/


#import "ViewController.h"
#import "TouchView.h"
#import <iSCKit/iSCKit.h>


@interface ViewController ()

@end

@implementation ViewController

- (void) viewDidLoad
{
// use iSCKit Log View. it's controlled iSC Class.
iSCLogView *log_view = [iSC sharedLogView];
log_view.frame = CGRectMake(0, 50, log_view.frame.size.width, log_view.frame.size.height-50);
[self.view addSubview:log_view];

// create TouchView(Blue) that call Sine cave playing code
TouchView *touch_blue = [[TouchView alloc] initWithFrame:CGRectMake(5, 5, 40, 40)];
touch_blue.backgroundColor = [UIColor blueColor];
touch_blue.delegate = self;
touch_blue.ev_touches_began = @selector(touchesBlue:withEvent:);
[self.view addSubview:touch_blue];

// create TouchView(Red) that call Sine cave playing code
TouchView *touch_red = [[TouchView alloc] initWithFrame:CGRectMake(50, 5, 40, 40)];
touch_red.backgroundColor = [UIColor redColor];
touch_red.delegate = self;
touch_red.ev_touches_began = @selector(touchesRed:withEvent:);
[self.view addSubview:touch_red];
}

// Touch Event of touch_blue object.
- (void) touchesBlue:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
// interpret "Supercollider Code" using iSCKit.
[iSC interpret:@"a = {SinOsc.ar()}.play"];
}


// Touch Event of touch_red object.
- (void) touchesRed:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
// interpret "Supercollider Code" using iSCKit.
[iSC interpret:@"a.free"];
}

@end
7 changes: 2 additions & 5 deletions projects/iSCApp/Codes/iSCAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@
#import <UIKit/UIKit.h>
#import <iSCKit/iSCKit.h>

#import "LoggingViewController.h"
#import "LiveViewController.h"
#import "ViewController.h"

@interface iSCAppDelegate : NSObject <UIApplicationDelegate>

@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UITabBarController *tab_bar_controller;
@property (nonatomic, strong) ViewController *vc;

@property (nonatomic, strong) LoggingViewController *log_vc;
@property (nonatomic, strong) LiveViewController *live_vc;

@end

61 changes: 0 additions & 61 deletions projects/iSCApp/Codes/iSCAppDelegate.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,31 @@ iSuperCollider Kit (iSCKit) - SuperCollider for iOS 7 later
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#import "LiveViewController.h"
#import <iSCKit/iSCKit.h>
#import "iSCAppDelegate.h"

@implementation LiveViewController
@implementation iSCAppDelegate

- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
{

}
return self;
}
@synthesize window;

- (void) viewDidLoad
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.view.backgroundColor = [UIColor lightGrayColor];
// Generate Window and ViewControllers
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];

// Boot iSCKit Controller before using iSC log view.
[iSC setup];

self.vc = [[ViewController alloc] initWithNibName:nil bundle:nil];

// Override point for customization after application launch
self.window.rootViewController = self.vc;
[self.window makeKeyAndVisible];

// boot SuperCollider
[iSC interpret:@"s.boot"];

[iSC interpret:@"a = {SinOsc.ar()}.play"];
return YES;
}

@end
Loading

0 comments on commit a52bcbd

Please sign in to comment.