01-14-2011 08:47 AM
Hi,
as far as I could find out, the current emulator doesn´t support sound. Is that correct?
I´ve developed a music app. The sounds seem to load correctly but I can´t hear them.
Is it just an emulator problem? Will it play on the live device?
Thanks,
Kay
01-14-2011 09:03 AM
What platform are you using (Mac, etc)?
What APIs are you using to play the sound?
I can confirm that "raw" sound generated using flash.media.Sound and the SampleDataEvent does work.
I don't believe I've yet seen a code snippet showing how to get any other sound to work.
01-14-2011 09:45 AM
I can verify that mp3's loaded from an HTTP server, using Sound.load() do work.
But the entire simulator locked right afterwards (song kept playing though)
01-14-2011 10:09 AM
Thanks, after the simulator update everything works fine, almost (but that requires a separate thread.
Kay
01-14-2011 10:47 AM
Here's a sample that works fairly consistently on mine. I have had freezes (requiring VM reset) but so far it looks like those may be associated with installing an updated app while the current one is still running. At least, it looksl like if I cleanly exit the app before starting to install/launch a changed version it doesn't seem to crash (much?).
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
[SWF(backgroundColor="#dddddd", frameRate="20")]
public class SoundTest extends Sprite {
public function SoundTest() {
var request:URLRequest = new URLRequest('http://www.tekyo.com/medias/Scotland the Brave.mp3');
var sound:Sound = new Sound();
sound.load(request);
var channel:SoundChannel = sound.play();
channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
}
private function onComplete(e:Event):void {
stage.nativeWindow.close();
}
}
}
Note that the volume seems to be about half what it is with programs on my host machine. I have no idea if that's VMware itself or something in the simulator.
03-27-2011 04:17 AM
Thanks for sharing your code, Peter.
One additional question: I already figured out, that I can stop playback with
channel.stop()
But once stopped I won't be able to restart it. I tried making sound and channel global variables, but calling channel=sound.play() again and even making a new URLRequest with loading the MP3 again did not work.
Any ideas?
03-27-2011 09:42 AM
@biggerCC: I had similar issue...i can play the mp3 but after a while sound stops working i need to reboot to have it working again..
03-27-2011 09:46 AM
Even with my app, which generates raw sound using SampleDataEvent, I find that the sound just stops coming out after a longish period of time (sometimes a few hours), for no visible reason. There are no exceptions, no related bugs in my app, no memory leaks, no change in the status of the sound buffers in the simulator's /tmp folder, or any other sign of a problem other than it goes silent. (I have not yet checked whether there's a change in threads running by checking the output of "pidin".)
I've just been assuming this will work on the real hardware. It's a pretty safe bet, I think, given how many issues the simulator has, that both this and any issues with MP3 playing are just sim bugs.