Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Aug 10, 2015 · 7 comments
Open

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 5 Sep 2012 at 10:53

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 5 Sep 2012 at 10:57

@GoogleCodeExporter
Copy link
Author

I have the same problem  :(

Original comment by [email protected] on 3 Nov 2012 at 10:40

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Hey, I found solution. 
Open WavSoundPlayer.as
Change it like this:
public static var MAX_BUFFERSIZE:Number = 2048;// 8192;

Original comment by [email protected] on 9 Nov 2012 at 9:57

@GoogleCodeExporter
Copy link
Author

yes u r right :��

�����ҵ� iPhone

�� 2012-11-9��17:57��[email protected] д����

Original comment by [email protected] on 10 Nov 2012 at 2:17

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 25 Nov 2012 at 10:15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant