audio.setVolume doesn't work anymore

It’s several days that the audio.setVolume  command seem to not work anymore.

If I set the volume to 0 with audio.setVolume(0) and try to play a sound, I can hear the sound played even it shouldn’t be. A couple of weeks ago it worked well.

My Corona is build 2017.3184 running on MacOS.

EDIT:

if I use audio.setVolume(0, {channel=0}) it works correctly, but in the past I used to write audio.setVolume(0) and it worked…

What has been changed?

Builds never update, so if it was working on on 3184 a month ago and it’s not working today on 3184, it’s most likely something you’ve changed. 

Did you make other changes around audio?

Rob

No other change. I developed a couple of games and published them. I’m sure that no changes have been done during this period at the audio compartment, and I’m sure that audio.setVolume(0) worked perfectly until a couple of weeks ago. Some days ago, while I was trying a new release of the second game, I noticed on my device that the icon I used to mute the sound didn’t work anymore. Same on the simulator. So, I’ve tried the first game, where I had a similar switch, and noticed that the same thing happened. Very strange.

**JUST UPDATED EXAMPLE TO FOLLOW YOURS MORE CLOSELY @ 1032 PST 03 APR 2018**

Tip: If you’re going to assert something doesn’t work, you should make a TINY standalone example and link it in your post as a zip file. 
 
To make this easy for you, I provide a basic starter you can use to make problem examples.
 
AskEd Starter:  https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/askEdStarter.zip
 
Using the starter, I made an example demonstrating that this feature is working as expected https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/04/audioTest.zip

local track = audio.loadStream( "Discovery Hit.mp3" ) local channel = audio.findFreeChannel(1) audio.reserveChannels( channel ) audio.play( track, { loops = -1, channel = channel } ) timer.performWithDelay( 2000, function() audio.setVolume(0, { channel = channel }) end )

 
 
By making a tiny example, you:

  • Verify the problem outside the scope of your project.
  • Give us an easy way to investigate and help.  Otherwise you’re asking us to write code to debug your issue.
  • Prepare for filing a bug if there is one.  i.e. You need to provide a TINY sample to file a bug anyways.

attaching_files.jpg

Also, as this is my first response to a post of yours:

  1. Welcome to the community.

  2. For your future information, be aware there are tons of great docs and examples out there, so you are in the right place for game and app making:

Again, welcome and happy developing!

Hello. Thanks for your reply.

It wasn’t my intention to ask for someone to wrote any code for me. I apologize.

BTW, I tested your example and it worked as expected, but this was also said by me in my first post: if I chose a channel, the command worked well. If I don’t reserve a channel and just use audio.setVolume(0), the audio simply doesn’t stop. This is very strange. I looked at the same app on the Android phone of my son and the audio switch worked, but it didn’t on my Mac and on my iPhone too.

I’m really sure that it did some days ago. I can confirm it because I developed my game using the same code and I should had been crazy to not notice it, isn’t it ?  :slight_smile:

I attached the modded code that doesn’t work for me. I tried it on 2017.3184 and also on one of the latest builds, 2018.3253: same behavior. 

That’s a great demo project. It will make the perfect bug report. Please use the Report a Bug link and provide the zip file with your submission and provide a good description. This definitely looks like a bug, or at least the documentation needs updated.

Rob

Opened it:

http://support.coronalabs.com/helpdesk/Ticket/13821616

I have been receiving complaints from users that the sound controls stopped working when they updated to iOS 11.3.

It seems that the method to set master volume control with no channel, ie.

audio.setVolume(0)

is not working on this version of iOS. 

A fix would be great since implementing master volume on a per-channel basis would be very fiddly with things fading in/out etc…

I’ve updated the bug report with a link the the forum and it’s apparent iOS 11.3 related change.

Rob

Affects some android devices too!

Are we going to have a fix soon?

Thank you!

Daily build 2018.3297 should address this on Apple at least. We were unaware of this impacting Android.  However, we recommend 3301 at a minimum because of an Android build issue with Android 4.1 and earlier.

Rob

Great, thank you!

@PewPew,

I haven’t had a chance to update and am using 2018.3297.  That said, I’m not seeing an issue with audio on Android.

I made a test app:

Source: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/05/audioTest.zip

APK: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/05/audioTest_APK.zip

Please try the app and see if you and I are doing something different.  If so, please add a test to the app or change one of the tests to duplicate your issue, then share a zip file of the updated test here.

To share a zip,

  1. Make a post.

  2. Click ‘More Reply Options’ below and to right

  3. Attach zip file and upload it using new buttons exposed by step 2

Hello roaminggamer!

I wish it was that simple!

The problem was in specific devices (which I don’t own) with specific os versions.

Daily build 2018.3297 solved it though :slight_smile:

Thank you!

Builds never update, so if it was working on on 3184 a month ago and it’s not working today on 3184, it’s most likely something you’ve changed. 

Did you make other changes around audio?

Rob

No other change. I developed a couple of games and published them. I’m sure that no changes have been done during this period at the audio compartment, and I’m sure that audio.setVolume(0) worked perfectly until a couple of weeks ago. Some days ago, while I was trying a new release of the second game, I noticed on my device that the icon I used to mute the sound didn’t work anymore. Same on the simulator. So, I’ve tried the first game, where I had a similar switch, and noticed that the same thing happened. Very strange.

**JUST UPDATED EXAMPLE TO FOLLOW YOURS MORE CLOSELY @ 1032 PST 03 APR 2018**

Tip: If you’re going to assert something doesn’t work, you should make a TINY standalone example and link it in your post as a zip file. 
 
To make this easy for you, I provide a basic starter you can use to make problem examples.
 
AskEd Starter:  https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/askEdStarter.zip
 
Using the starter, I made an example demonstrating that this feature is working as expected https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/04/audioTest.zip

local track = audio.loadStream( "Discovery Hit.mp3" ) local channel = audio.findFreeChannel(1) audio.reserveChannels( channel ) audio.play( track, { loops = -1, channel = channel } ) timer.performWithDelay( 2000, function() audio.setVolume(0, { channel = channel }) end )

 
 
By making a tiny example, you:

  • Verify the problem outside the scope of your project.
  • Give us an easy way to investigate and help.  Otherwise you’re asking us to write code to debug your issue.
  • Prepare for filing a bug if there is one.  i.e. You need to provide a TINY sample to file a bug anyways.

attaching_files.jpg

Also, as this is my first response to a post of yours:

  1. Welcome to the community.

  2. For your future information, be aware there are tons of great docs and examples out there, so you are in the right place for game and app making:

Again, welcome and happy developing!

Hello. Thanks for your reply.

It wasn’t my intention to ask for someone to wrote any code for me. I apologize.

BTW, I tested your example and it worked as expected, but this was also said by me in my first post: if I chose a channel, the command worked well. If I don’t reserve a channel and just use audio.setVolume(0), the audio simply doesn’t stop. This is very strange. I looked at the same app on the Android phone of my son and the audio switch worked, but it didn’t on my Mac and on my iPhone too.

I’m really sure that it did some days ago. I can confirm it because I developed my game using the same code and I should had been crazy to not notice it, isn’t it ?  :slight_smile:

I attached the modded code that doesn’t work for me. I tried it on 2017.3184 and also on one of the latest builds, 2018.3253: same behavior.