-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added scales #128
added scales #128
Changes from all commits
d5e3216
ef33b2c
b66c5c4
127a607
ddd501f
42e1627
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
#include "System/io/Status.h" | ||
#include "Foundation/Variables/WatchedVariable.h" | ||
#include "Application/Player/SyncMaster.h" | ||
#include "Scale.h" | ||
#include "Table.h" | ||
#include "Groove.h" | ||
#include "Application/Persistency/PersistencyService.h" | ||
|
@@ -27,6 +28,11 @@ tempoNudge_(0) | |
this->Insert(wrap) ; | ||
Variable *transpose=new Variable("transpose",VAR_TRANSPOSE,0) ; | ||
this->Insert(transpose) ; | ||
|
||
// from: https://github.com/xiphonics/picoTracker/blob/master/sources/Application/Model/Project.cpp | ||
Variable *scale = new Variable("scale", VAR_SCALE, scaleNames, scaleCount, 0); | ||
this->Insert(scale); | ||
scale->SetInt(0); | ||
|
||
// Reload the midi device list | ||
|
||
|
@@ -59,6 +65,13 @@ Project::~Project() { | |
delete instrumentBank_ ; | ||
} ; | ||
|
||
// from: https://github.com/xiphonics/picoTracker/blob/master/sources/Application/Model/Project.cpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer if we keep this info in the corresponding .h and .cpp, it's not necessary to have it here. |
||
int Project::GetScale() { | ||
Variable *v = FindVariable(VAR_SCALE); | ||
NAssert(v); | ||
return v->GetInt(); | ||
} | ||
|
||
int Project::GetTempo() { | ||
Variable *v=FindVariable(VAR_TEMPO) ; | ||
NAssert(v) ; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
// from: https://github.com/xiphonics/picoTracker | ||
#include "Scale.h" | ||
|
||
// Source of scales in original release: | ||
// https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/PitchConstellations.svg/1280px-PitchConstellations.svg.png | ||
|
||
// Additional Scales | ||
// https://pianoencyclopedia.com/scales/ | ||
|
||
const char *scaleNotes[scaleNoteCount] = { | ||
"C","C#","D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" | ||
}; | ||
|
||
const char *scaleNames[scaleCount] = {"None (Chromatic)", | ||
"Acoustic", | ||
"Adonal malakh", | ||
"Aeolian mode (minor)", | ||
"Algerian", | ||
"Altered", | ||
"Augmented", | ||
"Bebop dominant", | ||
"Blues", | ||
"Dorian", | ||
"Double harmonic", | ||
"Enigmatic", | ||
"Flamenco", | ||
"Gypsy", | ||
"Half diminished", | ||
"Harmonic major", | ||
"Harmonic minor", | ||
"Hirajoshi", | ||
"Hungarian gypsy", | ||
"Hungarian minor", | ||
"Insen", | ||
"Ionian mode (major)", | ||
"Istrian", | ||
"Iwato", | ||
"Locrian", | ||
"Lydian augmented", | ||
"Lydian", | ||
"Major bebop", | ||
"Major locran", | ||
"Major pentatonic", | ||
"Melodic minor", | ||
"Melodic minor (asc)", | ||
"Minor pentatonic", | ||
"Mixolydian", | ||
"Neapolitan major", | ||
"Neapolitan minor", | ||
"Octatonic", | ||
"Persian", | ||
"Phrygian dominant", | ||
"Phrygian", | ||
"Prometheus", | ||
"Ryukyu", | ||
"Tritone", | ||
"Tercera Alta", | ||
"Ukranian", | ||
"Whole tone", | ||
}; | ||
|
||
const bool scaleSteps[scaleCount][scaleNoteCount] = { | ||
// "C","C#","D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" | ||
// "None (Chromatic)" | ||
{true, true, true, true, true, true, true, true, true, true, true, true}, | ||
// "Acoustic" | ||
{true, false, true, false, true, false, true, true, false, true, false, | ||
false}, | ||
// "Adonal malakh" | ||
{true, false, true, false, true, true, false, true, true, false, true, | ||
false}, | ||
// "Aeolian mode (minor)" | ||
{true, false, true, true, false, true, false, true, true, false, true, | ||
false}, | ||
// "Algerian" | ||
{true, false, true, true, false, false, true, true, true, false, false, | ||
true}, | ||
// "Altered" | ||
{true, true, false, true, true, false, true, false, true, false, true, | ||
false}, | ||
// "Augmented" | ||
{true, false, false, true, true, false, false, true, true, false, false, | ||
true}, | ||
// "Bebop dominant" | ||
{true, false, true, false, true, true, false, true, false, true, true, | ||
true}, | ||
// "Blues" | ||
{true, false, false, true, false, true, true, true, false, false, true, | ||
false}, | ||
// "Dorian" | ||
{true, false, true, true, false, true, false, true, false, true, true, | ||
false}, | ||
// "Double harmonic" | ||
{true, true, false, false, true, true, false, true, true, false, false, | ||
true}, | ||
// "Enigmatic" | ||
{true, true, false, false, true, false, true, false, true, false, true, | ||
true}, | ||
// "Flamenco" | ||
{true, true, false, false, true, true, false, true, true, false, false, | ||
true}, | ||
// "Gypsy" | ||
{true, false, true, true, false, false, true, true, true, false, true, | ||
false}, | ||
// "Half diminished" | ||
{true, false, true, true, false, true, true, false, true, false, true, | ||
false}, | ||
// "Harmonic major" | ||
{true, false, true, false, true, true, false, true, true, false, false, | ||
true}, | ||
// "Harmonic minor" | ||
{true, false, true, true, false, true, false, true, true, false, false, | ||
true}, | ||
// "Hirajoshi" | ||
{true, false, true, true, false, false, false, true, true, false, false, | ||
false}, | ||
// "Hungarian gypsy" | ||
{true, false, true, true, false, false, true, true, true, false, false, | ||
true}, | ||
// "Hungarian minor" | ||
{true, false, true, true, false, false, true, true, true, false, false, | ||
true}, | ||
// "Insen" | ||
{true, true, false, false, false, true, false, true, false, false, true, | ||
false}, | ||
// "Ionian mode (major)" | ||
{true, false, true, false, true, true, false, true, false, true, false, | ||
true}, | ||
// "Istrian" | ||
{true, true, false, true, true, false, true, true, false, false, false, | ||
false}, | ||
// "Iwato" | ||
{true, true, false, false, false, true, true, false, false, false, true, | ||
false}, | ||
// "Locrian" | ||
{true, true, false, true, false, true, true, false, true, false, true, | ||
false}, | ||
// "Lydian augmented" | ||
{true, false, true, false, true, false, true, false, true, true, false, | ||
true}, | ||
// "Lydian" | ||
{true, false, true, false, true, false, true, true, false, true, false, | ||
true}, | ||
// "Major bebop" | ||
{true, false, true, false, true, true, false, true, true, true, false, | ||
true}, | ||
// "Major locran" | ||
{true, false, true, false, true, true, true, false, true, false, true, | ||
false}, | ||
// "Major pentatonic" | ||
{true, false, true, false, true, false, false, true, false, true, false, | ||
false}, | ||
// "Melodic minor" | ||
{true, false, true, true, false, true, false, true, true, true, true, true}, | ||
// "Melodic minor (asc)" | ||
{true, false, true, true, false, true, false, true, false, true, false, | ||
true}, | ||
// "Minor pentatonic" | ||
{true, false, false, true, false, true, false, true, false, false, true, | ||
false}, | ||
// "Mixolydian" | ||
{true, false, true, false, true, true, false, true, false, true, true, | ||
false}, | ||
// "Neapolitan major" | ||
{true, true, false, true, false, true, false, true, false, true, false, | ||
true}, | ||
// "Neapolitan minor" | ||
{true, true, false, true, false, true, false, true, true, false, false, | ||
true}, | ||
// "Octatonic" | ||
{true, false, true, true, false, true, true, false, true, true, false, | ||
true}, | ||
// "Persian" | ||
{true, true, false, false, true, true, true, false, true, false, false, | ||
true}, | ||
// "Phrygian dominant" | ||
{true, true, false, false, true, true, false, true, true, false, true, | ||
false}, | ||
// "Phrygian" | ||
{true, true, false, true, false, true, false, true, true, false, true, | ||
false}, | ||
// "Prometheus" | ||
{true, false, true, false, true, false, true, false, false, true, true, | ||
false}, | ||
// Ryukyu | ||
{true, false, false, false, true, true, false, true, false, false, false, true}, | ||
// "Tritone" | ||
{true, true, false, false, true, false, true, true, false, false, true, | ||
false}, | ||
// "Tercera Alta" | ||
{false, true, true, false, false, false, true, false, false, true, false, false}, | ||
// "Ukranian" | ||
{true, false, true, true, false, false, true, true, false, true, true, | ||
false}, | ||
// "Whole tone" | ||
{true, false, true, false, true, false, true, false, true, false, true, | ||
false} | ||
|
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// from: https://github.com/xiphonics/picoTracker | ||
#ifndef SCALE_VIEW_H | ||
#define SCALE_VIEW_H | ||
|
||
const int scaleCount = 46; | ||
const int scaleNoteCount = 12; | ||
extern const char *scaleNames[scaleCount]; | ||
extern const char *scaleNotes[scaleNoteCount]; | ||
extern const bool scaleSteps[scaleCount][scaleNoteCount]; | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
#include "Application/Utils/char.h" | ||
#include "Application/Instruments/CommandList.h" | ||
#include "UIController.h" | ||
#include "Application/Model/Scale.h" | ||
#include "Application/Model/Table.h" | ||
#include "Application/Utils/HelpLegend.h" | ||
#include <string.h> | ||
|
@@ -206,6 +207,12 @@ void PhraseView::updateCursorValue(ViewUpdateDirection direction,int xOffset,int | |
} | ||
if ((c)&&(*c!=0xFF)) { | ||
int offset=offsets_[col_+xOffset][direction] ; | ||
// from: https://github.com/xiphonics/picoTracker/blob/master/sources/Application/Views/PhraseView.cpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer if we keep this info in the corresponding .h and .cpp, it's not necessary to have it here. |
||
// Add/remove from offset to match selected scale | ||
int scale = viewData_->project_->GetScale(); | ||
while (!scaleSteps[scale][(*c + offset) % 12]) { | ||
offset > 0 ? offset++ : offset--; | ||
} | ||
|
||
updateData(c,offset,limit,wrap) ; | ||
switch(col_+xOffset) { | ||
|
@@ -1011,6 +1018,7 @@ void PhraseView::DrawView() { | |
sprintf(title,"Phrase %2.2x",viewData_->currentPhrase_) ; | ||
DrawString(pos._x,pos._y,title,props) ; | ||
|
||
|
||
// Compute song grid location | ||
|
||
GUIPoint anchor=GetAnchor() ; | ||
|
@@ -1178,6 +1186,27 @@ void PhraseView::DrawView() { | |
|
||
drawMap() ; | ||
drawNotes() ; | ||
|
||
// Draw Current Scale | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please no commits containing commented-out code |
||
// Uncomment if you want to display the current scale in phrase view | ||
/* | ||
int scale = viewData_->project_->GetScale(); | ||
if (scale > 0) { | ||
// Only Draw Scales different from default (chromatic) | ||
char scale_notes_title[25]; | ||
std::string scale_notes = ""; | ||
|
||
for(int i = 0; i < scaleNoteCount; i++) { | ||
if (scaleSteps[scale][i] == true) { | ||
scale_notes = scale_notes + scaleNotes[i]; | ||
}; | ||
} | ||
|
||
SetColor(CD_NORMAL); | ||
sprintf(scale_notes_title, "Scale: %s", scale_notes.c_str()); | ||
DrawString(0, pos._y + 4, scale_notes_title, props); | ||
} | ||
*/ | ||
|
||
Player *player=Player::GetInstance() ; | ||
if (player->IsRunning()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if we keep this info in the corresponding .h and .cpp, it's not necessary to have it here.