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);
|
free(defs);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)init
|
- (void) _lazyInitOpenAL
|
||||||
{
|
{
|
||||||
if ((self = [super init])) {
|
if (!functioning_) {
|
||||||
|
|
||||||
//Create mutexes
|
|
||||||
_mutexBufferLoad = [[NSObject alloc] init];
|
|
||||||
|
|
||||||
asynchLoadProgress_ = 0.0f;
|
|
||||||
|
|
||||||
bufferTotal = CD_BUFFERS_START;
|
|
||||||
_buffers = (bufferInfo *)malloc( sizeof(_buffers[0]) * bufferTotal);
|
|
||||||
|
|
||||||
// Initialize our OpenAL environment
|
// Initialize our OpenAL environment
|
||||||
if ([self _initOpenAL]) {
|
if ([self _initOpenAL]) {
|
||||||
//Set up the default source group - a single group that contains all the sources
|
//Set up the default source group - a single group that contains all the sources
|
||||||
|
@ -379,11 +370,29 @@ static BOOL _mixerRateSet = NO;
|
||||||
enabled_ = YES;
|
enabled_ = YES;
|
||||||
//Test whether get gain works for sources
|
//Test whether get gain works for sources
|
||||||
[self _testGetGain];
|
[self _testGetGain];
|
||||||
|
CDLOG(@"OpenAL was initialized successfully!");
|
||||||
} else {
|
} else {
|
||||||
//Something went wrong with OpenAL
|
//Something went wrong with OpenAL
|
||||||
functioning_ = NO;
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -506,6 +515,8 @@ static BOOL _mixerRateSet = NO;
|
||||||
|
|
||||||
@synchronized(_mutexBufferLoad) {
|
@synchronized(_mutexBufferLoad) {
|
||||||
|
|
||||||
|
[self _lazyInitOpenAL];
|
||||||
|
|
||||||
if (!functioning_) {
|
if (!functioning_) {
|
||||||
//OpenAL initialisation has previously failed
|
//OpenAL initialisation has previously failed
|
||||||
CDLOG(@"Denshion::CDSoundEngine - Loading buffer failed because sound engine state != functioning");
|
CDLOG(@"Denshion::CDSoundEngine - Loading buffer failed because sound engine state != functioning");
|
||||||
|
|
Loading…
Reference in New Issue