Muting sound

General

Chimrod

6 years ago

Hello,


I've notice that the sound LED is blinking even when I mute the sound. I've checked in the library and I did not find any control for stopping to play when we mute the volume. I am right ? Is there a way to enhance this ?

Sorunome

NEW 6 years ago

There is no sound LED, what you are referring to is probably the SD card access LED which, well, blinks while playing a wav file.

That being said, the gamebuino still continues reading the wav file while the sound is muted for some time but then eventually stops. This shouldn't really be an issue, though, i can't think of a scenario where that is needed.

That being said, you are able to manually stop tracks with gb.sound.stop, like so:

int8_t track = gb.sound.play("myfile.wav");

// somewhere later in file

gb.sound.stop(track);

Chimrod

6 years ago

The solution you give requires to test inside the game if the volume is 0, then stop the music. This would be better to do that inside the API itself.


Also, all the function for getting information about the current volume level is tagged as unstable in the API..

alxm

NEW 6 years ago

Speaking of muting sound, is it normal to hear a bit of white noise from the speaker even when the volume is muted? It's only noticeable when I bring the unit close to my ears, and it seems to be there in all games including the loader.

Chimrod

NEW 6 years ago

Sorunome Sorunome

The solution you give requires to test inside the game if the volume is 0, then stop the music. This would be better to do that inside the API itself.


Also, all the function for getting information about the current volume level is tagged as unstable in the API..

Sorunome

6 years ago

Also, all the function for getting information about the current volume level is tagged as unstable in the API..

The idea is that the game doesn't need to know what you set the volume to.

Think about a PC - why does a game need to know which volume you turned external speakers to? If you want to do volume sliding effects in your game you should not modify the global volume. The sound effects, for example, have volume sliding modulation, you can use that instead.

Sorunome

NEW 6 years ago

Chimrod Chimrod

Also, all the function for getting information about the current volume level is tagged as unstable in the API..

The idea is that the game doesn't need to know what you set the volume to.

Think about a PC - why does a game need to know which volume you turned external speakers to? If you want to do volume sliding effects in your game you should not modify the global volume. The sound effects, for example, have volume sliding modulation, you can use that instead.

Chimrod

6 years ago

I complety agree with you ! Getting the volume level should not be done inside the game ; that's the reason I think that

  • stopping reading a sound from the SD card
  • ignore any sound played for the game

should be done inside the API itself.

Chimrod

NEW 6 years ago

Sorunome Sorunome

I complety agree with you ! Getting the volume level should not be done inside the game ; that's the reason I think that

  • stopping reading a sound from the SD card
  • ignore any sound played for the game

should be done inside the API itself.

Sorunome

6 years ago

If you turn your speakers to minimum teh PC will still continue playback of things, though?

Sorunome

NEW 6 years ago

Chimrod Chimrod

If you turn your speakers to minimum teh PC will still continue playback of things, though?

Chimrod

6 years ago

If it is the hardware speaker, the system just can't know it. :) If it is the software mixer I consider this a bug !

Chimrod

NEW 6 years ago

Sorunome Sorunome

If it is the hardware speaker, the system just can't know it. :) If it is the software mixer I consider this a bug !

Chimrod

NEW 6 years ago

It is frustrating because I have the feeling to not being able to explain clearly what I have in mind, and instead a constructive discussion, diving into a sterile argumentation.


Gamebuino is great by giving to the user an unified API, which allow to program using a single library which handle all the requirements. The library also fit good with the hardware. As you said, it is not in the game scope to handle the global volume : this belongs to the Gamebuino code. 


That's why I think there is an enhancement to do in the library when the user decide to mute the volume : instead of a waste of resources (battery and more), the library should stop all existing channels, without any change in the game code.

Sorunome

6 years ago

I thought about that but what could be weird is then, when you unmute, that random stuff from before you last muted suddenly still continues playing. That being said, at interrupt level nothing is been generated and that is noticeable in CPU usage, if you display that.

Sorunome

NEW 6 years ago

Chimrod Chimrod

I thought about that but what could be weird is then, when you unmute, that random stuff from before you last muted suddenly still continues playing. That being said, at interrupt level nothing is been generated and that is noticeable in CPU usage, if you display that.