forked from AgoraIO/API-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAudioProcessor.hpp
More file actions
44 lines (36 loc) · 1.23 KB
/
AudioProcessor.hpp
File metadata and controls
44 lines (36 loc) · 1.23 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
44
//
// Created by DYF on 2020/7/13.
//
#ifndef AGORA_AUDIOPROCESSOR_H
#define AGORA_AUDIOPROCESSOR_H
#include <thread>
#include <string>
#include <mutex>
#include <vector>
#include <AgoraRtcKit/AgoraRefPtr.h>
#include "AgoraRtcKit/NGIAgoraMediaNode.h"
#include "AgoraRtcKit/AgoraMediaBase.h"
#include "AgoraRtcKit/AgoraExtensions.h"
namespace agora {
namespace extension {
class AdjustVolumeAudioProcessor : public RefCountInterface {
public:
int processFrame(const agora::media::base::AudioPcmFrame &audioPcmFrame,
media::base::AudioPcmFrame& adaptedPcmFrame);
void dataCallback(const char* data);
void setVolume(int volume) { volume_ = volume / 100.0f; }
int setExtensionControl(agora::agora_refptr<rtc::IExtensionVideoFilter::Control> control){
control_ = control;
return 0;
};
protected:
~AdjustVolumeAudioProcessor() {}
private:
static int16_t FloatS16ToS16(float v);
private:
std::atomic<float> volume_ = {1.0f};
agora::agora_refptr<rtc::IExtensionVideoFilter::Control> control_;
};
}
}
#endif //AGORA_AUDIOPROCESSOR_H