Penta tonic Gate

Major pentatonic scale: Bo3 musical instrument

Source code, the first version: XCode 3.1, iPhone OS 2.0 SDK (october 2008)

Simple and lightweight syntax highlighting of source code snippets using Google Code Prettify JavaScript library for Epfel.

google-code-prettify

//
//  main.m
//  Instrument_Bo3
//
//  Created by x gwizdala on 10/13/08.
//  Copyright x 2008. All rights reserved.
//

#import 

int main(int argc, char *argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, @"Instrument_Bo3AppDelegate");
    [pool release];
    return retVal;
}



******************************************************************************************



//
//  Instrument_Bo3AppDelegate.h
//  Instrument_Bo3
//
//  Created by x gwizdala on 10/13/08.
//  Copyright x 2008. All rights reserved.
//

#import 

@class MyView;

@interface Instrument_Bo3AppDelegate : NSObject {
	UIWindow *window ;
	MyView *contentView ;
}

@property (nonatomic, retain) UIWindow *window ;
@property (nonatomic, retain) MyView *contentView ;

@end





******************************************************************************************


//
//  Instrument_Bo3AppDelegate.m
//  Instrument_Bo3
//
//  Created by x gwizdala on 10/13/08.
//  Copyright x 2008. All rights reserved.
//

#import "Instrument_Bo3AppDelegate.h"
#import "MyView.h"

@implementation Instrument_Bo3AppDelegate

@synthesize window;
@synthesize contentView;


- (void)applicationDidFinishLaunching:(UIApplication *)application {	

	window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
	contentView = [[MyView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
	contentView.backgroundColor = [UIColor grayColor];
	
	[window addSubview:contentView];

	[window makeKeyAndVisible];
}


- (void)dealloc {
	[contentView release];
	[window release];
	[super dealloc];
}

@end






******************************************************************************************





//
//  MyView.h
//  Instrument_Bo3
//
//  Created by x gwizdala on 10/13/08.
//  Copyright x 2008. All rights reserved.
//

#import 
#import 

#import "PentacleView.h"

@class SoundEffect;

@class PentacleView;

@interface MyView : UIView { 

	PentacleView *_pentacleView;

	UIImageView  *imageView01;		// c3
	UIImageView  *imageView02;		// a2
	UIImageView  *imageView03;		// g2
	UIImageView  *imageView04;		// e2
	UIImageView  *imageView05;		// d2
	UIImageView  *imageView06;		// c2
	
	UIImageView  *imageView07;
	UIImageView  *imageView08;
	UIImageView  *imageView09;
	UIImageView  *imageView10;
	UIImageView  *imageView11;
	
	UIImageView  *turcusView01;
	UIImageView  *turcusView02;
	UIImageView  *turcusView03;
	
	UIImageView *tubeView01;
	UIImageView *headView;
	UIImageView *footView;
	
	SoundEffect *c0Sound ;  // 0
	SoundEffect *c1Sound ;  // 7
	SoundEffect *aSound ;   // 6

	SoundEffect *dSound ;   // 1
	SoundEffect *eSound ;   // 2

	SoundEffect *gSound ;   // 4

	SoundEffect *d3Sound ;
	SoundEffect *e3Sound ;
	SoundEffect *g3Sound ;
	SoundEffect *a3Sound ;
	SoundEffect *c4Sound ;

	NSString *valueInfo ;
	
	CGFloat r, g, b;
	
	CGRect navigatorRect;
	UIImageView *navigatorView;

}

@property (nonatomic, retain) PentacleView *_pentacleView;

@property (nonatomic, retain) UIImageView *imageView01;
@property (nonatomic, retain) UIImageView *imageView02;
@property (nonatomic, retain) UIImageView *imageView03;
@property (nonatomic, retain) UIImageView *imageView04;
@property (nonatomic, retain) UIImageView *imageView05;
@property (nonatomic, retain) UIImageView *imageView06;

@property (nonatomic, retain) UIImageView *imageView07;
@property (nonatomic, retain) UIImageView *imageView08;
@property (nonatomic, retain) UIImageView *imageView09;
@property (nonatomic, retain) UIImageView *imageView10;
@property (nonatomic, retain) UIImageView *imageView11;

@property (nonatomic, retain) UIImageView  *turcusView01;
@property (nonatomic, retain) UIImageView  *turcusView02;
@property (nonatomic, retain) UIImageView  *turcusView03;

@property (nonatomic, retain) UIImageView *tubeView01;
@property (nonatomic, retain) UIImageView *headView;
@property (nonatomic, retain) UIImageView *footView;

@property (nonatomic, retain) UIImageView *navigatorView;

@property (nonatomic, copy) NSString *valueInfo;

- (void) setupPentacleView;

- (void) setupNavigatorView;

- (void) setupImage01;
- (void) setupImage02;
- (void) setupImage03;
- (void) setupImage04;
- (void) setupImage05;
- (void) setupImage06;

- (void) setupImage07;
- (void) setupImage08;
- (void) setupImage09;
- (void) setupImage10;
- (void) setupImage11;

- (void) setupTurcus01;
- (void) setupTurcus02;
- (void) setupTurcus03;

- (void) setupTube01;
- (void) setupHead;
- (void) setupFoot;



@end


******************************************************************************************



//
//  MyView.m
//  Instrument_Bo3
//
//  Created by x gwizdala on 10/13/08.
//  Copyright x 2008. All rights reserved.

//	Gwizdalian Instrument

#import "MyView.h"
#import "SoundEffect.h"

#import 

#define kAnimationKey @"transitionViewAnimation"

@interface MyView (PrivateMethods)
- (void) setupSounds;
@end

@implementation MyView

@synthesize _pentacleView;
@synthesize navigatorView;

@synthesize imageView01, imageView02, imageView03, imageView04, imageView05, imageView06;
@synthesize imageView07, imageView08, imageView09, imageView10, imageView11;
@synthesize turcusView01, turcusView02, turcusView03;
@synthesize tubeView01, headView, footView;

@synthesize valueInfo;

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
		self.backgroundColor = [UIColor grayColor];
		
		valueInfo = @"sounds: c2 d2 e2 g2 a2 c3 d3 e3 g3 a3 c4";
		r = 1.0;
		g = 0.0;
		b = 0.0;
		
		[self setupImage01];
		[self setupImage02];
		[self setupImage03];
		[self setupImage04];
		[self setupImage05];
		[self setupImage06];
		
		[self setupTube01];
		[self setupHead];
		[self setupFoot];
		
		[self setupImage07];
		[self setupImage08];
		[self setupImage09];
		[self setupImage10];
		[self setupImage11];
		
		[self setupTurcus01];
		[self setupTurcus02];
		[self setupTurcus03];
		
		[self setupSounds];
		
		[c0Sound play];
		[gSound play];

		[c1Sound play];
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView09.transform = transform;
		CGAffineTransform transform3 = CGAffineTransformMakeScale(0.6, 0.8);
		turcusView03.transform = transform3;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 16);
		headView.transform = transformHead;	
		
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -24);
		footView.transform = transformFoot;
		
		imageView06.transform = transform;
//		imageView05.transform = transform;
//		imageView04.transform = transform;
		imageView03.transform = transform;
//		imageView02.transform = transform;
		imageView01.transform = transform;
		
		[UIView commitAnimations];
		
		navigatorRect = CGRectMake(284.0, 16.0, 16, 16);
		[self setupNavigatorView];
    }
    return self;
}


- (void) setupSounds {
	NSBundle *mainBundle = [NSBundle mainBundle];

	
	c0Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"c0" ofType:@"caf"]];
	c1Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"c1" ofType:@"caf"]];
	 
	dSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"d"  ofType:@"caf"]];
	eSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"e"  ofType:@"caf"]];
	gSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"g"  ofType:@"caf"]];
	aSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"a"  ofType:@"caf"]];

	d3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"d3"  ofType:@"caf"]];
	e3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"e3"  ofType:@"caf"]];
	g3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"g3"  ofType:@"caf"]];
	a3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"a3"  ofType:@"caf"]];
	c4Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"c4"  ofType:@"caf"]];
}

