Windows 7 - sound not working in simulator

A few months ago I had Corona on a Windows XP machine and while testing audio and testing a mute button in the app, the sound stopped working in the simulator. In fact, the sound driver crashed completely. I got it to work again, but even with an updated driver, the sound on that machine is messed up in some applications. At that time I thought it was just a freak coincidence for the driver to crash while I was testing mute button code. I did try other apps in the simulator, but found out the whole system couldn’t output audio. As for hardware failure, I’m not going to blame Corona. It’s an old laptop, so it’s on its last legs anyway.

Now I work on a Windows 7 machine and a few weeks ago was fixing up audio bugs in my app, including testing the mute button again. Again, similar situation. The sound in the simulator just simply stopped. I updated the version of Corona to the latest build, but there is still no sound. I’ve tested with many apps (mostly samples that have some audio) and older versions of my own apps.

I don’t know if I can reproduce the bug, but I did make a mistake in my code in both situations. I didn’t know that audio.volume() by itself could mute all sounds. Rather I was using the following code where ever sounds were played:

if soundToggle then  
 audio.play(fooSound)  
end  

In the options menu in my app I have a button that toggles the soundToggle boolean.

Now I’m using the correct code within the buttons function:

if soundToggle then  
 audio.volume(1)  
else  
 audio.volume(0)  
end  

It’s an odd bug. Even the first incorrect method I was using to mute the sounds should still work fine and not cause a sound crash. So far the audio and muting are working on the simulator on my Mac. [import]uid: 10622 topic_id: 26534 reply_id: 326534[/import]

Just to confirm, you said that calling…
[lua]audio.volume()[/lua]
…with no arguments sometimes causes a crash? [import]uid: 32256 topic_id: 26534 reply_id: 107613[/import]

Sorry about that. What I mean’t was that I didn’t know that you could use the audio.volume() function to mute or adjust the volume of ALL sounds. I thought you could only use it to adjust the volume of single sounds. I wasn’t paying enough attention to the audio api and so that’s why I was using this:

if soundToggle then  
 audio.play(fooSound)  
end  

and I got the sound crashes when I was using this code whenever I needed a sound to be played.

I actually didn’t really need to post the other bit of code, but was just showing that I have a more correct method of muting sounds. But, again, not paying attention before posting. So just ignore all the parts about audio.volume(). [import]uid: 10622 topic_id: 26534 reply_id: 107624[/import]

Right, the [lua]audio.volume()[/lua] function controls the volume of all sounds/music played by the audio API. Note that it does not control the volume of sound played by the media API.

It still isn’t clear to me what exactly caused the crash for you. Can you give me a small code snippet that can reproduce the crash please? Thanks! [import]uid: 32256 topic_id: 26534 reply_id: 107939[/import]

There is no audio.volume() API. There is audio.setVolume() and audio.getVolume().

[import]uid: 7563 topic_id: 26534 reply_id: 107961[/import]

Yea it was audio.setVolume that I was using. But, anyway, I have absolutely no sound still in the simulator. It’s certainly nothing to do with my code, since it my game works perfectly on the Mac simulator. I need to be able to use my PC as well. This is very frustrating. [import]uid: 10622 topic_id: 26534 reply_id: 113987[/import]

Try running sample app “media/SimpleMixer” that is included with the Corona SDK on Windows. If that plays audio okay, then we know that Windows audio hardware is set up correctly and Corona “can” play audio on it. [import]uid: 32256 topic_id: 26534 reply_id: 114007[/import]

No. SimpleMixer didn’t work. Sound worked perfect on this machine before. In fact I’ve used the Corona SDK on this machine for over a year before the audio glitch happened. No other program suffers any sound problems, meaning my audio drivers or hardware shouldn’t be the culprits.

On my Windows XP laptop I had a similar audio glitch with the SDK that also caused it not to play any sound. It seemed to fix itself on the laptop, but the sound was messed up for some other programs after. The worst affliction was to a media player (VLC).

Since this bug happened on 2 different Windows machines on different versions of Windows, it’s something that’s Corona related. Windows doesn’t like … something… in Corona’s code. In the case of the laptop with sound problems in other programs afterward… I really can’t explain that. [import]uid: 10622 topic_id: 26534 reply_id: 114704[/import]

>> The worst affliction was to a media player (VLC).

Wait… your media player doesn’t play audio on this machine anymore? I don’t see how this is Corona related. There’s got to be something “different” about your Windows machine setup compared to others. Unless you can track that down, I don’t see how we can help you further. Especially since no other customer has cited audio issues on Windows.

If you think it is a new bug in the Corona SDK, then try running an older version of the Corona SDK on your Windows machine. The version that you said used to work. You can find these versions here…
http://developer.coronalabs.com/downloads/archive
[import]uid: 32256 topic_id: 26534 reply_id: 114838[/import]

Well, bizarrely enough. I updated to the latest version last night and sound came back. Puzzling as I updated with daily updates several times before and the bug remained. Also puzzling that I update this thread just mere minutes before I decided to download the latest daily build. So, this means that this thread can be closed now.

Thank you for the replies and trying to help me out. [import]uid: 10622 topic_id: 26534 reply_id: 114872[/import]