Skip to content

Commit 3df59dc

Browse files
committed
Merge branch 'headless-develop' of github.com:spritebuilder/cocos2d-swift into headless-develop
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
2 parents e14bf17 + a766c82 commit 3df59dc

File tree

8 files changed

+234
-66
lines changed

8 files changed

+234
-66
lines changed

cocos2d-ios.xcodeproj/project.pbxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2319,8 +2319,8 @@
23192319
buildConfigurationList = D2FEB74C194F6C9E00FC0574 /* Build configuration list for PBXNativeTarget "cocos2dAndroid" */;
23202320
buildPhases = (
23212321
D2FEB610194F6C9E00FC0574 /* Headers */,
2322-
D2FEB6B8194F6C9E00FC0574 /* Sources */,
23232322
D2FEB740194F6C9E00FC0574 /* Frameworks */,
2323+
D2FEB6B8194F6C9E00FC0574 /* Sources */,
23242324
);
23252325
buildRules = (
23262326
);
@@ -3023,6 +3023,8 @@
30233023
"$(SRCROOT)/external/Chipmunk/include",
30243024
"$(SRCROOT)/external/Chipmunk/objectivec/include",
30253025
"$(SRCROOT)/external/ObjectAL/**",
3026+
"$(SRCROOT)/external/tremor/include",
3027+
"$(SRCROOT)/external/ogg/include",
30263028
);
30273029
LIBRARY_SEARCH_PATHS = (
30283030
"$(inherited)",
@@ -3068,6 +3070,8 @@
30683070
"$(SRCROOT)/external/Chipmunk/include",
30693071
"$(SRCROOT)/external/Chipmunk/objectivec/include",
30703072
"$(SRCROOT)/external/ObjectAL/**",
3073+
"$(SRCROOT)/external/tremor/include",
3074+
"$(SRCROOT)/external/ogg/include",
30713075
);
30723076
LIBRARY_SEARCH_PATHS = (
30733077
"$(inherited)",

external/ObjectAL/AudioTrack/OALAudioTrack.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ - (void) dealloc
257257
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
258258
player.delegate = nil;
259259
#elif __CC_PLATFORM_ANDROID
260-
#warning missing delegate from android media player
260+
[player setOnCompletionListener:nil];
261261
#endif
262262
[player stop];
263263

@@ -897,7 +897,6 @@ - (bool) play
897897
[player seekToMsec:(int32_t)(currentTime * 1000)];
898898
}
899899
[self _updateVolume];
900-
#warning FIXME
901900
[player setLooping:(-1 == numberOfLoops) ? YES : NO];
902901
paused = NO;
903902
[player start];
@@ -929,7 +928,6 @@ - (bool) playAtTime:(NSTimeInterval) time
929928
[player stop];
930929
[player seekToMsec:(int32_t)(currentTime * 1000)];
931930
[self _updateVolume];
932-
#warning FIXME looping
933931
[player setLooping:(-1 == numberOfLoops) ? YES : NO];
934932
paused = NO;
935933
[player start];

