Overte C++ Documentation
AbstractAudioInterface.h
1 //
2 // AbstractAudioInterface.h
3 // libraries/audio/src
4 //
5 // Created by Brad Hefta-Gaub on 12/4/13.
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_AbstractAudioInterface_h
13 #define hifi_AbstractAudioInterface_h
14 
15 #include <QtCore/QObject>
16 #include <QtMultimedia/qaudiooutput.h>
17 
18 #include <udt/PacketHeaders.h>
19 
20 #include "AudioInjectorOptions.h"
21 #include "AudioInjector.h"
22 #include "AudioSolo.h"
23 
24 class AudioInjector;
25 class AudioInjectorLocalBuffer;
26 class Transform;
27 
28 class AbstractAudioInterface : public QObject {
29  Q_OBJECT
30 public:
31  AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {};
32 
33  static void emitAudioPacket(const void* audioData, size_t bytes, quint16& sequenceNumber, bool isStereo,
34  const Transform& transform, glm::vec3 avatarBoundingBoxCorner, glm::vec3 avatarBoundingBoxScale,
35  PacketType packetType, QString codecName = QString(""));
36 
37  // threadsafe
38  // moves injector->getLocalBuffer() to another thread (so removes its parent)
39  // take care to delete it when ~AudioInjector, as parenting Qt semantics will not work
40  virtual bool outputLocalInjector(const AudioInjectorPointer& injector) = 0;
41 
42  virtual AudioSolo& getAudioSolo() = 0;
43 
44 public slots:
45  virtual bool shouldLoopbackInjectors() { return false; }
46 
47  virtual bool setIsStereoInput(bool stereo) = 0;
48  virtual bool isStereoInput() = 0;
49 
50  virtual bool getLocalEcho() = 0;
51  virtual void setLocalEcho(bool localEcho) = 0;
52  virtual void toggleLocalEcho() = 0;
53 
54  virtual bool getServerEcho() = 0;
55  virtual void setServerEcho(bool serverEcho) = 0;
56  virtual void toggleServerEcho() = 0;
57 
58 signals:
59  void isStereoInputChanged(bool isStereo);
60 };
61 
62 Q_DECLARE_METATYPE(AbstractAudioInterface*)
63 
64 #endif // hifi_AbstractAudioInterface_h