mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Add Octave Transpositions
This commit is contained in:
parent
45f98adcc5
commit
1355516e6a
File diff suppressed because it is too large
Load Diff
|
@ -65,6 +65,7 @@ enum {
|
|||
- (void) setDivisions:(int)divisions inSections:(NSRange)sections;
|
||||
- (void) setGroove:(NSString *)groove inSections:(NSRange)sections;
|
||||
- (void) playWithGroove:(NSString *)groove inSections:(NSRange)sections;
|
||||
- (void) changeOctave:(BOOL)up inSections:(NSRange)sections;
|
||||
|
||||
- (void) setRepeatVolta:(int)repeatVolta;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//
|
||||
// (MN) Matthias Neeracher
|
||||
//
|
||||
// Copyright © 2005-2007 Matthias Neeracher
|
||||
// Copyright © 2005-2008 Matthias Neeracher
|
||||
//
|
||||
|
||||
#import "VLDocument.h"
|
||||
|
@ -271,6 +271,14 @@
|
|||
[self didChangeSong];
|
||||
}
|
||||
|
||||
- (void) changeOctave:(BOOL)up inSections:(NSRange)sections
|
||||
{
|
||||
[self willChangeSong];
|
||||
while (sections.length-- > 0)
|
||||
song->ChangeOctave(sections.location++, up);
|
||||
[self didChangeSong];
|
||||
}
|
||||
|
||||
- (void) setChordSize:(float)size
|
||||
{
|
||||
[[[self undoManager] prepareWithInvocationTarget:self] setChordSize:chordSize];
|
||||
|
|
|
@ -964,6 +964,25 @@ void VLSong::ChangeKey(int section, int newKey, int newMode, bool transpose)
|
|||
}
|
||||
}
|
||||
|
||||
void VLSong::ChangeOctave(int section, bool transposeUp)
|
||||
{
|
||||
int semi = transposeUp ? 12 : -12;
|
||||
|
||||
for (size_t measure=0; measure<fMeasures.size(); ++measure) {
|
||||
if (fMeasures[measure].fPropIdx != section)
|
||||
continue;
|
||||
|
||||
VLNoteList::iterator i = fMeasures[measure].fMelody.begin();
|
||||
VLNoteList::iterator e = fMeasures[measure].fMelody.end();
|
||||
|
||||
for (; i!=e; ++i) {
|
||||
if (i->fPitch == VLNote::kNoPitch)
|
||||
continue;
|
||||
i->fPitch += semi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// We try a table based approach for converting the beginning and end of
|
||||
// notes
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//
|
||||
// (MN) Matthias Neeracher
|
||||
//
|
||||
// Copyright © 2005-2007 Matthias Neeracher
|
||||
// Copyright © 2005-2008 Matthias Neeracher
|
||||
//
|
||||
|
||||
#include <list>
|
||||
|
@ -346,6 +346,7 @@ public:
|
|||
bool DoesTieWithNextRepeat(size_t measure) const;
|
||||
bool IsNonEmpty() const;
|
||||
void ChangeKey(int section, int newKey, int newMode, bool transpose);
|
||||
void ChangeOctave(int section, bool transposeUp);
|
||||
void ChangeDivisions(int section, int newDivisions);
|
||||
void ChangeTime(int section, VLFraction newTime);
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ enum VLRecalc {
|
|||
- (IBAction) endSheetWithButton:(id)sender;
|
||||
- (IBAction) selectGroove:(id)sender;
|
||||
- (IBAction) editDisplayOptions:(id)sender;
|
||||
- (IBAction) transposeOctave:(id)sender;
|
||||
|
||||
- (VLDocument *) document;
|
||||
- (VLSong *) song;
|
||||
|
|
|
@ -625,6 +625,12 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"};
|
|||
[self setKey:nil returnCode:NSAlertOtherReturn contextInfo:sender];
|
||||
}
|
||||
|
||||
- (IBAction) transposeOctave:(id)sender
|
||||
{
|
||||
[[self document] changeOctave:[sender tag] > 0
|
||||
inSections:[self sectionsInSelection]];
|
||||
}
|
||||
|
||||
- (IBAction) setTime:(id)sender
|
||||
{
|
||||
int time = [[sender selectedItem] tag];
|
||||
|
|
Loading…
Reference in New Issue
Block a user