Ardour  9.7-336-gb784ad01ee
scale_provider.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #include "pbd/properties.h"
22 
24 
25 namespace Temporal {
26  class timepos_t;
27 }
28 
29 namespace ARDOUR {
30  namespace Properties {
31  LIBARDOUR_API extern PBD::PropertyDescriptor<bool> musical_mode; /* type is irrelevant */
33  }
34 
35 class MusicalKey;
36 
37 class LIBARDOUR_API ScaleProvider : public virtual PBD::Stateful {
38  public:
40  virtual ~ScaleProvider ();
41 
42  ScaleProvider* parent() const { return _parent; }
43  virtual MusicalKey const * key() const;
44  virtual MusicalKey const * key_at (Temporal::timepos_t const &) const {
45  /* by default, ignore time since there's only 1 answer */
46  return key();
47  }
48  void set_key (MusicalKey const *);
49 
50  static void make_property_quarks ();
51 
52  XMLNode& get_state () const;
53  int set_state (const XMLNode&, int version);
54 
56 
59 
61  bool own_scale() const { return scale_provider_origin() == this; }
62 
63  private:
65  MusicalKey const * _key;
68 };
69 
70 } // namespace
virtual MusicalKey const * key() const
bool own_scale() const
virtual void set_key_enforcement_policy(KeyEnforcementPolicy kep)
static void make_property_quarks()
KeyEnforcementPolicy _key_enforcement_policy
ScaleProvider(ScaleProvider *parent)
MusicalKey const * _key
ScaleProvider * _parent
int set_state(const XMLNode &, int version)
virtual MusicalKey const * key_at(Temporal::timepos_t const &) const
PBD::ScopedConnection parent_connection
ScaleProvider const * scale_provider_origin() const
KeyEnforcementPolicy key_enforcement_policy() const
XMLNode & get_state() const
void parent_prop_change(PBD::PropertyChange const &)
void set_key(MusicalKey const *)
ScaleProvider * parent() const
Definition: xml++.h:114
#define LIBARDOUR_API
PBD::PropertyDescriptor< bool > musical_mode
PBD::PropertyDescriptor< KeyEnforcementPolicy > key_enforcement
Temporal::timepos_t timepos_t
DebugBits Properties