mirror of https://github.com/procxx/kepka.git
[Mac OS] add support native OpenAl for mac os
For this you need to add cmake arg PROCXX_USE_NATIVE_OPEN_AL
This commit is contained in:
parent
42fea7cd81
commit
3904a9e67c
|
@ -44,7 +44,10 @@ if (LINUX)
|
|||
find_package(ALSA)
|
||||
find_package(PulseAudio)
|
||||
find_package(Qt5 COMPONENTS DBus)
|
||||
else(LINUX)
|
||||
elseif(APPLE AND PROCXX_USE_NATIVE_OPEN_AL)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework OpenAL")
|
||||
set(PROCXX_USE_NATIVE_OPEN_AL_MAC 1)
|
||||
else()
|
||||
# Needs OpenAL-SOFT
|
||||
# Install via `brew install openal-soft` and configure with cmake call from README.md
|
||||
find_package(OpenAL REQUIRED NO_MODULE)
|
||||
|
|
|
@ -5,6 +5,10 @@ if (LINUX)
|
|||
else()
|
||||
add_definitions(-DQ_OS_LINUX32)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if (PROCXX_USE_NATIVE_OPEN_AL_MAC)
|
||||
add_definitions(-DPROCXX_USE_NATIVE_OPEN_AL_MAC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##================================================
|
||||
|
|
|
@ -27,9 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#include "platform/platform_audio.h"
|
||||
#include "base/task_queue.h"
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
#include "media/media_defs.h"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
|
@ -1344,8 +1342,13 @@ bool audioDeviceIsConnected() {
|
|||
if (!AudioDevice) {
|
||||
return false;
|
||||
}
|
||||
#if defined (PROCXX_USE_NATIVE_OPEN_AL_MAC)
|
||||
#pragma message ("Mac OS Native OpenAL not support ALC_EXT_disconnect")
|
||||
auto isConnected = ALint(1);
|
||||
#else
|
||||
auto isConnected = ALint(0);
|
||||
alcGetIntegerv(AudioDevice, ALC_CONNECTED, 1, &isConnected);
|
||||
#endif
|
||||
if (Audio::ContextErrorHappened()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "media/media_audio_ffmpeg_loader.h"
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
#include "media/media_defs.h"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "media/media_audio.h"
|
||||
#include "media/media_audio_loader.h"
|
||||
#include "media/media_defs.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
@ -30,8 +31,6 @@ extern "C" {
|
|||
#include <libswresample/swresample.h>
|
||||
} // extern "C"
|
||||
|
||||
#include <AL/al.h>
|
||||
|
||||
class AbstractFFMpegLoader : public AudioPlayerLoader {
|
||||
public:
|
||||
AbstractFFMpegLoader(const FileLocation &file, const QByteArray &data, base::byte_vector &&bytes) : AudioPlayerLoader(file, data, std::move(bytes)) {
|
||||
|
|
|
@ -24,9 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#include "media/media_audio.h"
|
||||
#include "messenger.h"
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
#include "media/media_defs.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Audio {
|
||||
|
|
|
@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "media/media_audio_loader.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/media_defs.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
@ -30,7 +31,6 @@ extern "C" {
|
|||
#include <libswresample/swresample.h>
|
||||
} // extern "C"
|
||||
|
||||
#include <AL/al.h>
|
||||
|
||||
struct VideoSoundData {
|
||||
AVCodecContext *context = nullptr;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
/*
|
||||
This file is part of Kepka,
|
||||
an unofficial desktop version of Telegram messaging app, see https://procxx.github.io/
|
||||
|
||||
Kepka is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
|
||||
Full license: https://github.com/procxx/kepka/blob/master/LICENSE
|
||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
Copyright (c) 2017-2018 ProCxx, https://procxx.github.io/
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if defined(PROCXX_USE_NATIVE_OPEN_AL_MAC)
|
||||
#include <OpenAL/OpenAL.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
#endif
|
Loading…
Reference in New Issue