- (void) setupPentacleView {
	_pentacleView = [[PentacleView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
	[self addSubview:_pentacleView];
	[_pentacleView release];
}

- (void) setupNavigatorView {
	navigatorView = [[UIImageView alloc] initWithFrame:navigatorRect];
	navigatorView.backgroundColor = [UIColor clearColor];
	[self addSubview:navigatorView];
	[navigatorView release];
}

- (void) setupImage01 {
	CGRect key01Rect = CGRectMake(36, 70, 280, 62);
	imageView01 = [[UIImageView alloc] initWithFrame:key01Rect];
	imageView01.image = [UIImage imageNamed:@"key_a03a.png"];
	[self addSubview:imageView01];
	[imageView01 release];
}

- (void) setupImage02 {
	CGRect key02Rect = CGRectMake(36, 132, 280, 62);
	imageView02 = [[UIImageView alloc] initWithFrame: key02Rect];
	imageView02.image = [UIImage imageNamed:@"key_a03.png"];
	[self addSubview:imageView02];
	[imageView02 release];
}

- (void) setupImage03 {
	CGRect key03Rect = CGRectMake(36, 194, 280, 62);
	imageView03 = [[UIImageView alloc] initWithFrame:key03Rect];
	imageView03.image = [UIImage imageNamed:@"key_a03a.png"];
	[self addSubview:imageView03];
	[imageView03 release];
}

- (void) setupImage04 {
	CGRect key04Rect = CGRectMake(36, 256, 280, 62);
	imageView04 = [[UIImageView alloc] initWithFrame:key04Rect];
	imageView04.image = [UIImage imageNamed:@"key_a03.png"];
	[self addSubview:imageView04];
	[imageView04 release];
}

- (void) setupImage05 {
	CGRect key05Rect = CGRectMake(36, 318, 280, 62);
	imageView05 = [[UIImageView alloc] initWithFrame:key05Rect];
	imageView05.image = [UIImage imageNamed:@"key_a03.png"];
	[self addSubview:imageView05];
	[imageView05 release];
}

- (void) setupImage06 {
	CGRect key06Rect = CGRectMake(36, 380, 280, 62);
	imageView06 = [[UIImageView alloc] initWithFrame:key06Rect];
	imageView06.image = [UIImage imageNamed:@"key_a03.png"];
	[self addSubview:imageView06];
	[imageView06 release];
}

- (void) setupImage07 {
	CGRect key07Rect = CGRectMake(0, 101, 220, 62);
	imageView07 = [[UIImageView alloc] initWithFrame:key07Rect];
	imageView07.image = [UIImage imageNamed:@"key_a03b.png"];
	[self addSubview:imageView07];
	[imageView07 release];
}

- (void) setupImage08 {
	CGRect key08Rect = CGRectMake(0, 163, 220, 62);
	imageView08 = [[UIImageView alloc] initWithFrame:key08Rect];
	imageView08.image = [UIImage imageNamed:@"key_a03b.png"];
	[self addSubview:imageView08];
	[imageView08 release];
}

- (void) setupImage09 {
	CGRect key09Rect = CGRectMake(0, 225, 220, 62);
	imageView09 = [[UIImageView alloc] initWithFrame:key09Rect];
	imageView09.image = [UIImage imageNamed:@"key_a03b.png"];
	[self addSubview:imageView09];
	[imageView09 release];
}

- (void) setupImage10 {
	CGRect key10Rect = CGRectMake(30, 287, 160, 62);
	imageView10 = [[UIImageView alloc] initWithFrame:key10Rect];
	imageView10.image = [UIImage imageNamed:@"key_a03c.png"];
	[self addSubview:imageView10];
	[imageView10 release];
}

- (void) setupImage11 {
	CGRect key11Rect = CGRectMake(30, 349, 160, 62);
	imageView11 = [[UIImageView alloc] initWithFrame:key11Rect];
	imageView11.image = [UIImage imageNamed:@"key_a03c.png"];
	[self addSubview:imageView11];
	[imageView11 release];
}

- (void) setupTurcus01 {
	CGRect turcusRect01 = CGRectMake(10, 104, 57, 57);
	turcusView01 = [[UIImageView alloc] initWithFrame:turcusRect01];
	turcusView01.image = [UIImage imageNamed:@"stone57a.png"];
	[self addSubview:turcusView01];
	[turcusView01 release];
}

- (void) setupTurcus02 {
	CGRect turcusRect02 = CGRectMake(10, 166, 57, 57);
	turcusView02 = [[UIImageView alloc] initWithFrame:turcusRect02];
	turcusView02.image = [UIImage imageNamed:@"stone57a.png"];
	[self addSubview:turcusView02];
	[turcusView02 release];
}

- (void) setupTurcus03 {
	CGRect turcusRect03 = CGRectMake(10, 228, 57, 57);
	turcusView03 = [[UIImageView alloc] initWithFrame:turcusRect03];
	turcusView03.image = [UIImage imageNamed:@"stone57a.png"];
	[self addSubview:turcusView03];
	[turcusView03 release];
}

- (void) setupTube01 {
	CGRect tubeRect01 = CGRectMake(70, 84, 80, 340);
	tubeView01 = [[UIImageView alloc] initWithFrame:tubeRect01];
	tubeView01.image = [UIImage imageNamed:@"tube1.png"];
	[self addSubview:tubeView01];
	[tubeView01 release];
}

- (void) setupHead {
	CGRect headRect = CGRectMake(62, 62, 96, 86);
	headView = [[UIImageView alloc] initWithFrame:headRect];
	headView.image = [UIImage imageNamed:@"head04.png"];
	[self addSubview:headView];
	[headView release];
}

- (void) setupFoot {
	CGRect footRect = CGRectMake(52, 410, 116, 48);
	footView = [[UIImageView alloc] initWithFrame:footRect];
	footView.image = [UIImage imageNamed:@"head04a.png"];
	[self addSubview:footView];
	[footView release];
}


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
	UITouch *touch = [[event allTouches] anyObject];
	
#pragma mark navigatorView

	if (touch.tapCount == 1 && [touch view] == navigatorView) {
	
		CATransition *animation2 = [CATransition animation];
		[animation2 setDelegate:self];
		[animation2 setType:kCATransitionReveal];
		[animation2 setSubtype:kCATransitionFromBottom];
		[animation2 setDuration:1.0];
	
		[self setupPentacleView];
		
		[animation2 setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
		[[self layer] addAnimation:animation2 forKey:kAnimationKey];
	
	}
	
#pragma mark view01	
	if (touch.tapCount == 1 && [touch view] == imageView01) {
	
		[c1Sound play];
		valueInfo = @"sound: c3";	//	1f
		r = 0.0; g = 1.0; b = 1.0;
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView01.transform = transform;
		
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -30);
		footView.transform = transformFoot;	
		
		[UIView commitAnimations];
	}
#pragma mark view02
	if (touch.tapCount == 1 && [touch view] == imageView02) {
	
		[aSound play];
		valueInfo = @"sound: a2";
		r = 0.0; g = 0.4; b = 1.0;	//	5m
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView02.transform = transform;
		
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -28);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}
#pragma mark view03
	if (touch.tapCount == 1 && [touch view] == imageView03) {
	
		[gSound play];
		valueInfo = @"sound: g2";
		r = 0.8; g = 1.0; b = 0.0;	//	4m
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView03.transform = transform;
		
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -24);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}
#pragma mark view04
	if (touch.tapCount == 1 && [touch view] == imageView04) {
	
		[eSound play];
		valueInfo = @"sound: e2";
		r = 0.8; g = 0.0; b = 1.0;	//	3m
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView04.transform = transform;
		
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -22);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}
#pragma mark view05
	if (touch.tapCount == 1 && [touch view] == imageView05) {
	
		[dSound play];
		valueInfo = @"sound: d2";
		r = 0.0; g = 1.0; b = 0.4;	//	2m
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView05.transform = transform;
		
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -18);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}
#pragma mark view06
	if (touch.tapCount == 1 && [touch view] == imageView06) {
	
		[c0Sound play];
		valueInfo = @"sound: c2";
		r = 1.0; g = 0.0; b = 0.0;	//	1m
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView06.transform = transform;
		
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -16);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}
#pragma mark view07
	if (touch.tapCount == 1 && [touch view] == imageView07) {
	
		[d3Sound play];
		valueInfo = @"sound: d3";
		r = 1.0; g = 0.0; b = 0.6;	//	2f
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView07.transform = transform;
		CGAffineTransform transform1 = CGAffineTransformMakeScale(0.5, 0.75);
		turcusView01.transform = transform1;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 12);
		headView.transform = transformHead;	
		
		[UIView commitAnimations];
	}
#pragma mark view08	
	if (touch.tapCount == 1 && [touch view] == imageView08) {
	
		[e3Sound play];
		valueInfo = @"sound: e3";
		r = 0.2; g = 1.0; b = 0.0;	//	3f
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView08.transform = transform;
		CGAffineTransform transform2 = CGAffineTransformMakeScale(0.5, 0.75);
		turcusView02.transform = transform2;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 14);
		headView.transform = transformHead;	
		
		[UIView commitAnimations];
	}
#pragma mark view09
	if (touch.tapCount == 1 && [touch view] == imageView09) {
	
		[g3Sound play];
		valueInfo = @"sound: g3";
		r = 0.2; g = 0.0; b = 1.0;	//	4f
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView09.transform = transform;
		CGAffineTransform transform3 = CGAffineTransformMakeScale(0.6, 0.8);
		turcusView03.transform = transform3;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 16);
		headView.transform = transformHead;	
		
		[UIView commitAnimations];
	}
#pragma mark view10
	if (touch.tapCount == 1 && [touch view] == imageView10) {
	
		[a3Sound play];
		valueInfo = @"sound: a3";
		r = 1.0; g = 0.6; b = 0.0;	//	5f
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView10.transform = transform;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 18);
		headView.transform = transformHead;	
		
		[UIView commitAnimations];
	}
#pragma mark view11
	if (touch.tapCount == 1 && [touch view] == imageView11) {
	
		[c4Sound play];
		valueInfo = @"sound: c4";
		r = 1.0; g = 1.0; b = 1.0;	//	x
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView11.transform = transform;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 20);
		headView.transform = transformHead;	
	
		[UIView commitAnimations];
	}
#pragma mark turcus01
	if (touch.tapCount == 1 && [touch view] == turcusView01) {
	
		[c1Sound play];
		[d3Sound play];
		[aSound play];
		valueInfo = @"sounds: a2 - c3 - d3";
		r = 0.6; g = 0.6; b = 0.6;	//	xxx
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transformTurcus = CGAffineTransformMakeScale(0.5, 0.75);
		turcusView01.transform = transformTurcus;
		
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
//		imageView06.transform = transform;
//		imageView05.transform = transform;
//		imageView04.transform = transform;
//		imageView03.transform = transform;
		imageView02.transform = transform;
		imageView01.transform = transform;
		
		imageView07.transform = transform;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 20);
		headView.transform = transformHead;	
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -20);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}
#pragma mark turcus02
	if (touch.tapCount == 1 && [touch view] == turcusView02) {
	
		[e3Sound play];
		[gSound play];
		[eSound play];
		valueInfo = @"sounds: e2 - g2 - e3";
		r = 0.7; g = 0.7; b = 0.7;	//	xxx
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transformTurcus = CGAffineTransformMakeScale(0.5, 0.75);
		turcusView02.transform = transformTurcus;
		
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
//		imageView06.transform = transform;
//		imageView05.transform = transform;
		imageView04.transform = transform;
		imageView03.transform = transform;
//		imageView02.transform = transform;
//		imageView01.transform = transform;
		
		imageView08.transform = transform;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 10);
		headView.transform = transformHead;	
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -20);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}
#pragma mark turcus03
	if (touch.tapCount == 1 && [touch view] == turcusView03) {
	
		[c1Sound play];
		[gSound play];
		[c0Sound play];
		valueInfo = @"sounds: c2 - g2 - c3";
		r = 0.8; g = 0.8; b = 0.8;	//	xxx
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];

		CGAffineTransform transformTurcus = CGAffineTransformMakeScale(0.75, 0.75);
		turcusView03.transform = transformTurcus;
	
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView06.transform = transform;
//		imageView05.transform = transform;
//		imageView04.transform = transform;
		imageView03.transform = transform;
//		imageView02.transform = transform;
		imageView01.transform = transform;
		
		CGAffineTransform transformHead = CGAffineTransformMakeTranslation(0.0, 16);
		headView.transform = transformHead;	
		CGAffineTransform transformFoot = CGAffineTransformMakeTranslation(0, -24);
		footView.transform = transformFoot;
		
		[UIView commitAnimations];
	}

#pragma mark tapCount == 2
	
	if (touch.tapCount == 2 && touch.view == self) {
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.75, 1.0);
		imageView06.transform = transform;
