Author Topic: How can i know the sound status ?  (Read 318 times)

terry_zhou82

  • Posts: 19
How can i know the sound status ?
« on: 18 Jun '17 - 14:34 »
hello,guy,
I Use the code to mute the sound
BASS_ChannelSetAttribute(chan, BASS_ATTRIB_VOL, 0);
and now, I want to check the sound stautus: mute or not mute, I use this code,but It doesn't work;
IF BASS_ChannelGetAttribute(chan, BASS_ATTRIB_VOL, 0) then
......
maybe I 've got the wrong code ?
Thank you

saga

  • Posts: 2171
Re: How can i know the sound status ?
« Reply #1 on: 18 Jun '17 - 21:57 »
Read the documentation for BASS_ChannelGetAttribute. The return value just indicates successs of the attribute retrieval.
You need to supply the variable that should receive the actual value of the attribute as a pointer in the third parameter. Currently you provide a null-pointer there.

terry_zhou82

  • Posts: 19
Re: How can i know the sound status ?
« Reply #2 on: 19 Jun '17 - 16:07 »
I Look the document about the function,but I don't know how to put the code:
value
Pointer to a variable to receive the attribute value.  //what can I to put the value? 0:is true,1 is false;


saga

  • Posts: 2171
Re: How can i know the sound status ?
« Reply #3 on: 19 Jun '17 - 16:26 »
You need to state which language you are working in because working with pointers don't look the same everywhere.

terry_zhou82

  • Posts: 19
Re: How can i know the sound status ?
« Reply #4 on: 19 Jun '17 - 16:57 »
You need to state which language you are working in because working with pointers don't look the same everywhere.

I'm so sorry,but I dont know what do you mean ?
I use the delphi for programe.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: How can i know the sound status ?
« Reply #5 on: 19 Jun '17 - 17:01 »
In Delphi, you could do something like this:

Code: [Select]
vol: single;

BASS_ChannelGetAttribute(chan, BASS_ATTRIB_VOL, vol); ' get volume setting
if (vol = 0) then ... ' muted

terry_zhou82

  • Posts: 19
Re: How can i know the sound status ?
« Reply #6 on: 21 Jun '17 - 09:43 »
Thank you,guy ! I love you  :-* :-* :-* :-* :-*

In Delphi, you could do something like this:

Code: [Select]
vol: single;

BASS_ChannelGetAttribute(chan, BASS_ATTRIB_VOL, vol); ' get volume setting
if (vol = 0) then ... ' muted

firstname

  • Posts: 10
Re: How can i know the sound status ?
« Reply #7 on: 22 Jun '17 - 13:23 »
Here is some code - https://cloud.mail.ru/public/84w9/dhExAMTxt, nothing seriously interesting, but nonetheless.

Code created in Delphi 10.1 Berlin.

firstname

  • Posts: 10
Re: How can i know the sound status ?
« Reply #8 on: 26 Jun '17 - 11:59 »
I'm sorry, have done some editing code above with improvements, looks like I should create a special forum thread for that, if mods will accept it.

Take a look anyone, if interesting just for fun - https://cloud.mail.ru/public/829S/qgkgczN7m