discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Regarding gr_squelch_base_cc.cc


From: Mattias Kjellsson
Subject: [Discuss-gnuradio] Regarding gr_squelch_base_cc.cc
Date: Thu, 29 Apr 2010 10:55:57 +0200
User-agent: Thunderbird 2.0.0.24 (X11/20100411)

Hi list,
I was looking at the gr_pwr_squelch_cc- code, and there is a thing I just want to check the meaning of. It is not as much that I don't believe the code works correctly, it's just that some lines of code confuse and scare me. ;)

The lines are 59 and 64,
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;
61:
62: case ST_UNMUTED:
63: if (mute())
64: d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted
65: break;

It might be that I don't fully understand the "?"- construct, but if I try to translate line 64 into an if- statement, I would do it (with my understanding) to something like:

if(d_state = d_ramp){
   d_state = ST_DECAY;
}
else{
   d_state = ST_MUTED;
}

But this can't be the way since this will always set d_state = ST_DECAY (?) Or it could be the way, but in that case... Why the crazy ?- construct?

As I said earlier, I'm scared and confused, since the code does it's job but it looks very... Suspicious

BR
Mattias




reply via email to

[Prev in Thread] Current Thread [Next in Thread]