//		imageView05.transform = transform;
		imageView04.transform = transform;
		imageView03.transform = transform;
//		imageView02.transform = transform;
		imageView01.transform = transform;
		[UIView commitAnimations];
		
		valueInfo = @"sounds: c3 - e2 - g2 - c2";
		
		[c1Sound play];
		[c0Sound play];
		[eSound play];
		[gSound play];
	}
	[self setNeedsDisplay];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.25];
		CGAffineTransform transform = CGAffineTransformMakeScale(1.0, 1.0);
		imageView06.transform = transform;
		imageView05.transform = transform;
		imageView04.transform = transform;
		imageView03.transform = transform;
		imageView02.transform = transform;
		imageView01.transform = transform;
		
		imageView07.transform = transform;
		turcusView01.transform = transform;
		imageView08.transform = transform;
		turcusView02.transform = transform;
		imageView09.transform = transform;
		turcusView03.transform = transform;
		
		imageView10.transform = transform;
		imageView11.transform = transform;
		
		turcusView01.transform = transform;
		
		headView.transform = transform;
		footView.transform = transform;
		
		[UIView commitAnimations];
}

- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();
	
#pragma mark Gradient
/*	
	CGFloat rectSizeX = rect.size.width;
	CGFloat rectSizeY = rect.size.height;

	CGGradientRef black_white_gradient;
	CGColorSpaceRef myColorSpace; 
	
	size_t num_locations = 2;
	CGFloat locations[] = {0.0, 1.0};
	CGFloat components[8] = {0.0, 0.0, 0.0, 0.5,  1.0, 1.0, 1.0, 0.5};
	myColorSpace = CGColorSpaceCreateDeviceRGB();
	black_white_gradient = CGGradientCreateWithColorComponents(myColorSpace, components, locations, num_locations);
	
	CGPoint startPoint = CGPointMake(0, rectSizeY);
	CGPoint endPoint   = CGPointMake(rectSizeX, rectSizeY);
	
	CGGradientDrawingOptions options = kCGGradientDrawsBeforeStartLocation;
	CGContextDrawLinearGradient(context, black_white_gradient, startPoint, endPoint, options);
	
	CGGradientRelease(black_white_gradient);
	CGColorSpaceRelease(myColorSpace);
*/	
#pragma mark Header
 	
//	CGContextSetGrayFillColor(context, 0.3, 1.0);
	CGContextSetGrayFillColor(context, 0.5, 1.0);			// header info
	CGRect headerRect = CGRectMake(0, 12, 320, 36);
	CGContextFillRect(context, headerRect);
	
	CGContextSetGrayFillColor(context, 0.25, 1.0);
	NSString *headerString = @"Pentatonic Gate";
	UIFont *headerFont = [UIFont boldSystemFontOfSize:28];
	[headerString drawInRect:headerRect withFont:headerFont lineBreakMode:UILineBreakModeTailTruncation alignment:1];
	
	CGContextSetGrayFillColor(context, 0.5, 0.5);			// value info
	CGRect valueRect = CGRectMake(0, 46, 320, 16);
	CGContextFillRect(context, valueRect);
	
	CGContextSetGrayFillColor(context, 0.25, 1.0);
	NSString *valueString = [NSString stringWithFormat:@"%@", valueInfo];
	UIFont *valueFont = [UIFont boldSystemFontOfSize:12];
	[valueString drawInRect:valueRect withFont:valueFont lineBreakMode:UILineBreakModeTailTruncation alignment:1];
	
#pragma mark Navigator

	CGContextSetRGBFillColor(context, r, g, b, 1.0);
	CGContextSetGrayStrokeColor(context, 0.2, 1.0);
	CGContextSetLineWidth(context, 1.0);
	
	
	CGContextAddEllipseInRect(context, navigatorRect);
	CGContextFillEllipseInRect(context, navigatorRect);
	
	CGContextStrokeEllipseInRect(context, navigatorRect);
	
}



- (void)dealloc {
	
	[c4Sound release];
	[a3Sound release];
	[g3Sound release];
	[e3Sound release];
	[d3Sound release];
	
	[aSound release];
	[gSound release];
	[eSound release];
	[dSound release];
	
	[c1Sound release];
	[c0Sound release];
	
	[super dealloc];
}

@end




******************************************************************************************



//
//  PentacleView.h
//  Instrument_Bo3
//
//  Created by x gwizdala on 12/15/08.
//  Copyright 2008 x. All rights reserved.
//

#import 
#import "MyView.h"

#import "PentacleSound.h"

@class MyView;

@class PentacleSound;

@interface PentacleView : UIView {

	MyView *_myView;
	
	PentacleSound *_pentacleSound;

	CGPoint middlePoint, center ;
	CGFloat sizeArm ;
	CGFloat x, y ;
	int i ; 
	CGFloat radiusM ;
	
	CGFloat middlePointX, middlePointY;
	CGFloat middlepointSize;
	
	CGFloat radius, radius_RGB, radiusAnime;
	CGFloat rc_Hex, radius_phi, varX_RGB_phi;
	CGFloat outerRadius;
	CGFloat varX_RGB;
	CGFloat xS, yS, xM, yM, xH, yH;
	
	CGFloat r0, r1, r2, r3, r4, r5, r6;	
	CGFloat r7, r8, r9, r10, r11, r12;
	
	CGPoint pointR, pointG, pointB;
	CGPoint pointRm, pointGm, pointBm;
	
	CGPoint pointC, pointM, pointY;
	CGPoint pointCm, pointMm, pointYm;
	
	CGPoint pointOrange, pointChartreuse, pointAquamarine;
	CGPoint pointAzure, pointViolet, pointRose;
	
	CGPoint pointWhite;
	
	NSString *header1String ;
	NSString *header2String ;
	NSString *footerString ;
	
	CGFloat r, g, b;
	
	CGRect navigatorRect;
	UIImageView *navigatorView;
	
	CGRect navigatorRectLeft;
	UIImageView *navigatorViewLeft;

	
}

@property (nonatomic, retain) MyView *_myView;
@property (nonatomic, retain) PentacleSound *_pentacleSound;

@property (nonatomic, retain) UIImageView *navigatorView;
@property (nonatomic, retain) UIImageView *navigatorViewLeft;

@property (nonatomic, copy) NSString *header1String;
@property (nonatomic, copy) NSString *header2String;
@property (nonatomic, copy) NSString *footerString;

- (void) setupMyView;
- (void) setupNavigatorView;

- (void) setupPentacleSound;
- (void) setupNavigatorViewLeft;

@end




******************************************************************************************



//
//  PentacleView.m
//  Instrument_Bo3
//
//  Created by x gwizdala on 12/15/08.
//  Copyright 2008 x. All rights reserved.
//

#import "PentacleView.h"

#import 

#define kAnimationKey @"transitionViewAnimation"


@implementation PentacleView

@synthesize _myView;
@synthesize _pentacleSound;

@synthesize header1String, header2String, footerString;
@synthesize navigatorView;
@synthesize navigatorViewLeft;

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
		self.backgroundColor = [UIColor grayColor];
		
#pragma mark Navigator

		r = 1.0;
		g = 0.5;
		b = 0.0;
		
		navigatorRect = CGRectMake(284.0, 16.0, 16, 16);
		[self setupNavigatorView];
		
		navigatorRectLeft = CGRectMake(20.0, 16.0, 16, 16);
		[self setupNavigatorViewLeft];
		
#pragma mark init Basics

		middlePoint = CGPointMake(frame.size.width/2, frame.size.height/2);
		center = middlePoint;
		
		sizeArm = 128.0f;
		radiusM = 12.0f;
		
		middlePointX = frame.size.width/2;
		middlePointY = frame.size.height/2;
		middlepointSize = 8.0f;
		
		radius = 128.0f ;
		radius_RGB = 8.0f ;
		outerRadius = radius + 16.0f ;
		
		rc_Hex = ((radius * 2.0f) * tanf(M_PI/6));   // Hexagon factor
		radius_phi = (radius / 2.0f) * 1.618f;		  // Phi circle 

		varX_RGB = ( (radius + radius/2.0f) * tan(M_PI/6.0f) ); //triangle RGB CMY factor
		
		
#pragma mark Primary & Secondary Points

		pointR = CGPointMake(middlePointX, middlePointY - radius );
		pointG = CGPointMake(middlePointX - varX_RGB, middlePointY + radius/2.0f );
		pointB = CGPointMake(middlePointX + varX_RGB, middlePointY + radius/2.0f );
		
		pointC = CGPointMake(middlePointX, middlePointY + radius );
		pointM = CGPointMake(middlePointX + varX_RGB, middlePointY - radius/2.0f );
		pointY = CGPointMake(middlePointX -varX_RGB, middlePointY - radius/2.0f );
		
		varX_RGB_phi = ( (radius_phi + radius_phi/2.0f ) * tan(M_PI/6.0f) ); //circle RGB - CMY  factor
		
		pointRm = CGPointMake(middlePoint.x, middlePoint.y - radius_phi );                  // red point
		pointGm = CGPointMake(middlePoint.x - varX_RGB_phi, middlePoint.y + radius_phi/2.0f );
		pointBm = CGPointMake(middlePoint.x + varX_RGB_phi, middlePoint.y + radius_phi/2.0f );
		
		pointCm = CGPointMake(middlePoint.x, middlePoint.y + radius_phi );					// cyan point
		pointMm = CGPointMake(middlePoint.x + varX_RGB_phi, middlePoint.y - radius_phi/2.0f );
		pointYm = CGPointMake(middlePoint.x - varX_RGB_phi, middlePoint.y - radius_phi/2.0f );

#pragma mark Messages
		
		header1String = @"Pentatonic Gate";
		header2String = @"Mnemonic Table";
		footerString = @"Sexagesimal System";
		
    }
    return self;
}


