-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransmitter.h
80 lines (66 loc) · 2.25 KB
/
Transmitter.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
#pragma once
#define WDL_RESAMPLE_TYPE float
/**
* Comment this out to compile with out ssl
* Connections to a master server with ssl will fail obviously
*/
#define CPPHTTPLIB_OPENSSL_SUPPORT
#include "../thirdparty/httplib.h" // Needs to be included here because of windows socket define bullshit
#include "IPlug_include_in_plug_hdr.h"
#include "IControls.h"
#include "./src/TextControl.h"
#include "./src/TConfig.h"
#include "./src/MasterServerSession.h"
#include "./src/Types.h"
#include "thirdparty/SpeexResampler.h"
const int kNumPrograms = 1;
enum EParams {
kFrameSize = 0,
kBitRate,
kPacketLoss,
kComplexity,
kSilenceThreshold,
kNoPhaseInversion,
kVolume,
kVolumeRemote,
kBufferSize,
kNumParams
};
class Transmitter final : public iplug::Plugin {
transmitter::SpeexResampler mUp;
transmitter::SpeexResampler mDown;
bool mResamplingSetup = false;
transmitter::MasterServerSession* mMSession = nullptr;
WDL_PtrList<iplug::igraphics::IControl> mMainTab, mDirectTab;
iplug::igraphics::IVButtonControl* mMainTabButton = nullptr, * mDirectTabButton = nullptr;
iplug::igraphics::IGraphics* mGraphics = nullptr;
transmitter::TextControl* mMasterServer = nullptr;
transmitter::TextControl* mMasterPeer = nullptr;
transmitter::IVButtonControl2* mMasterId = nullptr;
transmitter::ITextControl* mOwnIp = nullptr;
transmitter::TextControl* mDirectPeer = nullptr;
int mMaxBlockSize = 512;
int mChannelCount = 2;
transmitter::sample* mSliceBufferSubIn[2];
transmitter::sample* mSliceBufferSubOut[2];
transmitter::sample** mSliceBuffer[2] = { mSliceBufferSubIn, mSliceBufferSubOut };
transmitter::sample** mResamplingBuffer = nullptr;
void switchTab(bool directTab);
void connect(bool keepId);
void setupResampling();
public:
Transmitter(const iplug::InstanceInfo& info);
~Transmitter();
void OnUIClose() override;
/**
* Called from outside when a state needs to be saved
*/
bool SerializeState(iplug::IByteChunk& chunk) const override;
/**
* Called from outside with a byte chunk to load
*/
int UnserializeState(const iplug::IByteChunk& chunk, int startPos) override;
#if IPLUG_DSP // http://bit.ly/2S64BDd
void ProcessBlock(iplug::sample** inputs, iplug::sample** outputs, int nFrames) override;
#endif
};