xbmc
AESinkDARWINTVOS.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "cores/AudioEngine/Interfaces/AESink.h"
12 #include "cores/AudioEngine/Utils/AEDeviceInfo.h"
13 
14 #define DO_440HZ_TONE_TEST 0
15 
16 #if DO_440HZ_TONE_TEST
17 typedef struct
18 {
19  float currentPhase;
20  float phaseIncrement;
21 } SineWaveGenerator;
22 #endif
23 
24 class AERingBuffer;
25 class CAAudioUnitSink;
26 
27 class CAESinkDARWINTVOS : public IAESink
28 {
29 public:
30  const char* GetName() override { return "DARWINTVOS"; }
31 
33  ~CAESinkDARWINTVOS() override = default;
34 
35  static void Register();
36  static void EnumerateDevicesEx(AEDeviceInfoList& list, bool force);
37  static IAESink* Create(std::string& device, AEAudioFormat& desiredFormat);
38 
39  bool Initialize(AEAudioFormat& format, std::string& device) override;
40  void Deinitialize() override;
41 
42  void GetDelay(AEDelayStatus& status) override;
43  double GetCacheTotal() override;
44  unsigned int AddPackets(uint8_t** data, unsigned int frames, unsigned int offset) override;
45  void Drain() override;
46  bool HasVolume() override;
47 
48 private:
49  static AEDeviceInfoList m_devices;
50  CAEDeviceInfo m_info;
51  AEAudioFormat m_format;
52 
53  CAAudioUnitSink* m_audioSink = nullptr;
54 #if DO_440HZ_TONE_TEST
55  SineWaveGenerator m_SineWaveGenerator;
56 #endif
57 };
This classt provides the details of what the audio output hardware is capable of. ...
Definition: AEDeviceInfo.h:31
unsigned int AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) override
Adds packets to be sent out, this routine MUST block or sleep.
Definition: AESinkDARWINTVOS.mm:852
void GetDelay(AEDelayStatus &status) override
Return a timestamped status structure with delay and sink info.
Definition: AESinkDARWINTVOS.mm:837
Definition: AESinkDARWINTVOS.h:27
Definition: AESink.h:18
The audio format structure that fully defines a stream's audio information.
Definition: AEAudioFormat.h:19
Definition: AEUtil.h:27
Definition: AESinkDARWINIOS.mm:79
This buffer can be used by one read and one write thread at any one time without the risk of data cor...
Definition: AERingBuffer.h:29