- (void) setupMyView {
	_myView = [[MyView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
	[self addSubview:_myView];
	[_myView release];
}


- (void) setupNavigatorView {
	navigatorView = [[UIImageView alloc] initWithFrame:navigatorRect];
	navigatorView.backgroundColor = [UIColor clearColor];
	[self addSubview:navigatorView];
	[navigatorView release];
}


- (void) setupPentacleSound {
	_pentacleSound = [[PentacleSound alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
	[self addSubview:_pentacleSound];
	[_pentacleSound release];
}

- (void) setupNavigatorViewLeft {
	navigatorViewLeft = [[UIImageView alloc] initWithFrame:navigatorRectLeft];
	navigatorViewLeft.backgroundColor = [UIColor clearColor];
	[self addSubview:navigatorViewLeft];
	[navigatorViewLeft release];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
	UITouch *touch = [[event allTouches] anyObject];
	
#pragma mark navigatorView

	if (touch.tapCount == 1 && [touch view] == navigatorView) {
	
		CATransition *animation1 = [CATransition animation];
		[animation1 setDelegate:self];
//		[animation1 setType:kCATransitionReveal];
//		[animation1 setSubtype:kCATransitionFromTop];
		[animation1 setType:kCATransitionFade];
		[animation1 setDuration:1.0];
	
		[self setupPentacleSound];
		
		[animation1 setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
		[[self layer] addAnimation:animation1 forKey:kAnimationKey];
	
	}
	
	if (touch.tapCount == 1 && [touch view] == navigatorViewLeft) {
		
		CATransition *animation2 = [CATransition animation];
		[animation2 setDelegate:self];
		[animation2 setType:kCATransitionFade];
		[animation2 setDuration:1.0];
	
		[self setupMyView];
		
		[animation2 setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
		[[self layer] addAnimation:animation2 forKey:kAnimationKey];
		
	}
}

- (void)drawRect:(CGRect)rect {

    CGContextRef context = UIGraphicsGetCurrentContext();
	
#pragma mark Color

//	float orangeArray[4] = { 1.0f, 0.5f, 0.0f, 1.0f };

/***	color sexagesimal 60 ***/

	float c_sx_00[4] = {1.0f, 0.0f, 0.0f, 1.0f};		// 00	[1 0 0] red	*
//	float c_sx_01[4] = {1.0f, 0.0f, 0.1f, 1.0f};		// 01
//	float c_sx_02[4] = {1.0f, 0.0f, 0.2f, 1.0f};		// 02
//	float c_sx_03[4] = {1.0f, 0.0f, 0.3f, 1.0f};		// 03
//	float c_sx_04[4] = {1.0f, 0.0f, 0.4f, 1.0f};		// 04
//	float c_sx_05[4] = {1.0f, 0.0f, 0.5f, 1.0f};		// 05
	float c_sx_06[4] = {1.0f, 0.0f, 0.6f, 1.0f};		// 06	*
//	float c_sx_07[4] = {1.0f, 0.0f, 0.7f, 1.0f};		// 07
//	float c_sx_08[4] = {1.0f, 0.0f, 0.8f, 1.0f};		// 08
//	float c_sx_09[4] = {1.0f, 0.0f, 0.9f, 1.0f};		// 09
	
	
	float c_sx_10[4] = {1.0f, 0.0f, 1.0f, 1.0f};		// 10	[1 0 1]	magenta
//	float c_sx_11[4] = {0.9f, 0.0f, 1.0f, 1.0f};		// 11
	float c_sx_12[4] = {0.8f, 0.0f, 1.0f, 1.0f};		// 12	*
//	float c_sx_13[4] = {0.7f, 0.0f, 1.0f, 1.0f};		// 13
//	float c_sx_14[4] = {0.6f, 0.0f, 1.0f, 1.0f};		// 14
//	float c_sx_15[4] = {0.5f, 0.0f, 1.0f, 1.0f};		// 15
//	float c_sx_16[4] = {0.4f, 0.0f, 1.0f, 1.0f};		// 16
//	float c_sx_17[4] = {0.3f, 0.0f, 1.0f, 1.0f};		// 17
	float c_sx_18[4] = {0.2f, 0.0f, 1.0f, 1.0f};		// 18	*
//	float c_sx_19[4] = {0.1f, 0.0f, 1.0f, 1.0f};		// 19
	
	float c_sx_20[4] = {0.0f, 0.0f, 1.0f, 1.0f};		// 20	[0 0 1]	blue
//	float c_sx_21[4] = {0.0f, 0.1f, 1.0f, 1.0f};		// 21
//	float c_sx_22[4] = {0.0f, 0.2f, 1.0f, 1.0f};		// 22
//	float c_sx_23[4] = {0.0f, 0.3f, 1.0f, 1.0f};		// 23
	float c_sx_24[4] = {0.0f, 0.4f, 1.0f, 1.0f};		// 24	*
//	float c_sx_25[4] = {0.0f, 0.5f, 1.0f, 1.0f};		// 25
//	float c_sx_26[4] = {0.0f, 0.6f, 1.0f, 1.0f};		// 26
//	float c_sx_27[4] = {0.0f, 0.7f, 1.0f, 1.0f};		// 27
//	float c_sx_28[4] = {0.0f, 0.8f, 1.0f, 1.0f};		// 28
//	float c_sx_29[4] = {0.0f, 0.9f, 1.0f, 1.0f};		// 29
	
	float c_sx_30[4] = {0.0f, 1.0f, 1.0f, 1.0f};		// 30	[0 1 1] cyan	*
//	float c_sx_31[4] = {0.0f, 1.0f, 0.9f, 1.0f};		// 31
//	float c_sx_32[4] = {0.0f, 1.0f, 0.8f, 1.0f};		// 32
//	float c_sx_33[4] = {0.0f, 1.0f, 0.7f, 1.0f};		// 33
//	float c_sx_34[4] = {0.0f, 1.0f, 0.6f, 1.0f};		// 34
//	float c_sx_35[4] = {0.0f, 1.0f, 0.5f, 1.0f};		// 35
	float c_sx_36[4] = {0.0f, 1.0f, 0.4f, 1.0f};		// 36	*
//	float c_sx_37[4] = {0.0f, 1.0f, 0.3f, 1.0f};		// 37
//	float c_sx_38[4] = {0.0f, 1.0f, 0.2f, 1.0f};		// 38
//	float c_sx_39[4] = {0.0f, 1.0f, 0.1f, 1.0f};		// 39
	
	float c_sx_40[4] = {0.0f, 1.0f, 0.0f, 1.0f};		// 40	[0 1 0]	green
//	float c_sx_41[4] = {0.1f, 1.0f, 0.0f, 1.0f};		// 41
	float c_sx_42[4] = {0.2f, 1.0f, 0.0f, 1.0f};		// 42	*
//	float c_sx_43[4] = {0.3f, 1.0f, 0.0f, 1.0f};		// 43
//	float c_sx_44[4] = {0.4f, 1.0f, 0.0f, 1.0f};		// 44
//	float c_sx_45[4] = {0.5f, 1.0f, 0.0f, 1.0f};		// 45
//	float c_sx_46[4] = {0.6f, 1.0f, 0.0f, 1.0f};		// 46
//	float c_sx_47[4] = {0.7f, 1.0f, 0.0f, 1.0f};		// 47
	float c_sx_48[4] = {0.8f, 1.0f, 0.0f, 1.0f};		// 48	*
//	float c_sx_49[4] = {0.9f, 1.0f, 0.0f, 1.0f};		// 49
	
	float c_sx_50[4] = {1.0f, 1.0f, 0.0f, 1.0f};		// 50	[1 1 0]	yellow
//	float c_sx_51[4] = {1.0f, 0.9f, 0.0f, 1.0f};		// 51
//	float c_sx_52[4] = {1.0f, 0.8f, 0.0f, 1.0f};		// 52
//	float c_sx_53[4] = {1.0f, 0.7f, 0.0f, 1.0f};		// 53
	float c_sx_54[4] = {1.0f, 0.6f, 0.0f, 1.0f};		// 54	*
//	float c_sx_55[4] = {1.0f, 0.5f, 0.0f, 1.0f};		// 55
//	float c_sx_56[4] = {1.0f, 0.4f, 0.0f, 1.0f};		// 56
//	float c_sx_57[4] = {1.0f, 0.3f, 0.0f, 1.0f};		// 57
//	float c_sx_58[4] = {1.0f, 0.2f, 0.0f, 1.0f};		// 58
//	float c_sx_59[4] = {1.0f, 0.1f, 0.0f, 1.0f};		// 59
	
	
#pragma mark The Cage

	CGContextSetGrayStrokeColor(context, 0.6f, 0.2f); 
	CGContextSetLineWidth(context, 8.0f);

	CGContextMoveToPoint(context, middlePoint.x + radius, middlePoint.y);
	CGContextAddLineToPoint(context, middlePoint.x + radius, middlePoint.y + radius);
	CGContextAddLineToPoint(context, middlePoint.x - radius, middlePoint.y + radius);
	CGContextAddLineToPoint(context, middlePoint.x - radius, middlePoint.y - radius);
	CGContextAddLineToPoint(context, middlePoint.x + radius, middlePoint.y - radius);
	CGContextAddLineToPoint(context, middlePoint.x + radius, middlePoint.y);
	CGContextStrokePath(context);

#pragma mark Hexagon

	//  rc_Hex = ((radius * 2) * tanf(M_PI/6));

	CGContextSetGrayStrokeColor(context, 0.4f, 0.5f); 
	CGContextSetLineWidth(context, 12.0f);
	CGContextSetLineJoin(context, kCGLineJoinMiter);
	CGContextMoveToPoint(context, middlePoint.x, middlePoint.y - radius/2.0f);   // R
	CGContextAddLineToPoint(context, middlePoint.x + rc_Hex/4.0f, middlePoint.y - radius/2.0f); // R - M
	CGContextAddLineToPoint(context, middlePoint.x + rc_Hex/2.0f, middlePoint.y);            // M - B
	CGContextAddLineToPoint(context, middlePoint.x + rc_Hex/4.0f, middlePoint.y + radius/2.0f); // B - C 
	CGContextAddLineToPoint(context, middlePoint.x - rc_Hex/4.0f, middlePoint.y + radius/2.0f); // C - G
	CGContextAddLineToPoint(context, middlePoint.x - rc_Hex/2.0f, middlePoint.y);            // G - Y
	CGContextAddLineToPoint(context, middlePoint.x - rc_Hex/4.0f, middlePoint.y - radius/2.0f); // Y - R
	CGContextAddLineToPoint(context, middlePoint.x, middlePoint.y - radius/2.0f); // R
	CGContextStrokePath(context);
	
#pragma mark horizontal lines

	CGContextSetGrayStrokeColor(context, 0.6f, 0.5f);
	CGContextSetLineWidth(context, 1.0f);
	
	CGContextMoveToPoint(context, middlePoint.x - middlePoint.x, middlePoint.y);
	CGContextAddLineToPoint(context, middlePoint.x + middlePoint.x, middlePoint.y);
	CGContextStrokePath(context);
	
	CGContextMoveToPoint(context, middlePoint.x, middlePoint.y - middlePoint.x);
	CGContextAddLineToPoint(context, middlePoint.x, middlePoint.y + middlePoint.x);
	CGContextStrokePath(context);
	
	CGContextSetGrayStrokeColor(context, 0.4f, 0.5f);
	CGContextSetLineWidth(context, 4.0f);
	
	CGContextMoveToPoint(context, middlePoint.x - middlePoint.x, middlePoint.y + middlePoint.x);
	CGContextAddLineToPoint(context, middlePoint.x + middlePoint.x, middlePoint.y + middlePoint.x);
	CGContextStrokePath(context);
	
	CGContextMoveToPoint(context, middlePoint.x - middlePoint.x, middlePoint.y - middlePoint.x);
	CGContextAddLineToPoint(context, middlePoint.x + middlePoint.x, middlePoint.y - middlePoint.x);
	CGContextStrokePath(context);
	
#pragma mark middlePoint

	CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f);
	CGContextAddArc(context, middlePoint.x , middlePoint.y , radiusM , 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);	
	
	CGContextSetGrayStrokeColor(context, 0.0f, 1.0f);
	CGContextSetLineWidth(context, 1.0f);
	CGContextAddArc(context, middlePoint.x , middlePoint.y , radiusM , 0.0f, M_PI*2.0f, FALSE);
	CGContextStrokePath(context);
	
	
#pragma mark Pentacle

	CGContextSetGrayStrokeColor(context, 0.4, 1.0);  // main circle
	CGContextSetLineWidth(context, 1.0);
	CGContextAddArc(context, middlePoint.x, middlePoint.y, sizeArm, 0.0, M_PI*2, FALSE);
	CGContextStrokePath(context);	
	
	CGContextSetGrayStrokeColor(context, 0.6, 1.0);  // outer divider circle
	CGContextSetLineWidth(context, 1.0);
	CGContextAddArc(context, middlePoint.x, middlePoint.y, sizeArm + 24, 0.0, M_PI*2, FALSE);
	CGContextStrokePath(context);	
	
#pragma mark ** pentacle M path

/*************************************/ 
	
	CGContextSetLineWidth(context, 1.0f);
	
	CGContextSetGrayStrokeColor(context, 1.0f, 0.4f);
	
	CGContextMoveToPoint(context, center.x , center.y - sizeArm);
	
		for (i = 0; i < 5; i++) {
		x = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
		y = sizeArm * cosf(i * (( 4.0f * M_PI)  / 5.0f) );
		
		CGContextAddLineToPoint(context, center.x  - x , center.y  - y);

	}
	CGContextClosePath(context);
	CGContextStrokePath(context);
	
/*****************************************/

#pragma mark ** pentacle F path

/*************************************/ 
	
	CGContextSetGrayStrokeColor(context, 0.0f, 0.4f);
	
	CGContextMoveToPoint(context, center.x , center.y + sizeArm);
	
		for (i = 0; i < 5; i++) {
		x = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
		y = sizeArm * cosf(i * (( 4.0f * M_PI)  / 5.0f) );
		
		CGContextAddLineToPoint(context, center.x  + x , center.y  + y);

	}
	CGContextClosePath(context);
	CGContextStrokePath(context);
	
/*****************************************/

#pragma mark Divider

	/*** math ***/
		
		float j;
		float divider = 60.0f;  // circle divider
		float notch = 4.0f;	// notch length 
		float outerRadiusP = sizeArm + 12.0f;
		
		for(j = 0; j <= divider; j++) {
			CGContextSetGrayStrokeColor(context, 0.6f, 1.0f);
			CGContextSetLineWidth(context, 1.0f);
			CGContextMoveToPoint(context, middlePoint.x + ( (outerRadiusP + notch)*sin(M_PI*2.0f * (j/divider) )), 
													middlePoint.y + ( (outerRadiusP + notch)*cos(M_PI*2.0f * (j/divider) )));
			CGContextAddLineToPoint(context, middlePoint.x + ( (outerRadiusP - notch)*sin(M_PI*2.0f * (j/divider) )), 
													middlePoint.y + ( (outerRadiusP - notch)*cos(M_PI*2.0f * (j/divider) )));
			CGContextStrokePath(context);
			
			CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 0.6f);
			CGContextAddArc(context, middlePoint.x + (outerRadiusP *sin(M_PI*2.0f * (j/divider) )), 
										middlePoint.y + (outerRadiusP *cos(M_PI*2.0f * (j/divider)) ), 1.0f, 0.0f, M_PI*2.0f, FALSE);
			CGContextFillPath(context);
		}
		
/*******************************************/


#pragma mark Triangle RGB

	CGContextSetGrayStrokeColor(context, 0.2f, 0.3f);
	CGContextSetLineWidth(context, 1.0f);
	
	CGContextMoveToPoint(context, pointB.x, pointB.y);  // blue - green
	CGContextAddLineToPoint(context, pointG.x, pointG.y);
	
	CGContextMoveToPoint(context, pointG.x, pointG.y);  // green - red 
	CGContextAddLineToPoint(context, pointR.x, pointR.y);
	
	CGContextMoveToPoint(context, pointR.x, pointR.y);  //red - blue
	CGContextAddLineToPoint(context, pointB.x, pointB.y);
	
	CGContextStrokePath(context);
	

#pragma mark Triangle CMY

	CGContextSetGrayStrokeColor(context, 0.2f, 0.3f);
	CGContextSetLineWidth(context, 1.0f);
	
	CGContextMoveToPoint(context, pointC.x, pointC.y);  // cyan - magenta
	CGContextAddLineToPoint(context, pointM.x, pointM.y);
	
	CGContextMoveToPoint(context, pointM.x, pointM.y);  // magenta - yellow 
	CGContextAddLineToPoint(context, pointY.x, pointY.y); 
	
	CGContextMoveToPoint(context, pointY.x, pointY.y);  // yellow - cyan 
	CGContextAddLineToPoint(context, pointC.x, pointC.y);
	
	CGContextStrokePath(context);	

/***********************************************/

#pragma mark Color Sound Circles
	
	CGFloat rayFactor = sizeArm - 64.0f;
	CGFloat sx_radius = 6.0f;
	CGFloat ps_radius = 8.0f;	// primary & secondary point

	CGContextSetFillColor(context, c_sx_30);	// 1 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (0/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (0/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_24);	// 5 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (6/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (6/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_18);	// 4 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (12/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (12/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_12);	// 3 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (18/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (18/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_06);	// 2 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (24/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (24/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_00);	// 1 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (30/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (30/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_54);	// 5 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (36/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (36/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_48);	// 4 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (42/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (42/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_42);	// 3 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (48/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (48/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_36);	// 2 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (54/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (54/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	// R-G-B
	
	CGContextSetFillColor(context, c_sx_00);	// red
	CGContextAddArc(context, pointR.x, pointR.y, ps_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_40);	// green
	CGContextAddArc(context, pointG.x, pointG.y, ps_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_20);	// blue
	CGContextAddArc(context, pointB.x, pointB.y, ps_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	// C-M-Y
	
	CGContextSetFillColor(context, c_sx_30);	// cyan
	CGContextAddArc(context, pointC.x, pointC.y, ps_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_10);	// magenta
	CGContextAddArc(context, pointM.x, pointM.y, ps_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_50);	// yellow
	CGContextAddArc(context, pointY.x, pointY.y, ps_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
/*******************************************/

#pragma mark ** pentacle M data

/*************************************/ 
		
	CGContextMoveToPoint(context, center.x , center.y - sizeArm);
	
		for (i = 0; i < 5; i++) {
		x = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
		y = sizeArm * cosf(i * (( 4.0f * M_PI)  / 5.0f) );
		
		CGContextSetGrayFillColor(context, 0.0f, 0.8f);
		
		NSString *info = [NSString stringWithFormat:@"%i m", i+1 ];
		UIFont *infoFont = [UIFont boldSystemFontOfSize: 16];
		[info drawAtPoint:CGPointMake(center.x - x, center.y - y) withFont:infoFont];
	}

/*****************************************/

#pragma mark ** pentacle F data

/*************************************/ 
	
	CGContextMoveToPoint(context, center.x , center.y + sizeArm);
	
		for (i = 0; i < 5; i++) {
		x = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
		y = sizeArm * cosf(i * (( 4.0f * M_PI)  / 5.0f) );
		
		CGContextSetGrayFillColor(context, 1.0f, 0.8f);
		
		NSString *info = [NSString stringWithFormat:@"%i f", i+1 ];
		UIFont *infoFont = [UIFont boldSystemFontOfSize: 16];
		[info drawAtPoint:CGPointMake(center.x + x, center.y + y) withFont:infoFont];
	}
	
/*****************************************/


#pragma mark Header

	CGContextSetGrayFillColor(context, 0.6f, 0.0f);			
	CGRect headerRect = CGRectMake(0.0f, 12.0f, 320.0f, 30.0f);
	CGContextFillRect(context, headerRect);
	
	CGContextSetGrayFillColor(context, 0.25f, 1.0f);
	NSString *stringH = [NSString stringWithFormat:@"%@", header1String];
	UIFont *headerFont = [UIFont boldSystemFontOfSize:28];
	[stringH drawInRect:headerRect withFont:headerFont lineBreakMode:UILineBreakModeTailTruncation alignment:1];
	
	CGContextSetGrayFillColor(context, 0.6f, 0.0f);			
	CGRect headerTime = CGRectMake(0.0f, 48.0f, 320.0f, 16.0f);
	CGContextFillRect(context, headerTime);
	
	CGContextSetGrayFillColor(context, 0.3f, 1.0f);
	NSString *timeInfo = [NSString stringWithFormat:@"%@", header2String ];
	UIFont *timerFont = [UIFont boldSystemFontOfSize:14];
	[timeInfo drawInRect:headerTime withFont:timerFont lineBreakMode:1 alignment:1];	
	
#pragma mark Footer

	CGContextSetGrayFillColor(context, 0.6f, 0.0f);
	CGRect footerRect = CGRectMake(0.0f, 410.0f, 320.0f, 48.0f);
	CGContextFillRect(context, footerRect);
	
	CGContextSetGrayFillColor(context, 0.2f, 1.0f);
	NSString *stringF = [NSString stringWithFormat:@"%@ \nDual-Pentatonic Gate", footerString];
	UIFont *footerFont = [UIFont boldSystemFontOfSize:14];
	[stringF drawInRect:footerRect withFont:footerFont lineBreakMode:5 alignment:1];
	
#pragma mark Navigator

	CGContextSetRGBFillColor(context, r, g, b, 1.0);	// right
	CGContextSetGrayStrokeColor(context, 0.2, 1.0);
	CGContextSetLineWidth(context, 1.0);
	
	CGContextAddEllipseInRect(context, navigatorRect);
	CGContextFillEllipseInRect(context, navigatorRect);
	
	CGContextStrokeEllipseInRect(context, navigatorRect);
	
	CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0);	// left
	CGContextSetGrayStrokeColor(context, 0.2, 1.0);
	CGContextSetLineWidth(context, 1.0);
	
	CGContextAddEllipseInRect(context, navigatorRectLeft);
	CGContextFillEllipseInRect(context, navigatorRectLeft);
	
	CGContextStrokeEllipseInRect(context, navigatorRectLeft);
	

}

- (void)dealloc
{
	[super dealloc];
}

@end



******************************************************************************************


//
//  SoundEffect.h
//  GUI_01
//
//  Created by x gwizdala on 9/20/08.
//  Copyright 2008 x. All rights reserved.
//

#import 
#import 

@interface SoundEffect : NSObject {
    SystemSoundID _soundID;
}

+ (id)soundEffectWithContentsOfFile:(NSString *)aPath;
- (id)initWithContentsOfFile:(NSString *)path;
- (void)play;

@end




******************************************************************************************



//
//  SoundEffect.m
//  GUI_01
//
//  Created by x gwizdala on 9/20/08.
//  Copyright 2008 x. All rights reserved.
//


#import "SoundEffect.h"

@implementation SoundEffect
+ (id)soundEffectWithContentsOfFile:(NSString *)aPath {
    if (aPath) {
        return [[[SoundEffect alloc] initWithContentsOfFile:aPath] autorelease];
    }
    return nil;
}

- (id)initWithContentsOfFile:(NSString *)path {
    self = [super init];
    
    if (self != nil) {
        NSURL *aFileURL = [NSURL fileURLWithPath:path];
        
        if (aFileURL != nil)  {
            SystemSoundID aSoundID;
            OSStatus error = AudioServicesCreateSystemSoundID((CFURLRef)aFileURL, &aSoundID);
            
            if (error == kAudioServicesNoError) { // success
                _soundID = aSoundID;
            } 
        } 
    }
    return self;
}

-(void)dealloc {
    AudioServicesDisposeSystemSoundID(_soundID);
    [super dealloc];
}

-(void)play {
    AudioServicesPlaySystemSound(_soundID);
}

@end




******************************************************************************************



//
//  PentacleSound.h
//  Instrument_Bo3
//
//  Created by x gwizdala on 12/27/08.
//  Copyright 2008 x. All rights reserved.
//

#import 
#import 


#import "MyView.h"
#import "PentacleView.h"

@class SoundEffect;

@class MyView;
@class PentacleView;

@interface PentacleSound : UIView {

	MyView *_myView;
	PentacleView *_pentacleView;

	CGPoint middlePoint, center ;
	CGFloat sizeArm ;
	CGFloat x, y ;
	int i ;
	CGFloat radius ;
	
	NSString *header1String;
	NSString *header2String;

	NSString *soundValue;
	
	UIImageView  *imageView01;		
	UIImageView  *imageView02;		
	UIImageView  *imageView03;		
	UIImageView  *imageView04;		
	UIImageView  *imageView05;

	UIImageView  *imageView06;		
	UIImageView  *imageView07;
	UIImageView  *imageView08;
	UIImageView  *imageView09;
	UIImageView  *imageView10;
	
	UIImageView  *imageView11;
	
	float imvSize;			// ImageView size
	float alphaColor;
	
	SoundEffect *c0Sound;  // 0
	SoundEffect *c1Sound;  // 7
	SoundEffect *aSound;   // 6

	SoundEffect *dSound;   // 1
	SoundEffect *eSound;   // 2

	SoundEffect *gSound;   // 4

	SoundEffect *d3Sound;
	SoundEffect *e3Sound;
	SoundEffect *g3Sound;
	SoundEffect *a3Sound;
	SoundEffect *c4Sound;
	
	CGFloat r, g, b ;
	CGFloat middleR, middleG, middleB;
	
	CGRect navigatorRect;
	UIImageView *navigatorView;
	
	CGRect navigatorRectLeft;
	UIImageView *navigatorViewLeft;


}

@property (nonatomic, retain) MyView *_myView;
@property (nonatomic, retain) PentacleView *_pentacleView;

@property (nonatomic, copy) NSString *header1String;
@property (nonatomic, copy) NSString *header2String;

@property (nonatomic, copy) NSString *soundValue;

@property (nonatomic, retain) UIImageView *imageView01;
@property (nonatomic, retain) UIImageView *imageView02;
@property (nonatomic, retain) UIImageView *imageView03;
@property (nonatomic, retain) UIImageView *imageView04;
@property (nonatomic, retain) UIImageView *imageView05;

@property (nonatomic, retain) UIImageView *imageView06;
@property (nonatomic, retain) UIImageView *imageView07;
@property (nonatomic, retain) UIImageView *imageView08;
@property (nonatomic, retain) UIImageView *imageView09;
@property (nonatomic, retain) UIImageView *imageView10;

@property (nonatomic, retain) UIImageView *imageView11;

@property (nonatomic, retain) UIImageView *navigatorView;
@property (nonatomic, retain) UIImageView *navigatorViewLeft;

- (void) setupImage01;
- (void) setupImage02;
- (void) setupImage03;
- (void) setupImage04;
- (void) setupImage05;

- (void) setupImage06;
- (void) setupImage07;
- (void) setupImage08;
- (void) setupImage09;
- (void) setupImage10;

- (void) setupImage11;

- (void) setupMyView;
- (void) setupNavigatorView;

- (void) setupPentacleView;
- (void) setupNavigatorViewLeft;


@end




******************************************************************************************



//
//  PentacleSound.m
//  Instrument_Bo3
//
//  Created by x gwizdala on 12/27/08.
//  Copyright 2008 x. All rights reserved.
//

#import "PentacleSound.h"
#import "SoundEffect.h"

#import 

#define kAnimationKey @"transitionViewAnimation"

@interface PentacleSound (PrivateMethods)
- (void) setupSounds;
@end

@implementation PentacleSound

@synthesize _myView;
@synthesize _pentacleView;
@synthesize navigatorView, navigatorViewLeft;

@synthesize header1String, header2String;
@synthesize soundValue;

@synthesize imageView01, imageView02, imageView03, imageView04, imageView05;
@synthesize imageView06, imageView07, imageView08, imageView09, imageView10;
@synthesize imageView11;

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
		self.backgroundColor = [UIColor grayColor];

#pragma mark init Basics

		r = 1.0f;
		g = 0.0f;
		b = 0.0f;
		
		middlePoint = CGPointMake(frame.size.width/2, frame.size.height/2);
		
		middleR = 1.0f;
		middleG = 1.0f;
		middleB = 1.0f;
		
		center = middlePoint;
		
		sizeArm = 128.0f;
		radius = 18.0f;
		
		header1String = @"Pentatonic Gate";
		header2String = @"Sophisticated Simplicity";

		soundValue = @"Scale C";
		
		imvSize = 36.0f;
		alphaColor = 0.1f;
		
#pragma mark init image Views
		
		[self setupImage01];
		[self setupImage02];
		[self setupImage03];
		[self setupImage04];
		[self setupImage05];
		
		[self setupImage06];
		[self setupImage07];
		[self setupImage08];
		[self setupImage09];
		[self setupImage10];
		
		[self setupImage11];
		
		
#pragma mark SoundEffect

		[self setupSounds];
		
		[c0Sound play];
		[eSound play];

		[gSound play];
		
#pragma mark Navigator
		
		navigatorRect = CGRectMake(284.0f, 16.0f, 16.0f, 16.0f);
		[self setupNavigatorView];
		
		navigatorRectLeft = CGRectMake(20.0f, 16.0f, 16.0f, 16.0f);
		[self setupNavigatorViewLeft];
		
    }
    return self;
}

- (void) setupMyView {
	_myView = [[MyView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
	[self addSubview:_myView];
	[_myView release];
}

- (void) setupNavigatorView {
	navigatorView = [[UIImageView alloc] initWithFrame:navigatorRect];
	navigatorView.backgroundColor = [UIColor clearColor];
	[self addSubview:navigatorView];
	[navigatorView release];
}

- (void) setupPentacleView {
	_pentacleView = [[PentacleView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
	[self addSubview:_pentacleView];
	[_pentacleView release];
}

- (void) setupNavigatorViewLeft {
	navigatorViewLeft = [[UIImageView alloc] initWithFrame:navigatorRectLeft];
	navigatorViewLeft.backgroundColor = [UIColor clearColor];
	[self addSubview:navigatorViewLeft];
	[navigatorViewLeft release];
}

#pragma mark Sounds

- (void) setupSounds {
	NSBundle *mainBundle = [NSBundle mainBundle];

	
	c0Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"c0" ofType:@"caf"]];
	c1Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"c1" ofType:@"caf"]];
	 
	dSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"d"  ofType:@"caf"]];
	eSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"e"  ofType:@"caf"]];
	gSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"g"  ofType:@"caf"]];
	aSound  = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"a"  ofType:@"caf"]];

	d3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"d3"  ofType:@"caf"]];
	e3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"e3"  ofType:@"caf"]];
	g3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"g3"  ofType:@"caf"]];
	a3Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"a3"  ofType:@"caf"]];
	c4Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"c4"  ofType:@"caf"]];
	

}

