simpleaudioengine

Playing sounds in sequence with SimpleAudioEngine

左心房为你撑大大i 提交于 2019-12-21 20:23:08
问题 I'm building an iOS app with cocos2d 2, and I'm using SimpleAudioEngine to play some effects. Is there a way to sequence multiple sounds to be played after the previous sound is complete? For example in my code: [[SimpleAudioEngine sharedEngine] playEffect:@"yay.wav"]; [[SimpleAudioEngine sharedEngine] playEffect:@"youDidIt.wav"]; When this code is run, yay.wav and youDidIt.wav play at the exact same time, over each other. I want yay.wav to play and once complete, youDidIt.wav to play. If not

SimpleAudioEngine Cocos2d Leaking Memory

假装没事ソ 提交于 2019-12-21 20:14:47
问题 I am running Instruments and it indicates that the SimpleAudioEngine is leaking memory. The screenshot is attached. The memory leak is multiple times although the screenshot only shows one instance. Also, sometimes it points to the following implementation (my code): -(void) preloadGameSounds { // pre load the background sound [[SimpleAudioEngine sharedEngine] preloadEffect:@"farm_background_sound.mp3"]; // pre load the game sounds [[SimpleAudioEngine sharedEngine] preloadEffect:@

SimpleAudioEngine Cocos2d Leaking Memory

本秂侑毒 提交于 2019-12-21 20:14:28
问题 I am running Instruments and it indicates that the SimpleAudioEngine is leaking memory. The screenshot is attached. The memory leak is multiple times although the screenshot only shows one instance. Also, sometimes it points to the following implementation (my code): -(void) preloadGameSounds { // pre load the background sound [[SimpleAudioEngine sharedEngine] preloadEffect:@"farm_background_sound.mp3"]; // pre load the game sounds [[SimpleAudioEngine sharedEngine] preloadEffect:@

Playing audio in cocos2d v3

六眼飞鱼酱① 提交于 2019-12-14 03:12:26
问题 I am trying to get background music playing and looping as well as one-shot sounds every now and again, e.g. level up etc. I have found many tutorials on this that are using SimpleAudioEngine, but when I import SimpleAudioEngine.h the compiler is stating "SimpleAudioEngine.h file not found" I am using SpriteBuilder and cocos2d v3. Does anyone know where I can get this class from? Thanks 回答1: [[OALSimpleAudio sharedInstance] playBg:@"bakground.caf" loop:YES]; 来源: https://stackoverflow.com

Play background music outside of app bundle using SimpleAudioEngine

孤街浪徒 提交于 2019-12-13 06:12:05
问题 I need to play background music residing in the app's document folder (using hosted content downloads which I put in the document folder after download). It seems that SimpleAudioEngine's way of playing background music is to take a relative path and find it inside the app bundle (CDAudioManager does it): @"mysong.mp3" becomes @"...19E17B5B/myapp.app/mysong.mp3" Which is not helpful because the file saved into the Documents folder looks like this @"...19E17B5B/Documents/mysong.mp3" Edit: It

Is it possible to adjust the sound volume cocos2d?

陌路散爱 提交于 2019-12-11 04:04:25
问题 I am using the following method, and express a sound effect in cocos2d. [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"BackGround.m4a"]; But sound volume of BackgroundMusic is too small. so, is there a way that adjust a sound volume? 回答1: The backgroundMusicVolume property of the SimpleAudioEngine class can be used for this. - (float) backgroundMusicVolume [read, write, assign] //Background music volume. Range is 0.0f to 1.0f. This will only have an effect if willPlayBackgroundMusic

SimpleAudioEngine Cocos2d Leaking Memory

你说的曾经没有我的故事 提交于 2019-12-04 14:54:16
I am running Instruments and it indicates that the SimpleAudioEngine is leaking memory. The screenshot is attached. The memory leak is multiple times although the screenshot only shows one instance. Also, sometimes it points to the following implementation (my code): -(void) preloadGameSounds { // pre load the background sound [[SimpleAudioEngine sharedEngine] preloadEffect:@"farm_background_sound.mp3"]; // pre load the game sounds [[SimpleAudioEngine sharedEngine] preloadEffect:@"chickenlayingegg.mp3"]; // setup ding sound [[SimpleAudioEngine sharedEngine] preloadEffect:@"ding.caf"]; // egg

Playing sounds in sequence with SimpleAudioEngine

自作多情 提交于 2019-12-04 11:42:23
I'm building an iOS app with cocos2d 2, and I'm using SimpleAudioEngine to play some effects. Is there a way to sequence multiple sounds to be played after the previous sound is complete? For example in my code: [[SimpleAudioEngine sharedEngine] playEffect:@"yay.wav"]; [[SimpleAudioEngine sharedEngine] playEffect:@"youDidIt.wav"]; When this code is run, yay.wav and youDidIt.wav play at the exact same time, over each other. I want yay.wav to play and once complete, youDidIt.wav to play. If not with SimpleAudioEngine, is there a way with AudioToolbox, or something else? Thank you! == UPDATE == I

How to detect when sound effect finish playing?

自闭症网瘾萝莉.ら 提交于 2019-12-04 11:39:09
问题 I'm using SimpleAudioEngine and I'm trying to detect if a sound effect is finish playing before continuing. I'm looking for any method, but the one I'm trying to implement doesn't work! CDSoundEngine *engine = [CDAudioManager sharedManager].soundEngine; ALuint soundId = [[SimpleAudioEngine sharedEngine] playEffect:soundId]; float seconds = [engine bufferDurationInSeconds:soundId]; Every time I use bufferDurationInSeconds, it returns a float value of -1 to variable seconds. I checked the

How to detect when sound effect finish playing?

久未见 提交于 2019-12-03 06:34:24
I'm using SimpleAudioEngine and I'm trying to detect if a sound effect is finish playing before continuing. I'm looking for any method, but the one I'm trying to implement doesn't work! CDSoundEngine *engine = [CDAudioManager sharedManager].soundEngine; ALuint soundId = [[SimpleAudioEngine sharedEngine] playEffect:soundId]; float seconds = [engine bufferDurationInSeconds:soundId]; Every time I use bufferDurationInSeconds, it returns a float value of -1 to variable seconds. I checked the implementation, and it returns a -1 when the id is not valid, but I'm 100% the ID is valid! Can anyone help