mirror of https://github.com/axmolengine/axmol.git
fixed #14148: Got an error while pressing home button at launch, after resuming from background, SimpileAudioEngine::playEffect will not be mute.
The error is: ERROR: [0x19e5fa000] >aurioc> 807: failed: '!pla' (enable 2, outf< 2 ch, 44100 Hz, Float32, non-inter> inf< 2 ch, 0 Hz, Float32, non-inter>)
This commit is contained in:
parent
ad25873821
commit
6efcf87b93
|
@ -353,18 +353,9 @@ static BOOL _mixerRateSet = NO;
|
|||
free(defs);
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
|
||||
//Create mutexes
|
||||
_mutexBufferLoad = [[NSObject alloc] init];
|
||||
|
||||
asynchLoadProgress_ = 0.0f;
|
||||
|
||||
bufferTotal = CD_BUFFERS_START;
|
||||
_buffers = (bufferInfo *)malloc( sizeof(_buffers[0]) * bufferTotal);
|
||||
|
||||
- (void) _lazyInitOpenAL
|
||||
{
|
||||
if (!functioning_) {
|
||||
// Initialize our OpenAL environment
|
||||
if ([self _initOpenAL]) {
|
||||
//Set up the default source group - a single group that contains all the sources
|
||||
|
@ -379,11 +370,29 @@ static BOOL _mixerRateSet = NO;
|
|||
enabled_ = YES;
|
||||
//Test whether get gain works for sources
|
||||
[self _testGetGain];
|
||||
CDLOG(@"OpenAL was initialized successfully!");
|
||||
} else {
|
||||
//Something went wrong with OpenAL
|
||||
functioning_ = NO;
|
||||
CDLOG(@"OpenAL failed to be initialized!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
|
||||
//Create mutexes
|
||||
_mutexBufferLoad = [[NSObject alloc] init];
|
||||
|
||||
asynchLoadProgress_ = 0.0f;
|
||||
|
||||
bufferTotal = CD_BUFFERS_START;
|
||||
_buffers = (bufferInfo *)malloc( sizeof(_buffers[0]) * bufferTotal);
|
||||
|
||||
[self _lazyInitOpenAL];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -506,6 +515,8 @@ static BOOL _mixerRateSet = NO;
|
|||
|
||||
@synchronized(_mutexBufferLoad) {
|
||||
|
||||
[self _lazyInitOpenAL];
|
||||
|
||||
if (!functioning_) {
|
||||
//OpenAL initialisation has previously failed
|
||||
CDLOG(@"Denshion::CDSoundEngine - Loading buffer failed because sound engine state != functioning");
|
||||
|
|
Loading…
Reference in New Issue