#pragma mark key Male

- (void) setupImage01 {		//int i = 0
	
	i = 0;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI)  / 5.0f) );
	float pxm = center.x  - xm - imvSize/2; 
	float pym = center.y  - ym - imvSize/2;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView01 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView01.backgroundColor = [UIColor colorWithWhite:1.0 alpha:alphaColor];
//	imageView01.image = [UIImage imageNamed:@"keyM_64.png"];

	[self addSubview:imageView01];
	[imageView01 release];

}

- (void) setupImage02 {		// int i = 1
	
	i = 1;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI)  / 5.0f) );
	float pxm = center.x  - xm - imvSize/2.0f; 
	float pym = center.y  - ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView02 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView02.backgroundColor = [UIColor colorWithWhite:1.0f alpha:alphaColor];
//	imageView02.image = [UIImage imageNamed:@"keyM_64.png"];
	[self addSubview:imageView02];
	[imageView02 release];

}

- (void) setupImage03 {		// int i = 2

	i = 2;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
	float pxm = center.x  - xm - imvSize/2.0f; 
	float pym = center.y  - ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView03 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView03.backgroundColor = [UIColor colorWithWhite:1.0f alpha:alphaColor];
//	imageView03.image = [UIImage imageNamed:@"keyM_64.png"];
	[self addSubview:imageView03];
	[imageView03 release];
	
}

