mirror of
https://github.com/thestk/stk
synced 2026-01-18 15:11:53 +00:00
full rename from tempiOSDir to iOS/demo
This commit is contained in:
14
iOS/demo/iOS Demo/AppDelegate.h
Normal file
14
iOS/demo/iOS Demo/AppDelegate.h
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// iOS Demo
|
||||
//
|
||||
// Created by Ariel Elkin on 03/03/2014.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
@end
|
||||
25
iOS/demo/iOS Demo/AppDelegate.m
Normal file
25
iOS/demo/iOS Demo/AppDelegate.m
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// iOS Demo
|
||||
//
|
||||
// Created by Ariel Elkin on 03/03/2014.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "ViewController.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
|
||||
ViewController *vc = [[ViewController alloc] initWithNibName:nil bundle:nil];
|
||||
[self.window setRootViewController:vc];
|
||||
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"subtype" : "retina4",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
12
iOS/demo/iOS Demo/ViewController.h
Normal file
12
iOS/demo/iOS Demo/ViewController.h
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// ViewController.h
|
||||
// iOS Demo
|
||||
//
|
||||
// Created by Ariel Elkin on 03/03/2014.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
@end
|
||||
102
iOS/demo/iOS Demo/ViewController.mm
Normal file
102
iOS/demo/iOS Demo/ViewController.mm
Normal file
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ViewController.m
|
||||
// iOS Demo
|
||||
//
|
||||
// Created by Ariel Elkin on 03/03/2014.
|
||||
//
|
||||
|
||||
#import "ViewController.h"
|
||||
|
||||
#import "SineWave.h"
|
||||
#import "Brass.h"
|
||||
#import "Mandolin.h"
|
||||
|
||||
@implementation ViewController {
|
||||
stk::SineWave *sineWave;
|
||||
stk::Brass *brass;
|
||||
}
|
||||
|
||||
- (void)loadView {
|
||||
self.view = [UIView new];
|
||||
[self.view setBackgroundColor:[UIColor whiteColor]];
|
||||
[self setupUI];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
NSUInteger samplesToGenerate = 1000;
|
||||
|
||||
//Test SineWave:
|
||||
sineWave = new stk::SineWave();
|
||||
|
||||
for (NSUInteger i = 0; i < samplesToGenerate; i ++) {
|
||||
float sample = sineWave->tick();
|
||||
NSLog(@"SineWave sample: %f", sample);
|
||||
}
|
||||
|
||||
//Test Brass:
|
||||
brass = new stk::Brass();
|
||||
|
||||
brass->noteOn(400, 1);
|
||||
|
||||
for (NSUInteger i = 0; i < samplesToGenerate; i ++) {
|
||||
float sample = brass->tick();
|
||||
NSLog(@"Brass sample: %f", sample);
|
||||
}
|
||||
|
||||
//Test Mandolin:
|
||||
stk::Mandolin *mandolin = new stk::Mandolin(400);
|
||||
|
||||
mandolin->pluck(1);
|
||||
|
||||
for (NSUInteger i = 0; i < samplesToGenerate; i ++) {
|
||||
float sample = mandolin->tick();
|
||||
NSLog(@"Mandolin sample: %f", sample);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark TODO - Audio playback
|
||||
}
|
||||
|
||||
|
||||
- (void)sineSliderMoved:(UISlider *)slider {
|
||||
sineWave->setFrequency(slider.value);
|
||||
NSLog(@"Setting SineWave frequency to %.2f", slider.value);
|
||||
}
|
||||
|
||||
- (void)brassSliderMoved:(UISlider *)slider {
|
||||
brass->setFrequency(slider.value);
|
||||
NSLog(@"Setting Brass frequency to %.2f", slider.value);
|
||||
}
|
||||
|
||||
- (void)setupUI {
|
||||
|
||||
//Add slider to control sine wave frequency:
|
||||
UISlider *sineSlider = [[UISlider alloc] init];
|
||||
[sineSlider addTarget:self action:@selector(sineSliderMoved:) forControlEvents:UIControlEventValueChanged];
|
||||
[sineSlider setMinimumValue:0];
|
||||
[sineSlider setMaximumValue:800];
|
||||
[sineSlider setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[self.view addSubview:sineSlider];
|
||||
|
||||
NSDictionary *metrics = @{@"sliderWidth": @200};
|
||||
|
||||
NSArray *sliderConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-40-[sineSlider(sliderWidth)]" options:0 metrics:metrics views:@{@"sineSlider": sineSlider}];
|
||||
[self.view addConstraints:sliderConstraints];
|
||||
|
||||
//Add slider to control brass's frequency:
|
||||
UISlider *brassSlider = [[UISlider alloc] init];
|
||||
[brassSlider addTarget:self action:@selector(brassSliderMoved:) forControlEvents:UIControlEventValueChanged];
|
||||
[brassSlider setMinimumValue:0];
|
||||
[brassSlider setMaximumValue:800];
|
||||
[brassSlider setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[self.view addSubview:brassSlider];
|
||||
|
||||
sliderConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-40-[brassSlider(sliderWidth)]" options:0 metrics:metrics views:@{@"brassSlider": brassSlider}];
|
||||
[self.view addConstraints:sliderConstraints];
|
||||
sliderConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-40-[sineSlider]-[brassSlider]" options:0 metrics:nil views:@{@"sineSlider": sineSlider, @"brassSlider": brassSlider}];
|
||||
[self.view addConstraints:sliderConstraints];
|
||||
}
|
||||
|
||||
@end
|
||||
2
iOS/demo/iOS Demo/en.lproj/InfoPlist.strings
Normal file
2
iOS/demo/iOS Demo/en.lproj/InfoPlist.strings
Normal file
@@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
38
iOS/demo/iOS Demo/iOS Demo-Info.plist
Normal file
38
iOS/demo/iOS Demo/iOS Demo-Info.plist
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>stk.${PRODUCT_NAME:rfc1034identifier}</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.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
16
iOS/demo/iOS Demo/iOS Demo-Prefix.pch
Normal file
16
iOS/demo/iOS Demo/iOS Demo-Prefix.pch
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Prefix header
|
||||
//
|
||||
// The contents of this file are implicitly included at the beginning of every source file.
|
||||
//
|
||||
|
||||
#import <Availability.h>
|
||||
|
||||
#ifndef __IPHONE_3_0
|
||||
#warning "This project uses features only available in iOS SDK 3.0 and later."
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
18
iOS/demo/iOS Demo/main.m
Normal file
18
iOS/demo/iOS Demo/main.m
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// main.m
|
||||
// iOS Demo
|
||||
//
|
||||
// Created by Ariel Elkin on 03/03/2014.
|
||||
// Copyright (c) 2014 Ariel Elkin. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user