Permalink
Browse files

Added transpose to chords, test also

  • Loading branch information...
1 parent 4647841 commit 04616a245d14b8c37daa00083ee5a124e17f0c74 @fredericcormier committed Mar 15, 2012
@@ -19,4 +19,6 @@
- (NSString *)name;
+- (WMChord *)transpose:(WMInterval)interval;
+
@end
@@ -59,6 +59,12 @@ - (NSArray *)invertArray:(NSArray *) inArray:(WMChordInversion)inv{
return nil;
}
+- (WMChord *)transpose:(WMInterval)interval {
+ WMNote *newRootNote = [[self rootNote] noteAtInterval:interval];
+ return [self initWithRootNote:newRootNote forType:[self type] inversion:[self inversion]];
+}
+
+
- (NSString *)name {
return [NSString stringWithFormat:@"%@ %@ inv: %d",[[self rootNote] shortName], [self type], [self inversion]];
}
@@ -80,5 +80,9 @@ - (void)testTranspose {
STAssertTrue([[[C2MajorScale transpose:WMDiatonicIntervalMajorThird] StringWithNoteShortNames]
isEqualToString:[E2MajorScale StringWithNoteShortNames]],
@"e2 is a third major higher that c2, so are the scales");
+
+ STAssertTrue([[[C3MajorChord transpose:WMDiatonicIntervalMajorThird] StringWithNoteShortNames]
+ isEqualToString:[E3MajorChord StringWithNoteShortNames]],
+ @"c3 aMajor third higher is e3, so are the chords");
}
@end

0 comments on commit 04616a2

Please sign in to comment.