wavegunner232 / as3wavsound

Automatically exported from code.google.com/p/as3wavsound
Other
0 stars 0 forks source link

delayed wav file play from an already loaded wavsound object #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use the code I have provided
2. run SoundManager.playSound(<name>);
3. there is a 1 second delay for me, i have traced to confirm this. The trace 
in playSound traces 1 second before i hear the sound. The sound file is 
confirmed to have no blank space in the spectrum. and it is only 6kb.

<code>: SoundManager.as
public function SoundManager() 
        {
            buildSounds();
            trace("sound manager loaded");
        }

        public function playSound(name:String)
        {
            trace("playing " + name);
            sounds[name][1] = sounds[name][0].play();
            trace("played " + name);
            sounds[name][1].addEventListener( Event.SOUND_COMPLETE, looper );
        }

private function loadSound(path:String, name:String)
        {
            sounds[name] = new Array("", "", path, false, false, 0, 100, 0, 0);
            var wavLoader:URLLoader = new URLLoader();
            wavLoader.dataFormat = "binary";
            wavLoader.load(new URLRequest(File.applicationDirectory.resolvePath(path).url));
            wavLoader.addEventListener( Event.COMPLETE, function(e:Event){makeSound(e,name)} );
        }

        private function makeSound(e:Event, name:String):void
        {
            sounds[name][0] = new WavSound(e.target.data as ByteArray);
        }

        private function buildSounds()
        {
            loadSound("sound/menu/itemDown.wav", "menuItemDown")
            loadSound("sound/menu/itemUp.wav","menuItemUp")
        }
</code>

What is the expected output? What do you see instead?
Instant play, but instead i have a 1 second delayed play.

What version of the product are you using? On what operating system?
v0.9, windows 7 64 bit

Please provide any additional information below.
run in adobe air 3.2 in flash professional cs6

Original issue reported on code.google.com by gunuse.t...@gmail.com on 5 Sep 2012 at 10:53

GoogleCodeExporter commented 8 years ago
i forgot this:

        private var sounds:Dictionary = new Dictionary();
        //Array(object:WavSound, object:WavSoundChannel, sound:String, loops:boolean, paused:boolean, playhead:int, volume:int, angle:int, distance:int)

Original comment by gunuse.t...@gmail.com on 5 Sep 2012 at 10:57

GoogleCodeExporter commented 8 years ago
I have the same problem  :(

Original comment by kingn...@gmail.com on 3 Nov 2012 at 10:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hey, I found solution. 
Open WavSoundPlayer.as
Change it like this:
public static var MAX_BUFFERSIZE:Number = 2048;// 8192;

Original comment by morskoyz...@gmail.com on 9 Nov 2012 at 9:57

GoogleCodeExporter commented 8 years ago
yes u r right :��

�����ҵ� iPhone

�� 2012-11-9��17:57��as3wavsound@googlecode.com ���

Original comment by kingn...@gmail.com on 10 Nov 2012 at 2:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Bravo! That fixed it, morskoyz! I cannot tell you how many hours of headache 
you just saved me!!!

To improve the visibility of this answer (it was very hard for me to find), I 
reposted it on Stack Overflow. If you're a member, you're welcome to answer it 
yourself. Either way, I've credited you with a linkback.

http://stackoverflow.com/questions/13556083/delay-when-playing-sound-using-as3wa
vsound/13556084#13556084

Original comment by indelibl...@gmail.com on 25 Nov 2012 at 10:15