Just Intonation  Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
voice.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 // Voice - a collection of scales, the acoustic static data of an instrument
22 //============================================================================
23 
24 #ifndef VOICE_H
25 #define VOICE_H
26 
27 #include <QObject>
28 #include <QVariant>
29 #include <QVector>
30 #include <QIODevice>
31 
32 #include "scale.h"
33 #include "system/shared.h"
34 
38 
39 class Voice : public QObject
40 {
41  Q_OBJECT
42 public:
43  Voice();
44 
45  void init() {}
46  void exit() {}
47 
48  void generateArtificialSound (int samplerate);
49 
50  bool write (QIODevice &iodevice);
51  bool read (QIODevice &iodevice);
52  void cancel();
53 
54  void clear();
55  bool insert (const int scale, const int key, const QVector<qint32> &L, const QVector<qint32> &R, const int sampleRate, const double amplification);
56 
57  void printInfo();
58 
59  Scale &getScale (int i) { return mScales[i]; }
60  int getNumberOfScales() const { return mScales.size(); }
61  int getSampleRate() const { return mSampleRate; }
62  int getHighestDampedKey() const { return mHighestDampedKey; }
63  bool isVolumeDynamic() const { return mDynamicVolume; }
64 
65  double getRecordedPitch(int key) const { return mRecordedPitchInCents[key]; }
66 
67  static int mVerbosity;
68  void setVerbosity (int verbosity) { mVerbosity=verbosity; }
69 signals:
70  void setProgressText (QVariant text);
71  void setProgress (QVariant percent);
73 
74 protected:
78  QVector<Scale> mScales;
79  QVector<double> mRecordedPitchInCents;
80 };
81 
82 #endif // VOICE_H
void cancel()
Definition: voice.cpp:172
int mHighestDampedKey
Definition: voice.h:76
int getHighestDampedKey() const
Definition: voice.h:62
void generateArtificialSound(int samplerate)
Definition: voice.cpp:58
Voice - a set of scales, keeping the acoustic data of an instrument.
Definition: voice.h:39
bool mDynamicVolume
Definition: voice.h:77
void setProgressText(QVariant text)
bool isVolumeDynamic() const
Definition: voice.h:63
static int mVerbosity
Verbosity of qDebug() message.
Definition: voice.h:67
bool write(QIODevice &iodevice)
Definition: voice.cpp:76
void exit()
Definition: voice.h:46
Scale - a set of PCM waves with a characteristic intensity and length.
Definition: scale.h:46
void printInfo()
Definition: voice.cpp:193
void clear()
Definition: voice.cpp:182
void init()
Definition: voice.h:45
Scale & getScale(int i)
Definition: voice.h:59
double getRecordedPitch(int key) const
Definition: voice.h:65
void setVerbosity(int verbosity)
Definition: voice.h:68
Voice()
Constructor.
Definition: voice.cpp:45
int getSampleRate() const
Definition: voice.h:61
void signalArtificialSoundGenerationComplete(bool)
bool insert(const int scale, const int key, const QVector< qint32 > &L, const QVector< qint32 > &R, const int sampleRate, const double amplification)
int getNumberOfScales() const
Definition: voice.h:60
int mSampleRate
Definition: voice.h:75
bool read(QIODevice &iodevice)
Definition: voice.cpp:117
void setProgress(QVariant percent)
QVector< double > mRecordedPitchInCents
Definition: voice.h:79
QVector< Scale > mScales
Definition: voice.h:78