Forums » C++ Framework » AL_INVALID_NAME in playBackgroundMusic »
| Jesus Bosch | AL_INVALID_NAME in playBackgroundMusic | ||||
|---|---|---|---|---|---|
|
Added by Jesus Bosch 12 months ago
Hi, I got that error in the console (the game keeps running, but without generating any sound) just doing this while following the tutorial in the wiki section (BlackBerry PlayBook / QNX): CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("background-music-aac.wav", true); Error loading file: 'background-music-aac.wav' any idea? Thanks! Check my latest cocos2dx game (iPad): Three Little Pigs (free) https://itunes.apple.com/au/app/three-little-pigs-learn-while/id578624548?mt=8 Twitter: @jboschaiguade |
||||
| Jesus Bosch | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Jesus Bosch 12 months ago
ok THERE IS AN ERROR IN THE TUTORIAL (or it is outdated/not tested with QNX). In QNX, unless you pre-initialize the sound files in the constructor (and no somewhere else), it WILL NOT WORK:
Please, add it to the tutorial, it's confusing and very frustrating... I would do it myself but don't have permissions to edit it. Thanks. Jesus Check my latest cocos2dx game (iPad): Three Little Pigs (free) https://itunes.apple.com/au/app/three-little-pigs-learn-while/id578624548?mt=8 Twitter: @jboschaiguade |
||||
| Jesus Bosch | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Jesus Bosch 12 months ago
another error, to play the effect it should be the following: CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(std::string(CCFileUtils::fullPathFromRelativePath("pew-pew-lei.wav")).c_str()); thanks! I was getting crazy with this! Fortunately I've noticed that there is anice cocosdenshion example with the cocos2dx download :-) Check my latest cocos2dx game (iPad): Three Little Pigs (free) https://itunes.apple.com/au/app/three-little-pigs-learn-while/id578624548?mt=8 Twitter: @jboschaiguade |
||||
| Ben Ward | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Thanks for posting this, it's useful in troubleshooting the problem I'm having with BB10. I've tried preloading the music and sfx as you suggest, but still I can't seem to get any audio. I get the same errors: Error loading file: 'Audio/Easy_Stroll_alt_mix_mp3.mp3' Are there any other gotchas that you discovered whilst getting audio working? Thanks for your help! Ben |
||||
| Jesus Bosch | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Jesus Bosch 4 months ago
hi, unfortunately I did not develop for blackberry tablet anymore. Is it a profitable platform? Check my latest cocos2dx game (iPad): Three Little Pigs (free) https://itunes.apple.com/au/app/three-little-pigs-learn-while/id578624548?mt=8 Twitter: @jboschaiguade |
||||
| Ben Ward | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Jesus Bosch wrote:
Ah no worries then. I'm not sure whether it's profitable yet; I'm still porting my first game. However, the 10k guarantee is a pretty interesting thing: https://developer.blackberry.com/builtforblackberry/commitment/ After looking through the source it looks like the Blackberry version of cocos2d-x doesn't support .mp3, so I'm just re-encoding as .ogg to see how that turns out... Ben |
||||
| Jesus Bosch | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Jesus Bosch 4 months ago
thanks for sharing Ben! Good luck! Check my latest cocos2dx game (iPad): Three Little Pigs (free) https://itunes.apple.com/au/app/three-little-pigs-learn-while/id578624548?mt=8 Twitter: @jboschaiguade |
||||
| Ben Ward | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
For anybody else who encounters this problem, you'll need to do the following: -Convert all your mp3s to oggs: cocos2d-x on blackberry doesn't support mp3 yet (at least not that I can see). Wavs seem to play fine. Ben |
||||
| Alexander Belchenko | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Alexander Belchenko 4 months ago
Ben, have you tested your application in Simulator or on a real device? I have problems hearing sounds on simulator, although I did everything as you suggested. |
||||
| Ben Ward | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Alexander Belchenko wrote:
I've only tested on the simulator I'm afraid, although the sound seemed to work fine on it. Can you hear sound on other apps in the simulator? Ben |
||||
| Alexander Belchenko | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Alexander Belchenko 4 months ago
Oh, I found that I had to "Connect sound card" in Vmware Fusion. It wasn't obvious settings hidden in toolbox below a spanner. Ben, what version of Cocos2dx are you using? |
||||
| Ben Ward | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Alexander Belchenko wrote:
Yep, I've found that it sometimes skips and stutters on the simulator. At this stage I don't have hardware, so I've no idea whether this is expected behaviour on the simulator or not.
I'm still on 2.0.3, although I've had to make some adjustments. For example, I've dropped the latest cocos2dx/platform/blackberry/CCImage.cpp into my project as it fixes some of the text stuff (although text wrapping on CCLabelTTFs still doesn't work unfortunately). Which version are you running? Ben |
||||
| Alexander Belchenko | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Alexander Belchenko 4 months ago
I'm using 2.0.4, for some reason I skipped 2.0.3, although initially my game was written using 2.0.1. In the end I've got working solution for sound in simulator with following procedure: 0) I'm using full file path to sound resource as suggested: CCFileUtils::fullPathFromRelativePath("pew-pew-lei.wav") and use ogg instead of mp3. (Honestly I didn't try to play mp3, I simply converted my music to ogg). 1) preload all effects before playing them with playEffect(). That could be done at the start of the game or scene where they should be used. 2) For background music you must preload the file you want to play right before you start playing it, and you must stop playing previous track explicitly. This is very important if you want to play different music for different part of your game (e.g. one for menu and other for game scene) 3) Don't try to preload all background music at once - you'll get the latest preloaded track even though you will use different filename (yes, it's weird). For example: SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(fullName("play.ogg")); SimpleAudioEngine::sharedEngine()->playBackgroundMusic("play.ogg"); This will play menu.ogg even though I've asked for play.ogg - this is really weird but it behaves so for me on emulator. 4) If you forgot to stop currently playing background music then you'll end up with 2 tracks playing simultaneously, but stopBackgroundMusic only stops the latest track. So, in the end I wrote the following helper function to use instead of SimpleAudioEngine's playBackgroundMusic:
The number of wtf with Blackberry sound easily outperforms issues with sound on Android. %-/ I hope we can test my port on real device soon. |
||||
| Ben Ward | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Good stuff, I'm glad you got it working. Ben |
||||
| Viraj Dasondi | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Viraj Dasondi 2 months ago
Can you help me in this..I am new to blackberry development.. Still i am getting compile error like this : And also not found any guide regarding setting Cocosdenshion in blackberry.. |
||||
| Ryan Hentz | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Ryan Hentz about 1 month ago
Viraj Dasondi wrote:
Not sure if you still need this or not but I ran into this problem as well. In QNX Momentics IDE click on your project and press CTRL+SHIFT+L Choose Standard blackberry libraries, under Multimedia select both OpenAL and OpenAL Utlity Toolkit then rebuild your project |
||||
| Viraj Dasondi | RE: AL_INVALID_NAME in playBackgroundMusic | ||||
|
Added by Viraj Dasondi about 1 month ago
Thanks @Ryan Hentz.. |
(1-16/16)