Commit Graph

306 Commits

Author SHA1 Message Date
minggo ee84d9f12e update v3.15 2017-04-14 13:45:32 +08:00
James Chen 3c1e36c2c3 Cleanup AudioEngine resource after exiting NewAudioEngineTest. (#17675)
* Unschedules update in AudioEngine implementation while AudioEngine::end is called.

* Cleanup AudioEngine resource after exiting NewAudioEngineTest.
2017-04-13 17:58:49 +08:00
James Chen 57170200dd fixed #17685: [android] Audio in game couldn't be mute while a ring or a call is coming (#17686)
* fixed #17685: [android] Audio in game couldn't be mute while a ring or a call is coming

* Updates comments in AudioEngine-inl.cpp and removes extra empty line in javaactivity-android.cpp

* Puts audio focus relative code to another java file named Cocos2dxAudioFocusManager.java
Renames setAudioFocusLost to setAudioFocus.

* Renames JNI function.

* Register audio focus in onResume and unregister it in onPause.
2017-04-13 10:44:08 +08:00
James Chen 1f39fd5fdf CocosDenshionTest, unload doesn't work for android 5.0.1 devices (#17662) 2017-04-10 10:14:47 +08:00
James Chen 439f371758 fixed #17619: [android] Crash if uncache audio in the finished callback (#17620) 2017-03-31 09:38:45 +08:00
James Chen 6217d8c5ca fixed #17591: [ios, mac, win32] Audio could not be played in the callback of AudioEngine::setFinishedCallback (#17593)
* Moves the implementation of AudioEngine::AudioInfo to cpp file.

* fixed #17591: [ios, mac, win32] Audio could not be played in the callback of AudioEngine::setFinishedCallback

* fixed #17591: Adds test case.
2017-03-27 17:28:39 +08:00
James Chen ab9104f3ce Updates templates for switching AudioEngine in AppDelegate.cpp. (#17555) 2017-03-22 11:19:25 +08:00
James Chen 1f8eb3b7f5 fixed #17494: Adds setTimeout to wrap NSTimer since ‘timerWithTimeInterval:repeats:block’ is only available from iOS 10, macOS 10.12. (#17518)
* fixed #17494: Adds setTimeout to wrap NSTimer since ‘timerWithTimeInterval:repeats:block’ is only available from iOS 10, macOS 10.12.

* Sets _timeoutCallback to nullptr if onTimeoutCallback is called.
2017-03-16 11:04:36 +08:00
James Chen 8c542d711d issue #17503: Avoid crash if initializing audio fails. (#17505)
* issue #17503: Avoid crash if initializing audio fails.

* Corrects logic of checking the return value of decodeMP3.
2017-03-15 16:46:19 +08:00
James Chen 16e1bf47ac fixed #17494: [iOS] CrashIfClientProvidedBogusAudioBufferList (#17500) 2017-03-15 13:50:56 +08:00
James Chen b842202541 fixed #17395: OpenAL A003 error if doing AL invocation before alcMakeContextCurrent(s_ALContext); (#17492)
Pause director if Audio Session is still in interrupted state, resume director in interrupted ended.
2017-03-14 13:56:12 +08:00
James Chen 1dccd7b85b fixed #17395: AudioEngine alSourcePlay error code:a003 in lua-tests. (#17485) 2017-03-13 11:37:23 +08:00
James Chen eca39ba7aa fixed #17413: [Android] AudioEngine::play2d may still wait 2 seconds if preload is too fast. (#17414) 2017-02-27 15:11:39 +08:00
James Chen c86d7b0d2f fixed #17397: Updates CMakeList.txt for win32 audio module (#17401) 2017-02-23 16:13:26 +08:00
James Chen 41f135ec27 [Android] Software decoding while preloading audio files to avoid some crashes on some specific android devices, and it’s 5x - 15x faster than the old implementation. (#17233)
* [Android] Software decoding while preloading audio files to avoid some crashes on some specific android devices, and it’s 2x faster than the old implementation.

* Updates external/config.json to 126

* Updates library path, adds ‘android-specific’ prefix.

* Updates config.json to 127
2017-02-16 16:23:10 +08:00
CocosRobot d07794052f Update license to 2017 (#17362)
* Typo: CopyRight -> Copyright

* Copyright update: chukong-inc.com -> Chukong Technologies Inc.

* [js files] Copyright update: 2014 -> 2014-2017

* [cpp files] Copyright update: 2014 -> 2014-2017

* Copyright update: 2015 -> 2015-2017

* [js files] Copyright update: 2014 -> 2014-2017

* Copyright update: 2016 -> 2016-2017

* Copyright update: 2013 -> 2013-2017

* Copyright update: 201?-201? -> 201?-2017

* License year fixes.

* Liscene year fix in CCRay.cpp

* Updates license years in CCGLProgramState.h & CCGLProgramStateCache.h
2017-02-14 14:36:57 +08:00
Wilson E. Alvarez b672b94edc Removed unnecessary assignments (#17328) 2017-02-09 10:57:01 +08:00
Wilson E. Alvarez 5d748f941b Mitigate cppcheck message (#17323) 2017-02-08 15:32:01 +08:00
minggo 92704517bc remove unneeded assignment (#17320) 2017-02-08 13:58:11 +08:00
Dmitry 4bf1750cbd issue #17305 fix: cocos/audio/win32/AudioCache.h fixed include <AL/al.h> (#17306) 2017-02-08 10:22:05 +08:00
mogemimi 777a97e141 Fix typo in AudioState (#17258) 2017-02-04 10:34:34 +08:00
j-jorge c616d6d9ff Compilation fix (#17209)
* Fix various compilation issues.

Mostly errors on field initialization order but also missing files
in CMakeLists and missing include directives.

* Fix compilations issues with GCC 6.2

* Fix gitignore libs/ entry to not ignore the Android external libraries.
2017-02-04 09:46:32 +08:00
minggo f63fad3e27 Merge branch 'v3.14' into merge-v314 2017-01-04 09:49:22 +08:00
James Chen e4e872a065 fixed #16849: Preload many audios may cause crash on devices those use Samsung Exynos CPU. (#17049)
* fixed #16849: Preload many audios may cause crash on devices those use Samsung Exynos CPU.

* Adds comment for __SLPlayerMutex variable.

* Fixes wrong comments in AudioDecoder.cpp
2016-12-29 15:41:47 +08:00
James Chen 208d39151e Reverts create thread pool code, android doesn't need to create a thread pool in AudioEngine.cpp (#17081) 2016-12-29 10:22:45 +08:00
James Chen be43c4210f Fixes crash that playing long audio and then uncacheAll (#17079)
* Fixes crash of playing long audio then uncacheAll.

* update

* Updates comments in MciPlayer.h

* tab -> 4spaces

* include path fix.
2016-12-29 10:05:13 +08:00
James Chen effb6f077a [mac, ios] 'ExtAudioFileRead' may return 0 frame while it doesn’t reach the end of very short audio file. (#17011)
* [mac, ios] Adds AudioDecoder::readFixedFrames. And uses readFixedFrames to simply code.

* [mac, ios] ‘ExtAudioFileRead’ may return 0 frame while it doesn’t reach the end of very short audio file.

* [mac, ios] Adds test case for small file test.

* [mac, ios] Adds small audio file.

* [mac, ios] Macro ‘BREAK_IF’ logic fix.

* [mac, ios] Returns false of AudioDecoder::open if total frames is 0.
2016-12-15 09:58:47 +08:00
James Chen ed72691bc9 [ios/macOS] Fixed a compilation error after enabling ‘CD_USE_STATIC_BUFFERS’. (#16997) 2016-12-13 13:37:31 +08:00
James Chen b80e316150 fixed #16938: Audio could not be played entirely on iOS/macOS. And refactored some code of decoding. (#16946)
* fixed #16938: Audio could not be played entirely on iOS/macOS. And refactored some code of decoding.

* Adds license header, removes unused macros.

* issue #16938: Corrects remaining frame count calculation.

* Updates include path.

* Adds comments for AudioDecoder class.

* Adds const for getter functions in AudioDecoder.

* issue #16938: Adds test case.

* Updates license years.

* Deletes trailing white spaces.
2016-12-02 13:52:37 +08:00
Wilson E. Alvarez fd6e10f0f5 Let FMOD autodetect the best output mode for Linux (#16819)
Thanks to filippovdaniil for the suggestion
2016-11-10 11:30:30 +08:00
James Chen 609750ef58 fixed #16754: [android] Background music which is playing could not be paused while game enters background. (#16755)
* fixed #16754: [android] Background music which is playing could not be paused while game enters background.

* Updates a comment of cocos/audio/android/AudioEngine-inl.h
2016-10-28 10:12:52 +08:00
Wilson E. Alvarez c0e1e91373 Performance tweak: Use range-based for-loops and allocate std::vector size() and *end() on the stack where favorable. (#16716)
* Use range-based for-loops and allocate std::vector size(), end(), cend(), rend(), crend() on the stack where favorable.

Other minor trivial changes were applied.

* Fixed Android compilation error

* Fixed windows-universal compilation error
2016-10-27 15:10:24 +08:00
QingliWang 7c1f88423b Fix bug when app paused the music is still resumed to play after interruption completed. (#16679)
* Support audio interruption and resume callback when change earphone status.

* Refactor keyevent callback and add makecurrent for compatible with different binary.

* Enable Tizen indicator.

* Remove the unnecessary evasobject in the window and refactor the function for glview mode.

* Fix the compatible issue between Tizen 2.3 and 2.4.

* Fix the wrong directory of script resources for HellLua template project.

* Create performance-test project for Tizen platform.
2016-10-12 15:48:27 +08:00
Wilson E. Alvarez cdee1e11de Performance tweak: use range-based for-loops instead of iterator-based for-loops. (#16642)
* Use ++ prefix instead for non-primitive data types in CCAutoPolygon.cpp

* Use ++ prefix instead for non-primitive data types in SimpleAudioEngine.cpp

* Use ++ prefix instead for non-primitive data types in CCNodeLoaderLibrary.cpp

* Use ++ prefix instead for non-primitive data types in CCActionManagerEx.cpp

* Use ++ prefix instead for non-primitive data types in CCDataReaderHelper.cpp

* Use ++ prefix instead for non-primitive data types in HttpClient-android.cpp

* Use ++ prefix instead for non-primitive data types in CCDevice-linux.cpp

* Use ++ prefix instead for non-primitive data types in ScriptingCore.cpp

* Switched implementation to range-based for loops

* Added readability, fixed loop in CCDataReaderHelper.cpp

Thanks to Dimon4eg for the code review.
2016-10-11 10:59:44 -07:00
colajam93 1d3a40f8be Fix warning (#16591) 2016-09-20 14:50:47 +08:00
minggo 84a102edf8 merge v3.13.1 back to v3 2016-09-15 10:08:28 +08:00
minggo 3075108f1c get sdk version from java (#16546) 2016-09-12 09:49:39 +08:00
James Chen b8f127e601 fixed #16547: [ios, mac] Protencial memory leak in AudioPlayer.mm. (#16556)
If playing a large audio and its loop flag is set to false, after the audio is played over, there will be 4 or 8 bytes memory leak by _rotateBufferThread variable.

Resolution:

The `isDestroy` flag should not be set to true in rotate buffer thread, to exiting the thread, we need another varible for this purpose.

Thanks @nicolechen819 for the feedback.
2016-09-12 09:48:27 +08:00
minggo c51605971f fixed #16490: [android, audio] AudioEngine::stop() triggers 'finished' callback (#16491) (#16524) 2016-09-06 10:58:43 +08:00
minggo 9dc737901b fixed #16473: OpenSLES error while play background music in writable path or sdcard. (#16475) (#16521) 2016-09-06 09:41:53 +08:00
James Chen 64c62d37c2 fixed #16490: [android, audio] AudioEngine::stop() triggers 'finished' callback (#16491) 2016-09-01 16:06:29 +08:00
James Chen 6d27868918 fixed #16473: OpenSLES error while play background music in writable path or sdcard. (#16475) 2016-09-01 11:47:33 +08:00
James Chen 01e67f6203 fixed #16477: [android, audio] Deadlock if preload the same file more than 3 times in preload callback. (#16478)
And added test case.
2016-09-01 11:46:27 +08:00
James Chen 35f937cd40 AudioMixerController::initTrack should not setState for track. Otherwise, it may trigger Track state mess-up. (#16476)
* Warning fixes in AudioDecoder.cpp

* AudioPauseResumeAfterPlay test case should start in onEnter.
And add a loop to pause & resume many times.

* AudioMixerController::initTrack should not setState for track. Otherwise, it may trigger Track state mess-up.
2016-09-01 11:43:37 +08:00
minggo 04fd2b16b2 merge v3.13 back to v3 2016-08-29 11:57:13 +08:00
minggo 20a0798007 avoid to use __system_get_property__ (#16433)
* avoid to use __system_get_property__

* add utils

* revert console
2016-08-24 17:11:41 +08:00
James Chen 727c501285 Fixes crash while invoking pause&resume right after play2d. (#16406) 2016-08-22 09:43:06 +08:00
minggo 92ed162cbe replace replace __system_property_get() since it is deprecated in 64 bit android NDK (#16398) 2016-08-19 11:49:33 +08:00
James Chen 8af275c4a6 Fixes potential crash in AudioEngine::uncache(filePath). (#16345) 2016-08-11 16:06:59 +08:00
James Chen f44f253179 [Android] Notify waitup only while preloadEffect(info, cb) is invoked in play2d. (#16320)
Currently, if a audio isn't preloaded, then play2d will wait the preload operation to finish.
2016-08-05 14:07:19 +08:00