sevengo8378 / as3wavsound

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

Returned SoundChannel position is always 0 (and playback lagging) #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

1. play a WavSound and keep the returned SoundChannel in a variable
2. using a timer, try to access the SoundChannel.postion during playback
3. the resulting value is always 0. 

Exected output is the current position in ms that the sound has been playing, 
i.e. as with the normal Sound class. I am using the as3wavsound 0.6 version on 
MacOS 10.5.8. with flash CS5.

I added a trace of the current duration (in ms) in the wavSoundChannel class to 
see if I could work around the problem myself:

trace(phase / (_wavSound.samples.length / _wavSound.length));

But, for some reason the actual sound hitting the speakers is lagging with 
about 1 second when I compare it with this trace. I don't mind a delay, but 
since I can't calculate it I can't sync the sound with other sounds. I would 
really appreciate any help on this.

Original issue reported on code.google.com by Bjorn.B....@gmail.com on 14 Oct 2010 at 10:18

GoogleCodeExporter commented 9 years ago
This is a deficiency that can't be fixed: AS3WavSound uses its own SoundChannel 
version (WavSoundChannel) for playback. The returned SoundChannel is actually 
only a dummy holder only to allow access its transform property 
(soundChannel.soundTransform) by the end-user. That's why it's position is 
always 0 and why stop() doesn't work

This is because Adobe's SoundChannel class is declared final and can't be 
reused by AS3WavSound to redefine its behavior.

I'm currently considering dropping backwards compatibility by adding an extra 
play() method that actually returns a WavSoundChannel. This way stop() will 
work as well as position.

Original comment by b.bottema on 19 Oct 2010 at 7:33

GoogleCodeExporter commented 9 years ago
Hi, thanks for your reply. I think your component would benefit from your 
proposed solution. 

Original comment by Bjorn.B....@gmail.com on 19 Oct 2010 at 8:09

GoogleCodeExporter commented 9 years ago
Any further info on if you're going to do this or not?  Building a wav player 
application with this that needs a pause functionality.

Original comment by wgun...@gmail.com on 16 Dec 2010 at 6:30

GoogleCodeExporter commented 9 years ago
Should be fixed in v0.7.

Original comment by b.bottema on 21 Dec 2010 at 7:06

GoogleCodeExporter commented 9 years ago
Make that v0.8. The position calculated in v0.7 is not the milliseconds as it 
should be.

Original comment by b.bottema on 21 Dec 2010 at 9:22