MythTV  master
audiooutputca.h
Go to the documentation of this file.
1 #ifndef AUDIOOUTPUTCA
2 #define AUDIOOUTPUTCA
3 
4 #include "audiooutputbase.h"
5 
6 #undef AUDBUFSIZE
7 #define AUDBUFSIZE 512000
8 
9 // We hide Core Audio-specific items, to avoid
10 // pulling in Mac-specific header files.
11 class CoreAudioData;
12 
14 {
15 public:
16  explicit AudioOutputCA(const AudioSettings &settings);
17  virtual ~AudioOutputCA();
18 
19  AudioOutputSettings* GetOutputSettings(bool digital) override; // AudioOutputBase
20  static QMap<QString, QString> *GetDevices(const char *type = nullptr);
21 
22  int64_t GetAudiotime(void) override; // AudioOutputBase
23 
24  // callback for delivering audio to output device
25  bool RenderAudio(unsigned char *aubuf, int size,
26  unsigned long long timestamp);
27 
28  // Volume control
29  int GetVolumeChannel(int channel) const override; // VolumeBase
30  void SetVolumeChannel(int channel, int volume) override; // VolumeBase
31 
32  // TODO: convert these to macros!
33  void Debug(const QString& msg)
34  { LOG(VB_AUDIO, LOG_INFO, "AudioOutputCA::" + msg); }
35 
36  void Error(const QString& msg)
37  { LOG(VB_GENERAL, LOG_ERR, "AudioOutputCA Error: " + msg); }
38 
39  void Warn(const QString& msg)
40  { LOG(VB_GENERAL, LOG_WARNING, "AudioOutputCA Warning: " + msg); }
41 
42 protected:
43 
44  // You need to implement the following functions
45  bool OpenDevice(void) override; // AudioOutputBase
46  void CloseDevice(void) override; // AudioOutputBase
47  void WriteAudio(unsigned char *aubuf, int size) override; // AudioOutputBase
48  int GetBufferedOnSoundcard(void) const override; // AudioOutputBase
49 
50  bool StartOutputThread(void) override { return true; } // AudioOutputBase
51  void StopOutputThread(void) override {} // AudioOutputBase
52 
53 private:
54 
55  CoreAudioData * d {nullptr};
56  friend class CoreAudioData;
57 
60 };
61 
62 #endif
63 
void Error(const QString &msg)
Definition: audiooutputca.h:36
void Debug(const QString &msg)
Definition: audiooutputca.h:33
int GetBufferedOnSoundcard(void) const override
Return the size in bytes of frames currently in the audio buffer adjusted with the audio playback lat...
virtual ~AudioOutputCA()
bool RenderAudio(unsigned char *aubuf, int size, unsigned long long timestamp)
Object-oriented part of callback.
long CA_audiotime_updated
Definition: audiooutputca.h:59
This holds Core Audio member variables and low-level audio IO methods The name is now a misnomer,...
static QMap< QString, QString > * GetDevices(const char *type=nullptr)
void CloseDevice(void) override
bool StartOutputThread(void) override
Definition: audiooutputca.h:50
int64_t GetAudiotime(void) override
Reimplement the base class's version of GetAudiotime() so that we don't use gettimeofday or Qt mutexe...
CoreAudioData * d
Definition: audiooutputca.h:55
AudioOutputCA(const AudioSettings &settings)
void StopOutputThread(void) override
Definition: audiooutputca.h:51
int GetVolumeChannel(int channel) const override
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
void Warn(const QString &msg)
Definition: audiooutputca.h:39
void SetVolumeChannel(int channel, int volume) override
Implements Core Audio (Mac OS X Hardware Abstraction Layer) output.
Definition: audiooutputca.h:13
AudioOutputSettings * GetOutputSettings(bool digital) override
void WriteAudio(unsigned char *aubuf, int size) override
bool OpenDevice(void) override