Overte C++ Documentation
MixedProcessedAudioStream.h
1 //
2 // MixedProcessedAudioStream.h
3 // libraries/audio/src
4 //
5 // Created by Yixin Wang on 8/4/14.
6 // Copyright 2013 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_MixedProcessedAudioStream_h
13 #define hifi_MixedProcessedAudioStream_h
14 
15 #include "InboundAudioStream.h"
16 
17 class AudioClient;
18 
19 class MixedProcessedAudioStream : public InboundAudioStream {
20  Q_OBJECT
21 public:
22  MixedProcessedAudioStream(int numFramesCapacity, int numStaticJitterFrames = -1);
23 
24 signals:
25 
26  void addedSilence(int silentSamplesPerChannel);
27  void addedLastFrameRepeatedWithFade(int samplesPerChannel);
28  void addedStereoSamples(const QByteArray& samples);
29 
30  void processSamples(const QByteArray& inputBuffer, QByteArray& outputBuffer);
31 
32 public:
33  void outputFormatChanged(int sampleRate, int channelCount);
34 
35 protected:
36  int writeDroppableSilentFrames(int silentFrames) override;
37  int parseAudioData(const QByteArray& packetAfterStreamProperties) override;
38  int lostAudioData(int numPackets) override;
39 
40 private:
41  int networkToDeviceFrames(int networkFrames);
42  int deviceToNetworkFrames(int deviceFrames);
43 
44 private:
45  quint64 _outputSampleRate;
46  quint64 _outputChannelCount;
47 };
48 
49 #endif // hifi_MixedProcessedAudioStream_h