HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
AppleAudio.h
Go to the documentation of this file.
1#pragma once
2#if defined(__APPLE__)
3#include "HephAudioShared.h"
4#include "NativeAudio.h"
7#include <CoreAudio/CoreAudio.h>
8
11namespace HephAudio
12{
13 namespace Native
14 {
19 class HEPH_API AppleAudio final : public NativeAudio
20 {
21 public:
22 using NativeAudio::InitializeRender;
23 using NativeAudio::InitializeCapture;
24
25 private:
26 AudioDeviceIOProcID renderProcID;
27 AudioDeviceIOProcID captureProcID;
28
29 public:
32
33 AppleAudio(const AppleAudio&) = delete;
34 AppleAudio& operator=(const AppleAudio&) = delete;
35
38
39 void SetMasterVolume(double volume) override;
40 double GetMasterVolume() const override;
41 void InitializeRender(AudioDevice* device, AudioFormatInfo format) override;
42 void StopRendering() override;
43 void InitializeCapture(AudioDevice* device, AudioFormatInfo format) override;
44 void StopCapturing() override;
45 void GetNativeParams(NativeAudioParams& nativeParams) const override;
46 void SetNativeParams(const NativeAudioParams& nativeParams) override;
47
48 private:
49 bool EnumerateAudioDevices() override;
50 void ToStreamDesc(const AudioFormatInfo& format, AudioStreamBasicDescription& streamDesc) const;
51 void FromStreamDesc(AudioFormatInfo& format, const AudioStreamBasicDescription& streamDesc) const;
52 static OSStatus RenderCallback(AudioDeviceID device, const AudioTimeStamp* now, const AudioBufferList* indata, const AudioTimeStamp* intime, AudioBufferList* outdata, const AudioTimeStamp* outtime, void* udata);
53 static OSStatus CaptureCallback(AudioDeviceID device, const AudioTimeStamp* now, const AudioBufferList* indata, const AudioTimeStamp* intime, AudioBufferList* outdata, const AudioTimeStamp* outtime, void* udata);
54 };
55 }
56}
57#endif
#define HEPH_API
Definition HephShared.h:132
uses CoreAudio
Definition AppleAudio.h:20
void InitializeCapture(AudioDevice *device, AudioFormatInfo format) override
void SetMasterVolume(double volume) override
void GetNativeParams(NativeAudioParams &nativeParams) const override
void SetNativeParams(const NativeAudioParams &nativeParams) override
void InitializeRender(AudioDevice *device, AudioFormatInfo format) override
double GetMasterVolume() const override
base class for the classes that interact with the native audio APIs.
Definition NativeAudio.h:28
stores information about an audio device.
Definition AudioDevice.h:76
stores the properties of the audio signals
Definition AudioFormatInfo.h:20
base class for storing the native audio API specific parameters.
Definition NativeAudioParams.h:15