On Thu, Apr 29, 2010 at 01:55, Mattias Kjellsson <[email protected]> wrote:
> 57: case ST_MUTED: > 58: if (!mute()) > 58: d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go > straight to unmuted > 60: break; The 'condition ? expr1 : expr2' construct is an expression that evaluations to 'expr1' if 'condition' is true, otherwise it evaluates to 'expr2'. Here, 'condition' is d_ramp, 'expr1' is ST_ATTACK, and 'expr2' is ST_UNMUTED. Thus, line 58 says: "Assign to d_state the value of 'ST_ATTACK' if d_ramp is true, otherwise assign to d_state the value of 'ST_UNMUTED'." In other words, the variable d_state is the left side of an assignment, and the right side of the assignment evaluates to either ST_ATTACK or ST_UNMUTED, depending on whether d_ramp is true. It may help to mentally parse line 58 with parenthesis just before 'd_ramp' and after 'ST_UNMUTED'. Specifically, this is *not* a test of the value of d_state. Hope this helps with your fear and confusion :-) Johnathan _______________________________________________ Discuss-gnuradio mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