- (void) setupImage04 {		// int i = 3
	
	i = 3;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
	float pxm = center.x  - xm - imvSize/2.0f; 
	float pym = center.y  - ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView04 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView04.backgroundColor = [UIColor colorWithWhite:1.0f alpha:alphaColor];
//	imageView04.image = [UIImage imageNamed:@"keyM_64.png"];
	[self addSubview:imageView04];
	[imageView04 release];
	
}

- (void) setupImage05 {

	i = 4;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
	float pxm = center.x  - xm - imvSize/2.0f; 
	float pym = center.y  - ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView05 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView05.backgroundColor = [UIColor colorWithWhite:1.0f alpha:alphaColor];
//	imageView05.image = [UIImage imageNamed:@"keyM_64.png"];
	[self addSubview:imageView05];
	[imageView05 release];

}

#pragma mark key Female

- (void) setupImage06 {

	i = 5;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
	float pxm = center.x  + xm - imvSize/2.0f; 
	float pym = center.y  + ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView06 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView06.backgroundColor = [UIColor colorWithWhite:0.0f alpha:alphaColor];
//	imageView06.image = [UIImage imageNamed:@"keyF_64.png"];
	[self addSubview:imageView06];
	[imageView06 release];

}

- (void) setupImage07 {

	i = 6;
	float xm = sizeArm * sinf(i * ( (4.0 * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0 * M_PI) / 5.0f) );
	float pxm = center.x  + xm - imvSize/2.0f; 
	float pym = center.y  + ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView07 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView07.backgroundColor = [UIColor colorWithWhite:0.0f alpha:alphaColor];
//	imageView07.image = [UIImage imageNamed:@"keyF_64.png"];
	[self addSubview:imageView07];
	[imageView07 release];

}

