move mode/scale/key definitions out of push2 code and into libardour; Aeolian is the same as Minor

This commit is contained in:
Paul Davis 2016-09-28 10:47:10 -05:00
parent b9332f5fe2
commit b6e62c6654
10 changed files with 144 additions and 115 deletions

76
libs/ardour/ardour/mode.h Normal file
View File

@ -0,0 +1,76 @@
/*
Copyright (C) 1999-2016 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_mode_h__
#define __ardour_mode_h__
#include <vector>
class MusicalMode
{
public:
enum Type {
Dorian,
IonianMajor,
AeolianMinor,
HarmonicMinor,
MelodicMinorAscending,
MelodicMinorDescending,
Phrygian,
Lydian,
Mixolydian,
Locrian,
PentatonicMajor,
PentatonicMinor,
Chromatic,
BluesScale,
NeapolitanMinor,
NeapolitanMajor,
Oriental,
DoubleHarmonic,
Enigmatic,
Hirajoshi,
HungarianMinor,
HungarianMajor,
Kumoi,
Iwato,
Hindu,
Spanish8Tone,
Pelog,
HungarianGypsy,
Overtone,
LeadingWholeTone,
Arabian,
Balinese,
Gypsy,
Mohammedan,
Javanese,
Persian,
Algerian
};
MusicalMode (Type t);
~MusicalMode ();
std::vector<float> steps;
private:
static void fill (MusicalMode&, Type);
};
#endif /* __ardour_mode_h__ */

View File

@ -31,6 +31,7 @@
#include "ardour/io.h"
#include "ardour/location.h"
#include "ardour/midi_model.h"
#include "ardour/mode.h"
#include "ardour/mute_master.h"
#include "ardour/presentation_info.h"
#include "ardour/session.h"
@ -134,6 +135,7 @@ setup_enum_writer ()
BufferingPreset _BufferingPreset;
AutoReturnTarget _AutoReturnTarget;
PresentationInfo::Flag _PresentationInfo_Flag;
MusicalMode::Type mode;
#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear()
@ -715,6 +717,45 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (PresentationInfo, Hidden);
REGISTER_CLASS_ENUM (PresentationInfo, OrderSet);
REGISTER_BITS (_PresentationInfo_Flag);
REGISTER_CLASS_ENUM (MusicalMode,Dorian);
REGISTER_CLASS_ENUM (MusicalMode, IonianMajor);
REGISTER_CLASS_ENUM (MusicalMode, AeolianMinor);
REGISTER_CLASS_ENUM (MusicalMode, HarmonicMinor);
REGISTER_CLASS_ENUM (MusicalMode, MelodicMinorAscending);
REGISTER_CLASS_ENUM (MusicalMode, MelodicMinorDescending);
REGISTER_CLASS_ENUM (MusicalMode, Phrygian);
REGISTER_CLASS_ENUM (MusicalMode, Lydian);
REGISTER_CLASS_ENUM (MusicalMode, Mixolydian);
REGISTER_CLASS_ENUM (MusicalMode, Locrian);
REGISTER_CLASS_ENUM (MusicalMode, PentatonicMajor);
REGISTER_CLASS_ENUM (MusicalMode, PentatonicMinor);
REGISTER_CLASS_ENUM (MusicalMode, Chromatic);
REGISTER_CLASS_ENUM (MusicalMode, BluesScale);
REGISTER_CLASS_ENUM (MusicalMode, NeapolitanMinor);
REGISTER_CLASS_ENUM (MusicalMode, NeapolitanMajor);
REGISTER_CLASS_ENUM (MusicalMode, Oriental);
REGISTER_CLASS_ENUM (MusicalMode, DoubleHarmonic);
REGISTER_CLASS_ENUM (MusicalMode, Enigmatic);
REGISTER_CLASS_ENUM (MusicalMode, Hirajoshi);
REGISTER_CLASS_ENUM (MusicalMode, HungarianMinor);
REGISTER_CLASS_ENUM (MusicalMode, HungarianMajor);
REGISTER_CLASS_ENUM (MusicalMode, Kumoi);
REGISTER_CLASS_ENUM (MusicalMode, Iwato);
REGISTER_CLASS_ENUM (MusicalMode, Hindu);
REGISTER_CLASS_ENUM (MusicalMode, Spanish8Tone);
REGISTER_CLASS_ENUM (MusicalMode, Pelog);
REGISTER_CLASS_ENUM (MusicalMode, HungarianGypsy);
REGISTER_CLASS_ENUM (MusicalMode, Overtone);
REGISTER_CLASS_ENUM (MusicalMode, LeadingWholeTone);
REGISTER_CLASS_ENUM (MusicalMode, Arabian);
REGISTER_CLASS_ENUM (MusicalMode, Balinese);
REGISTER_CLASS_ENUM (MusicalMode, Gypsy);
REGISTER_CLASS_ENUM (MusicalMode, Mohammedan);
REGISTER_CLASS_ENUM (MusicalMode, Javanese);
REGISTER_CLASS_ENUM (MusicalMode, Persian);
REGISTER_CLASS_ENUM (MusicalMode, Algerian);
REGISTER (mode);
}
} /* namespace ARDOUR */

