mirror of https://github.com/axmolengine/axmol.git
Add alconfig.h to choose whether use openal-soft
This commit is contained in:
parent
2163f9c440
commit
82314c2972
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "audio/include/AudioMacros.h"
|
||||
#include "audio/include/alconfig.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
void _updateLocked(float dt);
|
||||
void _play2d(AudioCache *cache, AUDIO_ID audioID);
|
||||
ALuint findValidSource();
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && !CC_USE_ALSOFT_ON_APPLE
|
||||
#if !CC_USE_ALSOFT
|
||||
static ALvoid myAlSourceNotificationCallback(ALuint sid, ALuint notificationID, ALvoid* userData);
|
||||
#endif
|
||||
ALuint _alSources[MAX_AUDIOINSTANCES];
|
||||
|
|
|
@ -84,17 +84,3 @@ do { \
|
|||
|
||||
#define AUDIO_ID int
|
||||
#define AUDIO_ID_PRID "%d"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && !CC_USE_ALSOFT_ON_APPLE
|
||||
#import <OpenAL/al.h>
|
||||
#define MAX_AUDIOINSTANCES 24
|
||||
#else
|
||||
#ifdef OPENAL_PLAIN_INCLUDES
|
||||
#include <al.h>
|
||||
#include <alext.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alext.h>
|
||||
#endif
|
||||
#define MAX_AUDIOINSTANCES 32
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "audio/include/AudioMacros.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "audio/include/alconfig.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -60,7 +61,7 @@ protected:
|
|||
void setCache(AudioCache* cache);
|
||||
void rotateBufferThread(int offsetFrame);
|
||||
bool play2d();
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && !CC_USE_ALSOFT_ON_APPLE
|
||||
#if !CC_USE_ALSOFT
|
||||
void wakeupRotateThread();
|
||||
#endif
|
||||
|
||||
|
@ -84,7 +85,7 @@ protected:
|
|||
std::mutex _sleepMutex;
|
||||
bool _timeDirty;
|
||||
bool _isRotateThreadExited;
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && !CC_USE_ALSOFT_ON_APPLE
|
||||
#if !CC_USE_ALSOFT
|
||||
std::atomic_bool _needWakeupRotateThread;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2020 c4games.com.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#ifndef CC_USE_ALSOFT_ON_APPLE
|
||||
#define CC_USE_ALSOFT_ON_APPLE 0
|
||||
#endif
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && !CC_USE_ALSOFT_ON_APPLE
|
||||
#import <OpenAL/al.h>
|
||||
#define MAX_AUDIOINSTANCES 24
|
||||
#define CC_USE_ALSOFT 0
|
||||
#else
|
||||
#ifdef OPENAL_PLAIN_INCLUDES
|
||||
#include <al.h>
|
||||
#include <alext.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alext.h>
|
||||
#endif
|
||||
#define MAX_AUDIOINSTANCES 32
|
||||
#define CC_USE_ALSOFT 1
|
||||
#endif
|
|
@ -123,10 +123,5 @@ THE SOFTWARE.
|
|||
#define CC_USE_GLES_ON_DESKTOP 1
|
||||
#endif
|
||||
|
||||
// whether use https://github.com/kcat/openal-soft on apple platform
|
||||
#ifndef CC_USE_ALSOFT_ON_APPLE
|
||||
#define CC_USE_ALSOFT_ON_APPLE 0
|
||||
#endif
|
||||
|
||||
/// @endcond
|
||||
#endif // __BASE_CC_PLATFORM_CONFIG_H__
|
||||
|
|
Loading…
Reference in New Issue