- (void) setupImage08 {

	i = 7;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
	float pxm = center.x  + xm - imvSize/2.0f; 
	float pym = center.y  + ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView08 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView08.backgroundColor = [UIColor colorWithWhite:0.0f alpha:alphaColor];
//	imageView08.image = [UIImage imageNamed:@"keyF_64.png"];
	[self addSubview:imageView08];
	[imageView08 release];


}

- (void) setupImage09 {

	i = 8;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
	float pxm = center.x  + xm - imvSize/2.0f; 
	float pym = center.y  + ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView09 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView09.backgroundColor = [UIColor colorWithWhite:0.0f alpha:alphaColor];
//	imageView09.image = [UIImage imageNamed:@"keyF_64.png"];
	[self addSubview:imageView09];
	[imageView09 release];

}

- (void) setupImage10 {
	i = 9;
	float xm = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
	float ym = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
	float pxm = center.x  + xm - imvSize/2.0f; 
	float pym = center.y  + ym - imvSize/2.0f;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize, imvSize);
	
	imageView10 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView10.backgroundColor = [UIColor colorWithWhite:0.0f alpha:alphaColor];
//	imageView10.image = [UIImage imageNamed:@"keyF_64.png"];
	[self addSubview:imageView10];
	[imageView10 release];
}

- (void) setupImage11 {

	float pxm = center.x  - imvSize; 
	float pym = center.y  - imvSize;

	CGRect keyRect = CGRectMake(pxm, pym, imvSize*2.0f, imvSize*2.0f);
	
	imageView11 = [[UIImageView alloc] initWithFrame:keyRect];
	imageView11.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.05f];

	[self addSubview:imageView11];
	[imageView11 release];
}




#pragma mark Touches Events Began

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
	UITouch *touch = [[event allTouches] anyObject];
	
