-
Notifications
You must be signed in to change notification settings - Fork 0
/
frontSoundTouch.h
86 lines (71 loc) · 2.12 KB
/
frontSoundTouch.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
#ifndef FRONTSOUNDTOUCH_H
#define FRONTSOUNDTOUCH_H
#include <QObject>
#include<QTimer>
#include <QString>
#include <windows.h>
#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
#include "sndfile.h"
#include "portaudio.h"
#include "SoundTouch.h"
#include "BPMDetect.h"
#include "STTypes.h"
#include <QTime>
class frontSoundTouch : public QObject
{
Q_OBJECT
private:
SNDFILE *file;
soundtouch::SoundTouch pSoundTouch;
QTimer *fillBufferTimer;
PaStream *stream = NULL;
struct posReadFrame {
long long fileFrameReadBottom;
long long fileFrameReadTop;
long long playFrameReadBottom;
long long playFrameReadTop;
};
QList <posReadFrame> listOfBlock;
QTime currTimePlayed;
QString currFileName = "";
long long currFileFrameRead;
long long currPlayFrameRead;
long long currPlayedFrameRead;
bool isfileOpen = false;
bool isPaused = true;
long getMemBuffer(float *out,unsigned long framesPerBuffer);
void garbageListOfBlock();
long long toFrameOrig(long long frameToConvert);
void frameToTime(long long frameToConvert, QTime *currentTime);
long long totalFrames;
public:
frontSoundTouch();
~frontSoundTouch();
static int paCallback( const void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *file
);
long long setFilename(QString fileName);
bool play();
void seek(long long frameToStart);
void seek(double percentOfFile );
void pause();
void setTempo(int tempo);
void setPitchSemiTones(int semiTone);
void setOctava(int octava);
float getBPM();
long long getCurrentReadFrame();
void getCurrentReadTime(QTime *currentTime);
long long framesOfFile();
bool bypassStrech = false;
int currTempo;
int currSemiTone;
int currOctava;
public slots:
void insertIntoMemBuffer();
signals:
void processed(double num);
};
#endif // FRONTSOUNDTOUCH_H