-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathaudiofactory.h
executable file
·91 lines (82 loc) · 3.1 KB
/
audiofactory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef AUDIOFACTORY_H
#define AUDIOFACTORY_H
#include <stdlib.h>
#include <limits>
#include <QObject>
#include <QString>
#include <QVector>
#include <sndfile.hh>
#include "otwriter.h"
#define BUFFER_LENGTH 4096
#define SILENT_SLICE_NAME "--- silent slice (1 second in length outside grid mode) ---"
enum SliceMode_t { NormalMode = 0, GridMode = 1, StepsMode = 2, MegabreakMode = 3 };
enum NormalizationMode_t { None = 0, Slice = 1, Chain = 2 };
class AudioFactory : public QObject
{
Q_OBJECT
public slots:
void generateFiles();
public:
static QString getFormatString(const QString &file);
static void getStepsModeSliceCount(const int stepsPerSlice, const int tempo, bool includeTail, const QString &file, int &sliceCount, bool &hasTail);
void setUISelections(const int sampleRate,
const int bitRate,
const int channels,
const QVector<QString> sourceFiles,
const QString &outFileName,
const Loop_t loopSetting,
const Stretch_t stretchSetting,
const TrigQuant_t trigQuantSetting,
const int gain,
const int tempo,
const int steps,
const SliceMode_t sliceMode,
const NormalizationMode_t normalizationMode,
const int fadeIn,
const int fadeOut,
const bool createOTFile,
const int megabreakFiles);
void setStepsModeUISelections(const QString &sourcefile,
const Loop_t loopSetting,
const Stretch_t stretchSetting,
const TrigQuant_t trigQuantSetting,
const int gain,
const int tempo,
const int steps,
const bool includeTail);
signals:
void doneGenerating();
void fileProgress(int currentSlice, int totalSlices);
private slots:
private:
void createOutput_NormalMode();
void createOutput_GridMode();
void createOutput_StepsMode();
void createOutput_MegabreakMode();
double findNormalizationFactor(SndfileHandle *file);
void normalizeChain(const QString filename);
void createFadeCurves(const int fadeInCurveLength, const int fadeOutCurveLength, float fadeInCurve[], float fadeOutCurve[]);
int buffer[BUFFER_LENGTH];
OTWriter *otWriter;
int currentFileNo;
uint32_t currentFileStartPoint;
int sampleRate;
int bitRate;
int channels;
QVector<QString> sourceFiles;
QString outFileName;
Loop_t loopSetting;
Stretch_t stretchSetting;
TrigQuant_t trigQuantSetting;
int gain;
int tempo;
int steps;
SliceMode_t sliceMode;
NormalizationMode_t normalizationMode;
bool createOTFile;
bool includeTail;
int fadeIn_ms;
int fadeOut_ms;
int megabreakFiles;
};
#endif // AUDIOFACTORY_H