tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_GrooveTemplate.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11namespace tracktion { inline namespace engine
12{
13
14//==============================================================================
18{
19public:
24
25 const GrooveTemplate& operator= (const GrooveTemplate&);
26 bool operator== (const GrooveTemplate&) const;
27
28 //==============================================================================
29 bool isEmpty() const;
30 bool isParameterized() const;
31 void setParameterized (bool p) { parameterized = p; }
32
33 //==============================================================================
35 BeatPosition beatsTimeToGroovyTime (BeatPosition beatsTime, float strength) const;
36
38 TimePosition editTimeToGroovyTime (TimePosition editTime, float strength, Edit& edit) const;
39
40 //==============================================================================
41 const juce::String& getName() const { return name; }
42 void setName (const juce::String&);
43
44 // all indexes are in quarter-notes
45 int getNumberOfNotes() const { return numNotes; }
46 void setNumberOfNotes (int notes);
47
48 int getNotesPerBeat() const { return notesPerBeat; }
49 void setNotesPerBeat (int notes);
50
51 // value is 0 to 1.0 of the length of a note
52 float getLatenessProportion (int noteNumber, float strength) const;
53 void setLatenessProportion (int noteNumber, float p, float strength);
54 void clearLatenesses();
55
56 //==============================================================================
57 static const char* grooveXmlTag;
58 juce::XmlElement* createXml() const;
59
60private:
61 //==============================================================================
62 juce::Array<float> latenesses;
63 int numNotes, notesPerBeat;
64 juce::String name;
65 bool parameterized = false;
66
67 //==============================================================================
69};
70
71//==============================================================================
76{
77public:
78 //==============================================================================
80
81 void useParameterizedGrooves (bool b);
82
83 //==============================================================================
84 int getNumTemplates() const;
85 juce::String getTemplateName (int index) const;
86
87 juce::StringArray getTemplateNames() const;
88
89 const GrooveTemplate* getTemplate (int index);
90 const GrooveTemplate* getTemplateByName (const juce::String& name);
91
92 void updateTemplate (int index, const GrooveTemplate&);
93 void deleteTemplate (int index);
94
96 void reload();
97
98 Engine& engine;
99
100private:
101 //==============================================================================
103 juce::Array<GrooveTemplate*> activeGrooves;
104
105 //==============================================================================
106 void save();
107 void reload (const juce::XmlElement*);
108
109 bool useParameterized = false;
110 //==============================================================================
112};
113
114}} // namespace tracktion { inline namespace engine
The Tracktion Edit class!
The Engine is the central class for all tracktion sessions.
Looks after the list of groove templates.
void reload()
called when usersettings change, because that's where the grooves are kept.
BeatPosition beatsTimeToGroovyTime(BeatPosition beatsTime, float strength) const
Apply this groove to a time, in beats.
TimePosition editTimeToGroovyTime(TimePosition editTime, float strength, Edit &edit) const
Apply this groove to a time, in seconds.
#define JUCE_LEAK_DETECTOR(OwnerClass)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Represents a position in beats.
Represents a position in real-life time.