kodi
AESinkDARWINIOS.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  float currentPhase;
19  float phaseIncrement;
20 } SineWaveGenerator;
21 #endif
22 
23 class AERingBuffer;
24 class CAAudioUnitSink;
25 
26 class CAESinkDARWINIOS : public IAESink
27 {
28 public:
29  const char* GetName() override { return "DARWINIOS"; }
30 
32  ~CAESinkDARWINIOS() override = default;
33 
34  static void Register();
35  static void EnumerateDevicesEx(AEDeviceInfoList &list, bool force);
36  static std::unique_ptr<IAESink> Create(std::string& device, AEAudioFormat& desiredFormat);
37 
38  bool Initialize(AEAudioFormat& format, std::string& device) override;
39  void Deinitialize() override;
40 
41  void GetDelay(AEDelayStatus& status) override;
42  double GetCacheTotal() override;
43  unsigned int AddPackets(uint8_t** data, unsigned int frames, unsigned int offset) override;
44  void Drain() override;
45  bool HasVolume() override;
46 
47 private:
48  static AEDeviceInfoList m_devices;
49  CAEDeviceInfo m_info;
50  AEAudioFormat m_format;
51 
52  CAAudioUnitSink *m_audioSink;
53 #if DO_440HZ_TONE_TEST
54  SineWaveGenerator m_SineWaveGenerator;
55 #endif
56 };
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: AESinkDARWINIOS.mm:712
This classt provides the details of what the audio output hardware is capable of. ...
Definition: AEDeviceInfo.h:31
void GetDelay(AEDelayStatus &status) override
Return a timestamped status structure with delay and sink info.
Definition: AESinkDARWINIOS.mm:697
Definition: AESink.h:18
The audio format structure that fully defines a stream&#39;s audio information.
Definition: AEAudioFormat.h:19
Definition: AEUtil.h:27
Definition: AESinkDARWINIOS.mm:80
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
Definition: AESinkDARWINIOS.h:26