≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Sound Lost after a while
Posted by:
(you are not logged in)
Enter the missing letter in: "I?ternational"
(you are not logged in)
Text:
[quote][b][/b] wrote: ok, so i still need some help with this... my code is considerable and way too much to post here. Instead, can I get an example of using Aliases properly as I am obviously confused about their implementation. My application here is for weapons sounds... multiple characters will have the same type of weapon, therefore needing the same sound which can overlap in their playing. This is why i am trying to use aliases. So, my current process is: I load all the original sounds I want to use, at application start up into a library array holding the sounds thusly: struct SOUND_SOURCE { irrklang::ISoundSource * TheSoundSource; core::stringw soundName; }; struct WP { irrklang::ISoundSource * weaponSound; irrklang::ISound * soundRetVal; }; SOUND_SOURCE soundsList[50]; soundsList[50] WP Weaps[10]; //Load Original Sounds In The Library Array: soundsList[0].TheSoundSource = soundEngine->addSoundSourceFromFile("sounds/beam01.wav"); //When a weapon object is created for a player, i create a unique alias name for that sound and create the alias which is never changed again: Weaps[w].weaponSound = soundEngine->addSoundSourceAlias(soundsList[0].TheSoundSource,newSoundName.c_str()); //Then, When I wish to play one of the aliases: void sndPlayWeaponSound(int wp) { Weaps[wp].soundRetVal = soundEngine->play2D(Ships[s].Weaps[wp].weaponSound,false,true,true); Weaps[wp].soundRetVal->setPlayPosition(0); Weaps[wp].soundRetVal->setIsPaused(false); return; } //when I wish to stop an alias: void sndStopWeaponSound(int s, int wp) { if(Ships[s].Weaps[wp].soundRetVal->isFinished() == false) { Ships[s].Weaps[wp].soundRetVal->setIsPaused(true); return; } } As you can see, I am not grabbing or dropping, I also need to be able to stop an alias sound playing at any time (the weapon firing time can be variable) Also, are you saying that the 'soundRetVal' needs to be dropped each time I want to stop a sound so that it can be played again?[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact