Permalink
Browse files

added instruments bar and accidentals

  • Loading branch information...
1 parent 0d43b6d commit 2c6d1d2b5e47a9db3232badeb76100f031786ac3 @cnharris10 cnharris10 committed Apr 25, 2012
@@ -30,6 +30,7 @@
2A8E8FBA15374EF80067DB3D /* Circleof5thsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A8E8FB915374EF80067DB3D /* Circleof5thsController.m */; };
2A94A4D61542517F00766EAF /* graybutton.png in Resources */ = {isa = PBXBuildFile; fileRef = 2A94A4D51542517F00766EAF /* graybutton.png */; };
2A94A4E01542622000766EAF /* AccidentalsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A94A4DF1542622000766EAF /* AccidentalsController.m */; };
+ 2AB9BF6A154795C9001E756E /* InstrumentsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AB9BF69154795C9001E756E /* InstrumentsController.m */; };
2AE1DE7415154B72008C538D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AE1DE7315154B72008C538D /* UIKit.framework */; };
2AE1DE7615154B72008C538D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AE1DE7515154B72008C538D /* Foundation.framework */; };
2AE1DE7815154B72008C538D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AE1DE7715154B72008C538D /* CoreGraphics.framework */; };
@@ -41,7 +42,6 @@
A717FEDF1534ED9D00515250 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A717FEDE1534ED9D00515250 /* CoreFoundation.framework */; };
A717FEE21534EE1300515250 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A717FEE11534EE1300515250 /* Security.framework */; };
A765348B15276051001885E9 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A765348A15276051001885E9 /* AudioToolbox.framework */; };
- A76A7A061539CEDA00A43222 /* TwoFingerOptionSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = A76A7A041539CEDA00A43222 /* TwoFingerOptionSelector.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -81,6 +81,8 @@
2A94A4D51542517F00766EAF /* graybutton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = graybutton.png; sourceTree = "<group>"; };
2A94A4DE1542622000766EAF /* AccidentalsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccidentalsController.h; sourceTree = "<group>"; };
2A94A4DF1542622000766EAF /* AccidentalsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccidentalsController.m; sourceTree = "<group>"; };
+ 2AB9BF68154795C9001E756E /* InstrumentsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstrumentsController.h; sourceTree = "<group>"; };
+ 2AB9BF69154795C9001E756E /* InstrumentsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstrumentsController.m; sourceTree = "<group>"; };
2AE1DE6F15154B72008C538D /* Staff.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Staff.app; sourceTree = BUILT_PRODUCTS_DIR; };
2AE1DE7315154B72008C538D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
2AE1DE7515154B72008C538D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -98,8 +100,6 @@
A717FEDE1534ED9D00515250 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
A717FEE11534EE1300515250 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
A765348A15276051001885E9 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
- A76A7A031539CEDA00A43222 /* TwoFingerOptionSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwoFingerOptionSelector.h; sourceTree = "<group>"; };
- A76A7A041539CEDA00A43222 /* TwoFingerOptionSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TwoFingerOptionSelector.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -174,6 +174,8 @@
0826BDD01523E5C2004A9B22 /* StaffController.m */,
2A94A4DE1542622000766EAF /* AccidentalsController.h */,
2A94A4DF1542622000766EAF /* AccidentalsController.m */,
+ 2AB9BF68154795C9001E756E /* InstrumentsController.h */,
+ 2AB9BF69154795C9001E756E /* InstrumentsController.m */,
2A94A4D51542517F00766EAF /* graybutton.png */,
2AE1DE8215154B72008C538D /* AppDelegate.h */,
2AE1DE8315154B72008C538D /* AppDelegate.m */,
@@ -182,8 +184,6 @@
0826BDB41523E5AF004A9B22 /* ChordViewController.h */,
0826BDB51523E5AF004A9B22 /* ChordViewController.m */,
08E618C61544E86A00A366B5 /* flat.gif */,
- A76A7A031539CEDA00A43222 /* TwoFingerOptionSelector.h */,
- A76A7A041539CEDA00A43222 /* TwoFingerOptionSelector.m */,
2A8E8FB815374EF80067DB3D /* Circleof5thsController.h */,
2A8E8FB915374EF80067DB3D /* Circleof5thsController.m */,
0826BDE11523EFED004A9B22 /* ChordOptionsViewController.h */,
@@ -305,10 +305,10 @@
0826BDD81523E5C2004A9B22 /* StaffController.m in Sources */,
0826BDE31523EFED004A9B22 /* ChordOptionsViewController.m in Sources */,
2A8E8FBA15374EF80067DB3D /* Circleof5thsController.m in Sources */,
- A76A7A061539CEDA00A43222 /* TwoFingerOptionSelector.m in Sources */,
2A94A4E01542622000766EAF /* AccidentalsController.m in Sources */,
2AF14AB61547132600C899B2 /* solidlineAccidental.m in Sources */,
2AF14AB9154715A200C899B2 /* dashedlineAccidental.m in Sources */,
+ 2AB9BF6A154795C9001E756E /* InstrumentsController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -12,9 +12,11 @@
{
NSArray *elements;
UIView *content;
+ int state;
IBOutlet UIPickerView *picker;
}
@property (nonatomic, retain) IBOutlet UIPickerView *picker;
+@property int state;
@end
@@ -12,6 +12,7 @@
@implementation AccidentalsController
@synthesize picker;
+@synthesize state;
- (id)init
{
@@ -22,15 +23,12 @@ - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
-
elements = [[NSArray alloc] initWithObjects:@"No Effect", @"Apply Sharp", @"Apply Flat", nil];
-
content = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 216)];
picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 216)];
[picker setDataSource:self];
[picker setDelegate:self];
[picker setShowsSelectionIndicator:YES];
-
[content addSubview:picker];
[self.view addSubview:content];
}
@@ -59,26 +57,27 @@ -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row fo
// Do something with the selected row.
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
AppDelegate *mainDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
- [mainDelegate.viewController.dataController twoFingerOptionWasSelected:[elements objectAtIndex: row]];
[mainDelegate.viewController.staffController.sharpFlatButton.titleLabel setFont:[UIFont systemFontOfSize:24]];
[mainDelegate.viewController.staffController.sharpFlatButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
switch (row) {
case 0:
[mainDelegate.viewController.staffController.sharpFlatButton setTitle:@"-" forState:UIControlStateNormal];
+ [self setState:0];
break;
case 1:
[mainDelegate.viewController.staffController.sharpFlatButton setTitle:@"#" forState:UIControlStateNormal];
+ [self setState:-1];
break;
case 2:
[mainDelegate.viewController.staffController.sharpFlatButton setTitle:@"b" forState:UIControlStateNormal];
+ [self setState:1];
break;
default:
break;
}
}
-
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
@@ -12,7 +12,6 @@
#import "ChordOptionsViewController.h"
#import "DataController.h"
#import "Circleof5thsController.h"
-#import "TwoFingerOptionSelector.h"
@implementation ChordViewController
View
@@ -30,7 +30,7 @@
-(void)keySignatureWasChosen:(NSString*)choice;
// called by StaffController
--(void)playNoteAt:(int)position WithHalfStepAlteration:(BOOL) twoFingerTouch;
+-(void)playNoteAt:(int)position WithHalfStepAlteration:(int) accidentalState;
-(void)stopNote;
-(void)instrumentWasChosen:(int)MIDInumber;
View
@@ -529,12 +529,12 @@ -(void)keySignatureWasChosen:(NSString*)choice
}
--(void)playNoteAt:(int)position WithHalfStepAlteration:(BOOL) twoFingerTouch{
+-(void)playNoteAt:(int)position WithHalfStepAlteration:(int) accidentalState{
int noteNumber = [[currentKeySignatureNotes objectAtIndex:position] intValue];
// add -1 or 1 to flat or sharp the note if the user wanted
- if(twoFingerTouch){
+ if(accidentalState){
noteNumber += halfStepAlteration;
}
currentNote = noteNumber;
@@ -0,0 +1,23 @@
+//
+// InstrumentsController.h
+// Staff
+//
+// Created by Christopher Harris on 4/24/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+@interface InstrumentsController : UIViewController
+{
+ NSArray *elements;
+ UIView *content;
+ int instrument;
+ IBOutlet UIPickerView *picker;
+}
+
+@property (nonatomic, retain) IBOutlet UIPickerView *picker;
+@property int instrument;
+
+@end
@@ -0,0 +1,89 @@
+//
+// InstrumentsController.m
+// Staff
+//
+// Created by Christopher Harris on 4/24/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "AppDelegate.h"
+#import "InstrumentsController.h"
+
+@implementation InstrumentsController
+
+@synthesize picker;
+@synthesize instrument;
+
+- (id)init
+{
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ // Do any additional setup after loading the view.
+ [self setupInstrumentsElements];
+ content = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 216)];
+ picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 216)];
+ [picker setDataSource:self];
+ [picker setDelegate:self];
+ [picker setShowsSelectionIndicator:YES];
+ [content addSubview:picker];
+ [self.view addSubview:content];
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+}
+
+- (void)setupInstrumentsElements
+{
+ elements = [[NSArray alloc] initWithObjects:
+ @"Acoustic Piano",@"Bright Acoustic Piano",@"Electric Grand Piano",@"Honky-Tonk Piano",@"Electric Piano 1",@"Electric Piano 2",@"Harpsichord",@"Clavinet",
+ @"Celesta",@"Glockenspiel",@"Music Box",@"Vibraphone",@"Marimba",@"Xylophone",@"Tubular Bells",@"Dulcimer",
+ @"Drawbar Organ",@"Percussive Organ",@"Rock Organ",@"Church Organ",@"Reed Organ",@"Accordian",@"Harmonica",@"Tango Accordian",
+ @"Acoustic Guitar (Nylon)",@"Acoustic Guitar (Steel)",@"Electric Guitar (Jazz)",@"Electric Guitar (Clean)",@"Electric Guitar (Muted)",@"Overdriven Guitar",@"Distortion Guitar",@"Guitar Harmonics",
+ @"Acoustic Bass",@"Electric Bass (Finger)",@"Electric Bass (Pick)",@"Freless Bass",@"Slap Bass 1",@"Slap Bass 2",@"Synth Bass 1",@"Synth Bass 2",
+ @"Violin",@"Viola",@"Cello",@"Contrabass",@"Tremelo Strings",@"Pizzicato Strings",@"Orchestral Harp",@"Timpani",
+ @"String Ensemble 1",@"String Ensemble 2",@"Synth Strings 1",@"Synth Strings 2",@"Choir Aahs",@"Voice Oohs",@"Synth Voice",
+ @"Orchestra Hit", @"Trumpet",@"Trombone",@"Tuba",@"Muted Trumpet",@"French Horn",@"Brass Section",@"Synth Brass 1",
+ @"Synth Brass 2",@"Soprano Sax",@"Alto Sax",@"Tenor Sax",@"Baritone Sax",@"Oboe",@"English Horn",@"Bassoon",@"Clarinet",
+ @"Piccolo",@"Flute",@"Recorder",@"Pan Flute",@"Blown Bottle",@"Shakuhachi",@"Whistle",@"Ocarina",nil];
+}
+
+// Number of components.
+-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
+ return 1;
+}
+
+// Total rows in our component.
+-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
+ return [elements count];
+}
+
+// Display each row's data.
+-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
+ return [elements objectAtIndex:row];
+}
+
+// Do something with the selected row.
+-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
+ AppDelegate *mainDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
+ [mainDelegate.viewController.staffController.sharpFlatButton.titleLabel setFont:[UIFont systemFontOfSize:24]];
+ [mainDelegate.viewController.staffController.sharpFlatButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+ instrument = (row+1);
+ [mainDelegate.viewController.staffController.instrumentsButton setTitle:[elements objectAtIndex:row] forState:UIControlStateNormal];
+
+ //DATA CONTROLLER CALL INSTRUMENT HERE!!!!!
+
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+@end
View
@@ -11,7 +11,8 @@
#import "DataController.h"
#import "ChordViewController.h"
#import "Circleof5thsController.h"
-#import "TwoFingerOptionSelector.h"
+#import "AccidentalsController.h"
+#import "InstrumentsController.h"
@interface MainController : UIViewController
@@ -23,7 +24,9 @@
@property (strong, nonatomic) Circleof5thsController *circleOf5thsController;
-@property (strong, nonatomic) TwoFingerOptionSelector *twoFingerOptionSelector;
+@property (strong, nonatomic) AccidentalsController *accidentalsController;
+
+@property (strong, nonatomic) InstrumentsController *instrumentsController;
@end
View
@@ -12,11 +12,14 @@
#import "StaffController.h"
#import "ChordViewController.h"
#import "Circleof5thsController.h"
+#import "AccidentalsController.h"
+#import "InstrumentsController.h"
@implementation MainController
@synthesize staffController = _staffController, dataController = _dataController, chordController = _chordController;
-@synthesize circleOf5thsController = _circleOf5thsController, twoFingerOptionSelector = _twoFingerOptionSelector;
+@synthesize circleOf5thsController = _circleOf5thsController;
+@synthesize accidentalsController = _accidentalsController, instrumentsController = _instrumentsController;
- (void)viewDidLoad
{
@@ -26,7 +29,8 @@ - (void)viewDidLoad
_staffController = [[StaffController alloc] init];
_chordController = [[ChordViewController alloc] init];
_circleOf5thsController = [[Circleof5thsController alloc] init];
- _twoFingerOptionSelector = [[TwoFingerOptionSelector alloc] init];
+ _instrumentsController = [[InstrumentsController alloc] init];
+ _accidentalsController = [[AccidentalsController alloc] init];
[_chordController loadView];
[_dataController loadData];
View
@@ -12,6 +12,7 @@
#import "solidlineAccidental.h"
#import "dashedlineAccidental.h"
#import "sharpIcon.h"
+#import "InstrumentsController.h"
#import "AccidentalsController.h"
@@ -29,23 +30,23 @@ typedef struct image_view_metadata {
UIView *canvas;
UIView *staffView;
UIView *topMenu;
+ UIButton *instrumentsButton;
UIButton *sharpFlatButton;
UIPopoverController *popoverController;
UIView *popoverView;
+ InstrumentsController *instrumentsController;
AccidentalsController *accidentalsController;
-
- @private
NSMutableDictionary *lines;
NSMutableDictionary *spaces;
NSMutableDictionary *sharps;
NSMutableDictionary *flats;
NSArray *notes;
-
}
@property (nonatomic, retain) IBOutlet UIView *canvas;
@property (nonatomic, retain) IBOutlet UIView *staffView;
@property (nonatomic, retain) IBOutlet UIView *topMenu;
+@property (nonatomic, retain) IBOutlet UIButton *instrumentsButton;
@property (nonatomic, retain) IBOutlet UIButton *sharpFlatButton;
@property (nonatomic, retain) UIPopoverController *popoverController;
@property (nonatomic, retain) UIView *popoverView;
Oops, something went wrong.

0 comments on commit 2c6d1d2

Please sign in to comment.