Just Intonation  Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
tone.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3  *
4  * This file is part of JustIntonation.
5  *
6  * JustIntonation is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * JustIntonation is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with JustIntonation. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
20 //=============================================================================
21 // Tone
22 //=============================================================================
23 
24 #ifndef TONE_H
25 #define TONE_H
26 
27 #include <QtGlobal>
28 
29 #include "instrument/wave.h"
30 
44 
45 class Tone
46 {
47 public:
48  enum Type
49  {
54  };
55 
56  enum State
57  {
58  IDLE,
64  };
65 
66 
67 public:
68  Tone();
69  Tone (int key, int scaleindex, Wave &sample, double volume, Type type=UNDEFINED);
70 
71  friend class Sampler;
72  friend class SoundGenerator;
73  friend class TuningManager;
74 
75  Wave &getSample() { return *pSample; }
76 
77 private:
79  int mKey;
80  quint32 mTime;
81 
82  double mVolume;
83 
84  qint16 left,right;
85 
89 };
90 
91 #endif // TONE_H
int mKey
Key index (Midi) ranging from 0 to 127.
Definition: tone.h:79
Class managing the generation of sound.
Class holding the sampled sound for one key.
Definition: wave.h:49
Tone()
Defautl constructor, resetting the member variables.
Definition: tone.cpp:35
qint16 right
store last PCM values, init to zero
Definition: tone.h:84
quint32 mTime
time in units of 1/4096/SampleRate sec
Definition: tone.h:80
Sound that ends when the key is released.
Definition: tone.h:50
double mVolume
overall volume ranging from 0 to 1
Definition: tone.h:82
Release mode: tone is decaying.
Definition: tone.h:61
Sound that does not end when key is release (keys without damper)
Definition: tone.h:51
int mScaleIndex
Index to the used scale.
Definition: tone.h:88
Class describing a tone that is currently being played.
Definition: tone.h:45
Type
Definition: tone.h:48
State
Definition: tone.h:56
friend class TuningManager
TuningManager class is allowed to access private elements.
Definition: tone.h:73
Wave * pSample
Pointer to the wave.
Definition: tone.h:86
Tone has terminated and can be removed from the queue.
Definition: tone.h:63
Wave & getSample()
Definition: tone.h:75
qint16 left
Definition: tone.h:84
State mState
Phase in which the tone is playing.
Definition: tone.h:78
Type mType
Type of the wave.
Definition: tone.h:87
Sound-generating module which plays the tones held by the SoundGenerator.
Definition: sampler.h:57
Sound that occurs in the moment when the key is released.
Definition: tone.h:52
Undefined.
Definition: tone.h:58
non defined
Definition: tone.h:53
Tone is playing a special off-sound after key has been released.
Definition: tone.h:62
Tone is playing in normal mode.
Definition: tone.h:59
The key has been released. Tone is requested to switch to the release mode.
Definition: tone.h:60