-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDJAudioPlayer.h
More file actions
43 lines (35 loc) · 1.52 KB
/
DJAudioPlayer.h
File metadata and controls
43 lines (35 loc) · 1.52 KB
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
/*
==============================================================================
DJAudioPlayer.h
Created: 21 Aug 2021 10:02:45pm
Author: ferna
==============================================================================
*/
#pragma once
#include "../JuceLibraryCode/JuceHeader.h"
class DJAudioPlayer : public AudioSource { //public IIRFilterAudioSource
public:
DJAudioPlayer(AudioFormatManager& _formatManager);
~DJAudioPlayer();
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override;
void getNextAudioBlock(const AudioSourceChannelInfo& bufferToFill) override;
void releaseResources() override;
void loadURL(URL audioURL);
void setGain(double gain);
void setSpeed(double ratio);
void setPosition(double posInSecs);
void setPositionRelative(double pos);
/**Receives reading from slider and sets new coefficient to modify the source */
void filterAudio(double var);
void start();
void stop();
/**Get the relative position of the playhead*/
double getPositionRelative();
private:
AudioFormatManager& formatManager;
std::unique_ptr<AudioFormatReaderSource> readerSource;
AudioTransportSource transportSource;
ResamplingAudioSource resampleSource{&transportSource, false, 2};
/**Filter object created to modify the source*/
IIRFilterAudioSource filterSource{&resampleSource,false};
};