Commit 54317908 authored by Philippe Groarke's avatar Philippe Groarke Committed by Tristan Matthews

OSX: CoreAudio preliminairies

Refs #57972

Change-Id: Ic595914e590c335f9dfbb968839166dd6b0c568c
parent 55bfb0ed
......@@ -91,6 +91,11 @@ AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
AM_CONDITIONAL(HAVE_WIN64, test "${HAVE_WIN64}" = "1")
AM_CONDITIONAL(HAVE_OSX, test "${HAVE_OSX}" = "1")
dnl FIXME this should be deduced automatically
AC_DEFINE_UNQUOTED([HAVE_COREAUDIO],
`if test "${HAVE_OSX}" = "1"; then echo 1; else echo 0; fi`,
[Define if you have CoreAudio])
dnl Android is linux, but a bit different
AS_IF([test "$SYS" = linux],[
AC_MSG_CHECKING([for an Android system])
......
......@@ -52,6 +52,7 @@
#define PULSEAUDIO_API_STR "pulseaudio"
#define ALSA_API_STR "alsa"
#define JACK_API_STR "jack"
#define COREAUDIO_API_STR "coreaudio"
#define PCM_DEFAULT "default" // Default ALSA plugin
#define PCM_DSNOOP "plug:dsnoop" // Alsa plugin for microphone sharing
......
......@@ -122,6 +122,17 @@ void CoreLayer::startStream()
return;
}
int CoreLayer::getAudioDeviceIndex(const std::string& name, DeviceType type) const
{
return 0;
}
std::string CoreLayer::getAudioDeviceName(int index, DeviceType type) const
{
return "";
}
void CoreLayer::stopStream()
{
isStarted_ = false;
......
......@@ -56,6 +56,9 @@ class CoreLayer : public AudioLayer {
virtual std::vector<std::string> getCaptureDeviceList() const;
virtual std::vector<std::string> getPlaybackDeviceList() const;
virtual int getAudioDeviceIndex(const std::string& name, DeviceType type) const;
virtual std::string getAudioDeviceName(int index, DeviceType type) const;
/**
* Get the index of the audio card for capture
* @return int The index of the card used for capture
......
......@@ -47,6 +47,9 @@
#if HAVE_PULSE
#include "audio/pulseaudio/pulselayer.h"
#endif
#if HAVE_COREAUDIO
#include "audio/coreaudio/corelayer.h"
#endif
#endif /* HAVE_OPENSL */
#include <yaml-cpp/yaml.h>
......@@ -380,6 +383,15 @@ sfl::AudioLayer* AudioPreference::createAudioLayer()
checkSoundCard(alsaCardring_, sfl::DeviceType::RINGTONE);
return new sfl::AlsaLayer(*this);
#endif
#if HAVE_COREAUDIO
audioApi_ = COREAUDIO_API_STR;
try {
return new sfl::CoreLayer(*this);
} catch (const std::runtime_error &e) {
SFL_WARN("Could not create coreaudio layer. There will be no sound.");
}
#else
return NULL;
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment