your problem deals with the fact that Windows which uses a C/C++ among others that SetMute function does not treat a non 0 value as true but is looking for a specific value of 1 for true.,.
Infact, I wonder if the declaration of the function is even correct?
The NOT operator isn't flipping the first the first bit but instead flipping the whole container holding the boolean..
so you either have a a 0 for false or -1 for true..
that function does not work with -1 for true and because that field is most likly not treated as a boolean it should be numerical instead
So to recap on this, if you still want to use a boolean, use a LONGBOOL for the definitions instead and do this just prior to using it in the function
bState := not bstate;
LongInt(bState):=Longint(bState) and 1;
endpointVolume.SetMute(bstate, nil);
A function could be written or a helper for to force a return of 1 for true i guess.