#pragma mark ** navigatorView

	if (touch.tapCount == 1 && [touch view] == navigatorView) {

		CATransition *animation1 = [CATransition animation];
		[animation1 setDelegate:self];
		[animation1 setType:kCATransitionReveal];
		[animation1 setSubtype:kCATransitionFromTop];
		[animation1 setDuration:1.0];
	
		[self setupMyView];
		
		[animation1 setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
		[[self layer] addAnimation:animation1 forKey:kAnimationKey];
	
	}
	
	if (touch.tapCount == 1 && [touch view] == navigatorViewLeft) {
	
		CATransition *animation2 = [CATransition animation];
		[animation2 setDelegate:self];
		[animation2 setType:kCATransitionReveal];
		[animation2 setSubtype:kCATransitionFromRight];
		[animation2 setDuration:1.0];
	
		[self setupPentacleView];
		
		[animation2 setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
		[[self layer] addAnimation:animation2 forKey:kAnimationKey];
	
	}
	
	if (touch.tapCount == 2 && touch.view == self) {
	
		soundValue = @"sounds c2 g2 c3";
		
		[c0Sound play];
		[g3Sound play];
		[c4Sound play];
		
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView11.transform = transform;
		[UIView commitAnimations];
		
	}
	
#pragma mark ** view01	
	if (touch.tapCount == 1 && [touch view] == imageView01) {
	
		[c0Sound play];
		soundValue = @"sound c2";
		middleR = 1.0f;
		middleG = 0.0f;
		middleB = 0.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView01.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}

#pragma mark ** view02	
	if (touch.tapCount == 1 && [touch view] == imageView02) {
	
		[dSound play];
		soundValue = @"sound d2";

		middleR = 0.0f;
		middleG = 1.0f;
		middleB = 0.4f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView02.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view03	
	if (touch.tapCount == 1 && [touch view] == imageView03) {
	
		[eSound play];
		soundValue = @"sound e2";

		middleR = 0.8f;
		middleG = 0.0f;
		middleB = 1.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView03.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view04	
	if (touch.tapCount == 1 && [touch view] == imageView04) {
	
		[gSound play];
		soundValue = @"sound g2";
	
		middleR = 0.8f;
		middleG = 1.0f;
		middleB = 0.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView04.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view05	
	if (touch.tapCount == 1 && [touch view] == imageView05) {
	
		[aSound play];
		soundValue = @"sound a2";
		
		middleR = 0.0f;
		middleG = 0.4f;
		middleB = 1.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView05.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view06	
	if (touch.tapCount == 1 && [touch view] == imageView06) {
	
		[c1Sound play];
		soundValue = @"sound c3";
		
		middleR = 0.0f;
		middleG = 1.0f;
		middleB = 1.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView06.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view07	
	if (touch.tapCount == 1 && [touch view] == imageView07) {
	
		[d3Sound play];
		soundValue = @"sound d3";
		
		middleR = 1.0f;
		middleG = 0.0f;
		middleB = 0.6f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView07.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view08	
	if (touch.tapCount == 1 && [touch view] == imageView08) {
	
		[e3Sound play];
		soundValue = @"sound e3";
		
		middleR = 0.2f;
		middleG = 1.0f;
		middleB = 0.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView08.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view09	
	if (touch.tapCount == 1 && [touch view] == imageView09) {
	
		[g3Sound play];
		soundValue = @"sound g3";
		
		middleR = 0.2f;
		middleG = 0.0f;
		middleB = 1.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView09.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view10	
	if (touch.tapCount == 1 && [touch view] == imageView10) {
	
		[a3Sound play];
		soundValue = @"sound a3";
		
		middleR = 1.0f;
		middleG = 0.6f;
		middleB = 0.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView10.transform = transform;
			imageView11.transform = transform;
		[UIView commitAnimations];
	}
	
#pragma mark ** view11	
	if (touch.tapCount == 1 && [touch view] == imageView11) {
	
		[c4Sound play];
		soundValue = @"sound c4";
		
		middleR = 1.0f;
		middleG = 1.0f;
		middleB = 1.0f;
		
		radius = 36.0f;

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.5f];
		CGAffineTransform transform = CGAffineTransformMakeScale(0.5f, 0.5f);
			imageView11.transform = transform;
		[UIView commitAnimations];
	}

	[self setNeedsDisplay];
}

#pragma mark Touches Events End

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:0.25f];
		CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 1.0f);

		imageView01.transform = transform;
		imageView02.transform = transform;
		imageView03.transform = transform;
		imageView04.transform = transform;
		imageView05.transform = transform;
		
		imageView06.transform = transform;
		imageView07.transform = transform;
		imageView08.transform = transform;
		imageView09.transform = transform;
		imageView10.transform = transform;
		
		imageView11.transform = transform;
		
		[UIView commitAnimations];
		
		radius = 18.0f;
		
		[self setNeedsDisplay];
		
}



- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();
	
#pragma mark The Cage

	CGFloat radiusC = sizeArm;

	CGContextSetGrayStrokeColor(context, 0.6f, 0.2f); 
	CGContextSetLineWidth(context, 8.0f);

	CGContextMoveToPoint(context, middlePoint.x + radiusC, middlePoint.y);
	CGContextAddLineToPoint(context, middlePoint.x + radiusC, middlePoint.y + radiusC);
	CGContextAddLineToPoint(context, middlePoint.x - radiusC, middlePoint.y + radiusC);
	CGContextAddLineToPoint(context, middlePoint.x - radiusC, middlePoint.y - radiusC);
	CGContextAddLineToPoint(context, middlePoint.x + radiusC, middlePoint.y - radiusC);
	CGContextAddLineToPoint(context, middlePoint.x + radiusC, middlePoint.y);
	CGContextStrokePath(context);
	
#pragma mark horizontal lines

	CGContextSetGrayStrokeColor(context, 0.6f, 0.5f);
	CGContextSetLineWidth(context, 1.0f);
	
	CGContextMoveToPoint(context, middlePoint.x - middlePoint.x, middlePoint.y);
	CGContextAddLineToPoint(context, middlePoint.x + middlePoint.x, middlePoint.y);
	CGContextStrokePath(context);
	
	CGContextMoveToPoint(context, middlePoint.x, middlePoint.y - middlePoint.x);
	CGContextAddLineToPoint(context, middlePoint.x, middlePoint.y + middlePoint.x);
	CGContextStrokePath(context);
	
	CGContextSetGrayStrokeColor(context, 0.4f, 0.5f);
	CGContextSetLineWidth(context, 4.0f);
	
	CGContextMoveToPoint(context, middlePoint.x - middlePoint.x, middlePoint.y + middlePoint.x);
	CGContextAddLineToPoint(context, middlePoint.x + middlePoint.x, middlePoint.y + middlePoint.x);
	CGContextStrokePath(context);
	
	CGContextMoveToPoint(context, middlePoint.x - middlePoint.x, middlePoint.y - middlePoint.x);
	CGContextAddLineToPoint(context, middlePoint.x + middlePoint.x, middlePoint.y - middlePoint.x);
	CGContextStrokePath(context);
	
#pragma mark middlePoint

	CGContextSetRGBFillColor(context, middleR, middleG, middleB, 1.0f);
	CGContextAddArc(context, middlePoint.x, middlePoint.y, radius, 0.0f, M_PI*2, FALSE);
	CGContextFillPath(context);	
	
	CGContextSetGrayStrokeColor(context, 0.0f, 1.0f);
	CGContextSetLineWidth(context, 1.0f);
	CGContextAddArc(context, middlePoint.x, middlePoint.y, radius, 0.0f, M_PI*2, FALSE);
	CGContextStrokePath(context);
	
	

#pragma mark Pentacle

	CGContextSetGrayStrokeColor(context, 0.4f, 1.0f);  // main circle
	CGContextSetLineWidth(context, 1.0f);
	CGContextAddArc(context, middlePoint.x, middlePoint.y, sizeArm, 0.0f, M_PI*2, FALSE);
	CGContextStrokePath(context);	
	
	CGContextSetGrayStrokeColor(context, 0.2f, 1.0f);  // outer divider circle
	CGContextSetLineWidth(context, 1.0f);
	CGContextAddArc(context, middlePoint.x, middlePoint.y, sizeArm + 24.0f, 0.0f, M_PI*2, FALSE);
	CGContextStrokePath(context);	
	
#pragma mark ** pentacle M
		
/*************************************/ 
	
	CGContextSetLineWidth(context, 1.0f);
	
	CGContextSetGrayStrokeColor(context, 1.0f, 0.2f);
	
	CGContextMoveToPoint(context, center.x , center.y - sizeArm);
	
		for (i = 0; i < 5; i++) {
		x = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
		y = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
		
		CGContextAddLineToPoint(context, center.x  - x , center.y  - y);
		
		CGContextSetGrayFillColor(context, 0.0f, 0.8f);
		
		NSString *info = [NSString stringWithFormat:@"%i", i+1 ];
		UIFont *infoFont = [UIFont boldSystemFontOfSize: 16];
		[info drawAtPoint:CGPointMake(center.x - x, center.y - y) withFont:infoFont];
	}
	CGContextClosePath(context);
	CGContextStrokePath(context);
	
/*****************************************/

#pragma mark ** pentacle F
	
/*************************************/ 
	
	CGContextSetGrayStrokeColor(context, 0.0f, 0.2f);
	
	CGContextMoveToPoint(context, center.x , center.y + sizeArm);
	
		for (i = 0; i < 5; i++) {
		x = sizeArm * sinf(i * ( (4.0f * M_PI) / 5.0f) );
		y = sizeArm * cosf(i * (( 4.0f * M_PI) / 5.0f) );
		
		CGContextAddLineToPoint(context, center.x  + x , center.y  + y);
		
		CGContextSetGrayFillColor(context, 1.0f, 0.8f);
		
		NSString *info = [NSString stringWithFormat:@"%i", i+1 ];
		UIFont *infoFont = [UIFont boldSystemFontOfSize: 16];
		[info drawAtPoint:CGPointMake(center.x + x, center.y + y) withFont:infoFont];
	}
	CGContextClosePath(context);
	CGContextStrokePath(context);
	
/*****************************************/

#pragma mark Divider

	/*** math ***/
		
		float j;
		float divider = 60.0f;  // circle divider
		float notch = 4.0f;	// notch length 
		float outerRadius = sizeArm + 12.0f;
		
		for(j = 0; j <= divider; j++) {
			CGContextSetGrayStrokeColor(context, 0.6f, 1.0f);
			CGContextSetLineWidth(context, 1.0f);
			CGContextMoveToPoint(context, middlePoint.x + ( (outerRadius + notch)*sin(M_PI*2 * (j/divider) )), 
													middlePoint.y + ( (outerRadius + notch)*cos(M_PI*2 * (j/divider) )));
			CGContextAddLineToPoint(context, middlePoint.x + ( (outerRadius - notch)*sin(M_PI*2 * (j/divider) )), 
													middlePoint.y + ( (outerRadius - notch)*cos(M_PI*2 * (j/divider) )));
			CGContextStrokePath(context);
			
			CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 0.6f);
			CGContextAddArc(context, middlePoint.x + (outerRadius *sin(M_PI*2 * (j/divider) )), 
										middlePoint.y + (outerRadius *cos(M_PI*2 * (j/divider)) ), 1.0f, 0.0f, M_PI*2, FALSE);
			CGContextFillPath(context);
		}
	

#pragma mark Color


/***	color sexagesimal 60 ***/

	float c_sx_00[4] = {1.0f, 0.0f, 0.0f, 1.0f};		// 00	[1 0 0] red	*

	float c_sx_06[4] = {1.0f, 0.0f, 0.6f, 1.0f};		// 06	*

	float c_sx_12[4] = {0.8f, 0.0f, 1.0f, 1.0f};		// 12	*

	float c_sx_18[4] = {0.2f, 0.0f, 1.0f, 1.0f};		// 18	*

	float c_sx_24[4] = {0.0f, 0.4f, 1.0f, 1.0f};		// 24	*

	
	float c_sx_30[4] = {0.0f, 1.0f, 1.0f, 1.0f};		// 30	[0 1 1] cyan	*

	float c_sx_36[4] = {0.0f, 1.0f, 0.4f, 1.0f};		// 36	*

	float c_sx_42[4] = {0.2f, 1.0f, 0.0f, 1.0f};		// 42	*

	float c_sx_48[4] = {0.8f, 1.0f, 0.0f, 1.0f};		// 48	*

	float c_sx_54[4] = {1.0f, 0.6f, 0.0f, 1.0f};		// 54	*

#pragma mark Color Sound Circles
	
	CGFloat rayFactor = sizeArm - 44.0f;
	CGFloat sx_radius = 8.0f;

	CGContextSetFillColor(context, c_sx_30);	// 1 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (0/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (0/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_24);	// 5 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (6/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (6/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_18);	// 4 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (12/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (12/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_12);	// 3 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (18/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (18/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_06);	// 2 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (24/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (24/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_00);	// 1 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (30/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (30/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_54);	// 5 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (36/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (36/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_48);	// 4 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (42/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (42/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_42);	// 3 f
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (48/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (48/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
	CGContextSetFillColor(context, c_sx_36);	// 2 m
	CGContextAddArc(context, middlePoint.x + (rayFactor *sin(M_PI*2.0f * (54/divider) )), 
								middlePoint.y + (rayFactor *cos(M_PI*2.0f * (54/divider)) ), sx_radius, 0.0f, M_PI*2.0f, FALSE);
	CGContextFillPath(context);
	
/*******************************************/

#pragma mark Header

	CGContextSetGrayFillColor(context, 0.6f, 0.0f);			
	CGRect headerRect = CGRectMake(0.0f, 12.0f, 320.0f, 30.0f);
	CGContextFillRect(context, headerRect);
	
	CGContextSetGrayFillColor(context, 0.25f, 1.0f);
	NSString *stringH = [NSString stringWithFormat:@"%@", header1String];
	UIFont *headerFont = [UIFont boldSystemFontOfSize:28];
	[stringH drawInRect:headerRect withFont:headerFont lineBreakMode:UILineBreakModeTailTruncation alignment:1];
	
	CGContextSetGrayFillColor(context, 0.6f, 0.0f);			
	CGRect headerTime = CGRectMake(0.0f, 48.0f, 320.0f, 16.0f);
	CGContextFillRect(context, headerTime);
	
	CGContextSetGrayFillColor(context, 0.3f, 1.0f);
	NSString *timeInfo = [NSString stringWithFormat:@"%@", header2String ];
	UIFont *timerFont = [UIFont boldSystemFontOfSize:14];
	[timeInfo drawInRect:headerTime withFont:timerFont lineBreakMode:1 alignment:1];	
	
#pragma mark Footer

	CGContextSetGrayFillColor(context, 0.6, 0.0);
	CGRect footerRect = CGRectMake(0, 412, 320, 18);
	CGContextFillRect(context, footerRect);
	
	CGContextSetGrayFillColor(context, 1.0, 1.0);
	NSString *stringF = [NSString stringWithFormat:@"%@",  soundValue ];
	UIFont *footerFont = [UIFont boldSystemFontOfSize:18];
	[stringF drawInRect:footerRect withFont:footerFont lineBreakMode:5 alignment:1];

	
#pragma mark Navigator

	CGContextSetRGBFillColor(context, r, g, b, 1.0);	// right
	CGContextSetGrayStrokeColor(context, 0.2, 1.0);
	CGContextSetLineWidth(context, 1.0);
	
	CGContextAddEllipseInRect(context, navigatorRect);
	CGContextFillEllipseInRect(context, navigatorRect);
	
	CGContextStrokeEllipseInRect(context, navigatorRect);
	
	CGContextSetRGBFillColor(context, 1.0, 0.5, 0.0, 1.0);	// left
	CGContextSetGrayStrokeColor(context, 0.2, 1.0);
	CGContextSetLineWidth(context, 1.0);
	
	CGContextAddEllipseInRect(context, navigatorRectLeft);
	CGContextFillEllipseInRect(context, navigatorRectLeft);
	
	CGContextStrokeEllipseInRect(context, navigatorRectLeft);

}

- (void)dealloc
{

	[c4Sound release];
	[d3Sound release];
	[e3Sound release];
	[g3Sound release];
	[a3Sound release];
	[c0Sound release];
	[d3Sound release];
	[e3Sound release];
	[g3Sound release];
	[a3Sound release];
	[c4Sound release];

	[super dealloc];
}

@end
				

Idea & design: © W X Gwizdala
// Created by w x gwizdala on 10/13/08.// Copyright w x gwizdala 2008. All rights reserved.