external/ObjectAL/OALSimpleAudio.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ - (void) setPaused:(bool) value
313313
- (bool) honorSilentSwitch
314314
{
315315
#if ANDROID
316-
#warning TODO: FIXME
316+
#warning honorSilentSwitch not implemented
317317
return false;
318318
#else
319319
return [OALAudioSession sharedInstance].honorSilentSwitch;
@@ -323,7 +323,7 @@ - (bool) honorSilentSwitch
323323
- (void) setHonorSilentSwitch:(bool) value
324324
{
325325
#if ANDROID
326-
#warning TODO: FIXME
326+
#warning setHonorSilentSwitch not implemented
327327
#else
328328
[OALAudioSession sharedInstance].honorSilentSwitch = value;
329329
#endif
@@ -659,7 +659,7 @@ - (void) unloadAllEffects
659659
return nil;
660660
}
661661

662-
#if __CC_PLATFORM_ANDROID
662+
#if 0 // __CC_PLATFORM_ANDROID
663663
// TODO: we are creating a player and throwing it away each time, and not taking into account if it was preloaded.
664664
// think about checking for preload and implement the player's asyncPrepare finish listener
665665
AndroidAssetFileDescriptor *assetFd = [[[CCActivity currentActivity] assets] openFdWithFileName:filePath];
@@ -730,7 +730,7 @@ - (void) resetToDefault
730730
- (bool) manuallySuspended
731731
{
732732
#if ANDROID
733-
#warning TODO: FIXME
733+
#warning manuallySuspended not implemented
734734
return false;
735735
#else
736736
return [OALAudioSession sharedInstance].manuallySuspended;
@@ -740,7 +740,7 @@ - (bool) manuallySuspended
740740
- (void) setManuallySuspended:(bool) value
741741
{
742742
#if ANDROID
743-
#warning TODO: FIXME
743+
#warning setManuallySuspended not implemented
744744
#else
745745
[OALAudioSession sharedInstance].manuallySuspended = value;
746746
#endif
@@ -749,7 +749,7 @@ - (void) setManuallySuspended:(bool) value
749749
- (bool) interrupted
750750
{
751751
#if ANDROID
752-
#warning TODO: FIXME
752+
#warning interrupted not implemented
753753
return false;
754754
#else
755755
return [OALAudioSession sharedInstance].interrupted;
@@ -759,7 +759,7 @@ - (bool) interrupted
759759
- (bool) suspended
760760
{
761761
#if ANDROID
762-
#warning TODO: FIXME
762+
#warning suspended not implemented
763763
return false;
764764
#else
765765
return [OALAudioSession sharedInstance].suspended;

external/ObjectAL/OpenAL/OpenALManager.m

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,8 @@ - (void) dealloc
121121

122122
- (void)main
123123
{
124-
#if ANDROID
125-
#warning TODO: FIXME
126-
#else
127124
ALBuffer* buffer = [OALAudioFile bufferFromUrl:url reduceToMono:reduceToMono];
128125
[target performSelectorOnMainThread:selector withObject:buffer waitUntilDone:NO];
129-
#endif
130126
}
131127

132128
@end
@@ -353,12 +349,7 @@ - (ALBuffer*) bufferFromFile:(NSString*) filePath
353349

354350
- (ALBuffer*) bufferFromFile:(NSString*) filePath reduceToMono:(bool) reduceToMono
355351
{
356-
#if ANDROID
357-
#warning TODO: FIXME
358-
return nil;
359-
#else
360352
return [self bufferFromUrl:[OALTools urlForPath:filePath] reduceToMono:reduceToMono];
361-
#endif
362353
}
363354

364355
- (ALBuffer*) bufferFromUrl:(NSURL*) url
@@ -369,12 +360,7 @@ - (ALBuffer*) bufferFromUrl:(NSURL*) url
369360
- (ALBuffer*) bufferFromUrl:(NSURL*) url reduceToMono:(bool) reduceToMono
370361
{
371362
OAL_LOG_DEBUG(@"Load buffer from %@", url);
372-
#if ANDROID
373-
#warning TODO: FIXME
374-
return nil;
375-
#else
376363
return [OALAudioFile bufferFromUrl:url reduceToMono:reduceToMono];
377-
#endif
378364
}
379365

380366
- (NSString*) bufferAsyncFromFile:(NSString*) filePath
@@ -392,15 +378,10 @@ - (NSString*) bufferAsyncFromFile:(NSString*) filePath
392378
target:(id) target
393379
selector:(SEL) selector
394380
{
395-
#if ANDROID
396-
#warning TODO: FIXME
397-
return nil;
398-
#else
399381
return [self bufferAsyncFromUrl:[OALTools urlForPath:filePath]
400382
reduceToMono:reduceToMono
401383
target:target
402384
selector:selector];
403-
#endif
404385
}
405386

406387
- (NSString*) bufferAsyncFromUrl:(NSURL*) url

external/ObjectAL/Support/OALAudioFile.h

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929

3030
#import "ccMacros.h"
3131
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
32+
#import <AudioToolbox/AudioToolbox.h>
33+
#elif __CC_PLATFORM_ANDROID
34+
#import <tremor/ivorbisfile.h>
35+
#endif
3236

3337
#import <Foundation/Foundation.h>
34-
#import <AudioToolbox/AudioToolbox.h>
3538
#import "ALBuffer.h"
3639

3740

@@ -45,21 +48,45 @@
4548
bool reduceToMono;
4649
SInt64 totalFrames;
4750

51+
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
52+
4853
/** A description of the audio data in this file. */
4954
AudioStreamBasicDescription streamDescription;
5055

5156
/** The OS specific file handle */
5257
ExtAudioFileRef fileHandle;
5358

59+
#elif __CC_PLATFORM_ANDROID
60+
FILE *rawFILE;
61+
OggVorbis_File oggFile;
62+
const char *oggPath;
63+
UInt32 sampleRate;
64+
UInt32 channelsPerFrame;
65+
UInt32 bitsPerChannel;
66+
UInt32 bytesPerFrame;
67+
UInt32 framesPerPacket;
68+
UInt32 bytesPerPacket;
69+
#endif
70+
5471
/** The actual number of channels in the audio data if not reducing to mono */
5572
UInt32 originalChannelsPerFrame;
5673
}
5774

5875
/** The URL of the audio file */
5976
@property(nonatomic,readonly,retain) NSURL* url;
6077

78+
79+
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
6180
/** A description of the audio data in this file. */
6281
@property(nonatomic,readonly,assign) AudioStreamBasicDescription* streamDescription;
82+
#elif __CC_PLATFORM_ANDROID
83+
@property(nonatomic,readonly,assign) UInt32 sampleRate;
84+
@property(nonatomic,readonly,assign) UInt32 channelsPerFrame;
85+
@property(nonatomic,readonly,assign) UInt32 bitsPerChannel;
86+
@property(nonatomic,readonly,assign) UInt32 bytesPerFrame;
87+
@property(nonatomic,readonly,assign) UInt32 framesPerPacket;
88+
@property(nonatomic,readonly,assign) UInt32 bytesPerPacket;
89+
#endif
6390

6491
/** The total number of audio frames in this file */
6592
@property(nonatomic,readonly,assign) SInt64 totalFrames;
@@ -121,4 +148,3 @@
121148

122149
@end
123150

124-
#endif

0 commit comments

Comments
 (0)