View File

@ -1,4 +1,23 @@
#include "mode.h"
/*
Copyright (C) 1999-2016 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "ardour/mode.h"
MusicalMode::MusicalMode (MusicalMode::Type t)
{
@ -36,7 +55,7 @@ MusicalMode::fill (MusicalMode& m, MusicalMode::Type t)
m.steps.push_back (4.5);
m.steps.push_back (5.5);
break;
case Minor:
case AeolianMinor:
m.steps.push_back (1.0);
m.steps.push_back (1.5);
m.steps.push_back (2.5);
@ -102,14 +121,6 @@ MusicalMode::fill (MusicalMode& m, MusicalMode::Type t)
m.steps.push_back (4.5);
m.steps.push_back (5.0);
break;
case Aeolian:
m.steps.push_back (1.0);
m.steps.push_back (1.5);
m.steps.push_back (2.5);
m.steps.push_back (3.5);
m.steps.push_back (4.0);
m.steps.push_back (5.0);
break;
case Locrian:
m.steps.push_back (0.5);
m.steps.push_back (1.5);

View File

@ -143,6 +143,7 @@ libardour_sources = [
'mididm.cc',
'midiport_manager.cc',
'mix.cc',
'mode.cc',
'monitor_control.cc',
'monitor_processor.cc',
'mtc_slave.cc',

View File

@ -37,8 +37,9 @@ namespace Gtk {
class ListStore;
}
#include "ardour/mode.h"
#include "push2.h"
#include "mode.h"
namespace ArdourSurface {

View File

@ -1,59 +0,0 @@
#ifndef __ardour_push2_mode_h__
#define __ardour_push2_mode_h__
#include <vector>
class MusicalMode
{
public:
enum Type {
Dorian,
IonianMajor,
Minor,
HarmonicMinor,
MelodicMinorAscending,
MelodicMinorDescending,
Phrygian,
Lydian,
Mixolydian,
Aeolian,
Locrian,
PentatonicMajor,
PentatonicMinor,
Chromatic,
BluesScale,
NeapolitanMinor,
NeapolitanMajor,
Oriental,
DoubleHarmonic,
Enigmatic,
Hirajoshi,
HungarianMinor,
HungarianMajor,
Kumoi,
Iwato,
Hindu,
Spanish8Tone,
Pelog,
HungarianGypsy,
Overtone,
LeadingWholeTone,
Arabian,
Balinese,
Gypsy,
Mohammedan,
Javanese,
Persian,
Algerian
};
MusicalMode (Type t);
~MusicalMode ();
std::vector<float> steps;
private:
static void fill (MusicalMode&, Type);
};
#endif /* __ardour_push2_mode_h__ */

View File

