Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
Tone Class Reference

Class describing a tone that is currently being played. More...

#include <tone.h>

Collaboration diagram for Tone:
Collaboration graph

Public Types

enum  Type { SUSTAIN_ENDING, SUSTAIN_NONENDING, RELEASETONE, UNDEFINED }
 
enum  State {
  IDLE, PLAYING, RELEASE_REQUESTED, RELEASED,
  OFF_PLAYING, TERMINATED
}
 

Public Member Functions

 Tone ()
 Defautl constructor, resetting the member variables. More...
 
 Tone (int key, int scaleindex, Wave &sample, double volume, Type type=UNDEFINED)
 Constructor of a Tone which allows to set certain properties. More...
 
WavegetSample ()
 

Private Attributes

State mState
 Phase in which the tone is playing. More...
 
int mKey
 Key index (Midi) ranging from 0 to 127. More...
 
quint32 mTime
 time in units of 1/4096/SampleRate sec More...
 
double mVolume
 overall volume ranging from 0 to 1 More...
 
qint16 left
 
qint16 right
 store last PCM values, init to zero More...
 
WavepSample
 Pointer to the wave. More...
 
Type mType
 Type of the wave. More...
 
int mScaleIndex
 Index to the used scale. More...
 

Friends

class Sampler
 Sampler class is allowed to access private elements. More...
 
class SoundGenerator
 SoundGenerator class is allowed to access private elements. More...
 
class TuningManager
 TuningManager class is allowed to access private elements. More...
 

Detailed Description

Class describing a tone that is currently being played.

This class describes the properties of a tone that is currently played by the Sampler.

The microtonal tuning is controlled by two essential variables named mTime and mIncrement. The standard value of mIncrement is 0x1000=4096 which corresponds to the standard frequency of the tone. For each frame (i.e. for each PCM value) the sampler increases the mTime-Variable by mIncrement. Microtonal tuning is achieved by changing mIncrement. For example, going from 0x1000 to 0x1001 the frequency in increased by the ratio 1/0x1000 = 1/4096.

Definition at line 45 of file tone.h.

Member Enumeration Documentation

Enumerator
IDLE 

Undefined.

PLAYING 

Tone is playing in normal mode.

RELEASE_REQUESTED 

The key has been released. Tone is requested to switch to the release mode.

RELEASED 

Release mode: tone is decaying.

OFF_PLAYING 

Tone is playing a special off-sound after key has been released.

TERMINATED 

Tone has terminated and can be removed from the queue.

Definition at line 56 of file tone.h.

enum Tone::Type
Enumerator
SUSTAIN_ENDING 

Sound that ends when the key is released.

SUSTAIN_NONENDING 

Sound that does not end when key is release (keys without damper)

RELEASETONE 

Sound that occurs in the moment when the key is released.

UNDEFINED 

non defined

Definition at line 48 of file tone.h.

Constructor & Destructor Documentation

Tone::Tone ( )

Defautl constructor, resetting the member variables.

Definition at line 35 of file tone.cpp.

Tone::Tone ( int  key,
int  scaleindex,
Wave sample,
double  volume,
Type  type = UNDEFINED 
)

Constructor of a Tone which allows to set certain properties.

Parameters
key: Number of the key in MIDI norm (0..127)
scaleindex: Number of the scale from which the waveform is loaded
sample: Reference to the waveform (redundant but for performance)
volume: Volume of the tone
type: Type of the tone
See also
Type

Definition at line 63 of file tone.cpp.

Member Function Documentation

Wave& Tone::getSample ( )
inline

Definition at line 75 of file tone.h.

Friends And Related Function Documentation

friend class Sampler
friend

Sampler class is allowed to access private elements.

Definition at line 71 of file tone.h.

friend class SoundGenerator
friend

SoundGenerator class is allowed to access private elements.

Definition at line 72 of file tone.h.

friend class TuningManager
friend

TuningManager class is allowed to access private elements.

Definition at line 73 of file tone.h.

Member Data Documentation

qint16 Tone::left
private

Definition at line 84 of file tone.h.

int Tone::mKey
private

Key index (Midi) ranging from 0 to 127.

Definition at line 79 of file tone.h.

int Tone::mScaleIndex
private

Index to the used scale.

Definition at line 88 of file tone.h.

State Tone::mState
private

Phase in which the tone is playing.

Definition at line 78 of file tone.h.

quint32 Tone::mTime
private

time in units of 1/4096/SampleRate sec

Definition at line 80 of file tone.h.

Type Tone::mType
private

Type of the wave.

Definition at line 87 of file tone.h.

double Tone::mVolume
private

overall volume ranging from 0 to 1

Definition at line 82 of file tone.h.

Wave* Tone::pSample
private

Pointer to the wave.

Definition at line 86 of file tone.h.

qint16 Tone::right
private

store last PCM values, init to zero

Definition at line 84 of file tone.h.


The documentation for this class was generated from the following files: