Skip to content

Commit 2ec1683

Browse files
committed
Allow OALAudioSession in Android OpenALManager
Call AlcSuspend() and AlcResume()
1 parent 0d86b65 commit 2ec1683

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

external/ObjectAL/OpenAL/OpenALManager.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,15 @@ - (id) init
175175

176176
operationQueue = [[NSOperationQueue alloc] init];
177177

178-
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
179178
[[OALAudioSession sharedInstance] addSuspendListener:self];
180-
#endif
181179
}
182180
return self;
183181
}
184182

185183
- (void) dealloc
186184
{
187185
OAL_LOG_DEBUG(@"%@: Dealloc", self);
188-
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
189186
[[OALAudioSession sharedInstance] removeSuspendListener:self];
190-
#endif
191187

192188
as_release(operationQueue);
193189
as_release(suspendHandler);
@@ -330,12 +326,18 @@ - (void) setSuspended:(bool) value
330326
{
331327
if(value)
332328
{
329+
#if __CC_PLATFORM_ANDROID
330+
alcSuspend();
331+
#endif
333332
[ALWrapper makeContextCurrent:nil];
334333
}
335334
else
336335
{
337336
[ALWrapper makeContextCurrent:self.realCurrentContext.context
338337
deviceReference:self.realCurrentContext.device.device];
338+
#if __CC_PLATFORM_ANDROID
339+
alcResume();
340+
#endif
339341
}
340342
}
341343

0 commit comments

Comments
 (0)