@ -75,50 +75,10 @@ register_enums ()
vector<int> i;
vector<string> s;
MusicalMode::Type mode;
#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_CLASS_ENUM(t,e) i.push_back (t::e); s.push_back (#e)
REGISTER_CLASS_ENUM (MusicalMode,Dorian);
REGISTER_CLASS_ENUM (MusicalMode, IonianMajor);
REGISTER_CLASS_ENUM (MusicalMode, Minor);
REGISTER_CLASS_ENUM (MusicalMode, HarmonicMinor);
REGISTER_CLASS_ENUM (MusicalMode, MelodicMinorAscending);
REGISTER_CLASS_ENUM (MusicalMode, MelodicMinorDescending);
REGISTER_CLASS_ENUM (MusicalMode, Phrygian);
REGISTER_CLASS_ENUM (MusicalMode, Lydian);
REGISTER_CLASS_ENUM (MusicalMode, Mixolydian);
REGISTER_CLASS_ENUM (MusicalMode, Aeolian);
REGISTER_CLASS_ENUM (MusicalMode, Locrian);
REGISTER_CLASS_ENUM (MusicalMode, PentatonicMajor);
REGISTER_CLASS_ENUM (MusicalMode, PentatonicMinor);
REGISTER_CLASS_ENUM (MusicalMode, Chromatic);
REGISTER_CLASS_ENUM (MusicalMode, BluesScale);
REGISTER_CLASS_ENUM (MusicalMode, NeapolitanMinor);
REGISTER_CLASS_ENUM (MusicalMode, NeapolitanMajor);
REGISTER_CLASS_ENUM (MusicalMode, Oriental);
REGISTER_CLASS_ENUM (MusicalMode, DoubleHarmonic);
REGISTER_CLASS_ENUM (MusicalMode, Enigmatic);
REGISTER_CLASS_ENUM (MusicalMode, Hirajoshi);
REGISTER_CLASS_ENUM (MusicalMode, HungarianMinor);
REGISTER_CLASS_ENUM (MusicalMode, HungarianMajor);
REGISTER_CLASS_ENUM (MusicalMode, Kumoi);
REGISTER_CLASS_ENUM (MusicalMode, Iwato);
REGISTER_CLASS_ENUM (MusicalMode, Hindu);
REGISTER_CLASS_ENUM (MusicalMode, Spanish8Tone);
REGISTER_CLASS_ENUM (MusicalMode, Pelog);
REGISTER_CLASS_ENUM (MusicalMode, HungarianGypsy);
REGISTER_CLASS_ENUM (MusicalMode, Overtone);
REGISTER_CLASS_ENUM (MusicalMode, LeadingWholeTone);
REGISTER_CLASS_ENUM (MusicalMode, Arabian);
REGISTER_CLASS_ENUM (MusicalMode, Balinese);
REGISTER_CLASS_ENUM (MusicalMode, Gypsy);
REGISTER_CLASS_ENUM (MusicalMode, Mohammedan);
REGISTER_CLASS_ENUM (MusicalMode, Javanese);
REGISTER_CLASS_ENUM (MusicalMode, Persian);
REGISTER_CLASS_ENUM (MusicalMode, Algerian);
REGISTER (mode);
}
Push2::Push2 (ARDOUR::Session& s)

View File

@ -32,6 +32,7 @@
#include "midi++/types.h"
#include "ardour/mode.h"
#include "ardour/types.h"
#include "control_protocol/control_protocol.h"
@ -40,7 +41,6 @@
#include "canvas/colors.h"
#include "midi_byte_array.h"
#include "mode.h"
namespace Pango {
class Layout;

View File

@ -379,19 +379,18 @@ ScaleLayout::build_scale_menu ()
v.push_back ("Dorian");
v.push_back ("Ionian (Major)");
v.push_back ("Minor");
v.push_back ("Aeolian (Minor)");
v.push_back ("Harmonic Minor");
v.push_back ("MelodicMinor Asc.");
v.push_back ("MelodicMinor Desc.");
v.push_back ("Phrygian");
v.push_back ("Lydian");
v.push_back ("Mixolydian");
v.push_back ("Aeolian");
v.push_back ("Locrian");
v.push_back ("Pentatonic Major");
v.push_back ("Pentatonic Minor");
v.push_back ("Chromatic");
v.push_back ("BluesScale");
v.push_back ("Blues Scale");
v.push_back ("Neapolitan Minor");
v.push_back ("Neapolitan Major");
v.push_back ("Oriental");

View File

@ -30,7 +30,6 @@ def build(bld):
gui.cc
knob.cc
layout.cc
mode.cc
menu.cc
mix.cc
scale.cc