7 #pragma once // NOLINT(build/header_guard)
11 #include "AgoraBase.h"
12 #include "AgoraRefPtr.h"
13 #include <api/cpp/aosl_ares_class.h>
17 class IAudioFrameObserver;
23 static const int kAdmMaxDeviceNameSize = 128;
24 static const int kAdmMaxGuidSize = 128;
25 static const int kIntervalInMillseconds = 200;
28 #if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
35 struct AudioDeviceInfo {
39 char deviceName[kAdmMaxDeviceNameSize];
44 char deviceTypeName[kAdmMaxDeviceNameSize];
48 char deviceId[kAdmMaxGuidSize];
54 bool isCurrentSelected;
62 AudioDeviceInfo() : isCurrentSelected(false),
63 isPlayoutDevice(true) {
64 memset(deviceName, 0,
sizeof(deviceName));
65 memset(deviceTypeName, 0,
sizeof(deviceTypeName));
66 memset(deviceId, 0,
sizeof(deviceId));
69 #endif // _WIN32 || (TARGET_OS_MAC && !TARGET_OS_IPHONE)
302 #if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
318 virtual int setDefaultAudioRouting(AudioRoute route, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
330 virtual int changeAudioRouting(AudioRoute route, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
342 virtual int setAudioRoutingSpeakerOn(
bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
354 virtual int getCurrentRouting(AudioRoute& route) = 0;
355 #endif // __ANDROID__ || TARGET_OS_IPHONE
357 #if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
368 virtual int getNumberOfPlayoutDevices() = 0;
380 virtual int getNumberOfRecordingDevices() = 0;
391 virtual AudioDeviceInfo getPlayoutDeviceInfo(
int index) = 0;
402 virtual AudioDeviceInfo getRecordingDeviceInfo(
int index) = 0;
414 virtual int setPlayoutDevice(
int index, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
426 virtual int setRecordingDevice(
int index, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
438 virtual int followSystemPlaybackDevice(
bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
451 virtual int followSystemRecordingDevice(
bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
452 #endif // _WIN32 || (TARGET_OS_MAC && !TARGET_OS_IPHONE)
466 virtual int setApplicationVolume(
unsigned int volume, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
478 virtual int getApplicationVolume(
unsigned int& volume) = 0;
492 virtual int setApplicationMuteState(
bool mute, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
504 virtual int getApplicationMuteState(
bool& mute) = 0;
515 virtual AudioDeviceInfo getLoopbackDeviceInfo(
int index) = 0;
527 virtual int setLoopbackDevice(
int index, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
539 virtual int followSystemLoopbackDevice(
bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
563 virtual int setupAudioAttributeContext(
void* audioAttr, aosl_ref_t ares = AOSL_REF_INVALID) = 0;