Source Code (Use browser search to find items of interest.)

Class Index

kmidi'MeterWidget (./kdemultimedia/kmidi/kmidi.h:88)

class MeterWidget : public QWidget {

	Q_OBJECT
public:
    MeterWidget( QWidget *parent=0, const char *name=0 );
   ~MeterWidget();
    QTimer     *metertimer;
    QColor	led_color;
    QColor	background_color;
public slots:
    void	remeter();
protected:
    void	paintEvent( QPaintEvent * );
private:

};



kmidi'MeterWidget::remeter() (./kdemultimedia/kmidi/kmidi.cpp:423)

void MeterWidget::remeter()
{
        QPainter paint( this );
	QPen greenpen(led_color, 3);
	QPen yellowpen(yellow, 3);
	QPen erasepen(background_color, 3);
	static int lastvol[MAXDISPCHAN],
	 lastamp[MAXDISPCHAN],
	 last_sustain[MAXDISPCHAN],
	 last_expression[MAXDISPCHAN],
	 last_panning[MAXDISPCHAN],
	 last_reverberation[MAXDISPCHAN],
	 last_chorusdepth[MAXDISPCHAN],
	 last_volume[MAXDISPCHAN],
	 meterpainttime = 0;
	int ch, x1, y1, slot, amplitude, notetime, chnotes;

	if (currplaytime + meterfudge < meterpainttime || Panel->reset_panel == 10) {
		erase();
		for (ch = 0; ch < MAXDISPCHAN; ch++) {
			lastvol[ch] =
			lastamp[ch] =
			last_expression[ch] =
			last_reverberation[ch] =
			last_chorusdepth[ch] =
			last_volume[ch] =
			last_sustain[ch] = 0;
			last_panning[ch] = 64;
			for (slot = 0; slot < NQUEUE; slot++)
			    Panel->ctime[slot][ch] = -1;
		}
		Panel->reset_panel = 9;
	}
	meterpainttime = currplaytime + meterfudge;

	if (Panel->reset_panel) {
		Panel->reset_panel--;
		return;
	}

	for (ch = 0; ch < MAXDISPCHAN; ch++) {
		x1 = BAR_LM + (ch & 0x0f) * BAR_WID;
		if (ch >= MAXDISPCHAN/2) x1 += BAR_WID / 2;
		amplitude = -1;
		chnotes = 0;

		for (slot = 0; slot < NQUEUE; slot++) {
		  int tmp;
		  notetime = Panel->ctime[slot][ch];
		  if (notetime != -1 && notetime <= meterpainttime) {
		    if (chnotes < Panel->notecount[slot][ch])
		        chnotes = Panel->notecount[slot][ch];
		    if (amplitude < Panel->ctotal[slot][ch])
			amplitude = Panel->ctotal[slot][ch];
		    last_sustain[ch] = Panel->ctotal_sustain[slot][ch];
		    if (ch < 16) {
		      tmp = Panel->expression[slot][ch];
		      if (last_expression[ch] != tmp) {
		        last_expression[ch] = tmp;
			channelwindow->c_flags[ch] = Panel->c_flags[ch];
			channelwindow->setExpression(ch, tmp);
		      }
		      tmp = Panel->reverberation[slot][ch];
		      if (last_reverberation[ch] != tmp) {
		        last_reverberation[ch] = tmp;
			channelwindow->setReverberation(ch, tmp);
		      }
		      tmp = Panel->chorusdepth[slot][ch];
		      if (last_chorusdepth[ch] != tmp) {
		        last_chorusdepth[ch] = tmp;
			channelwindow->setChorusDepth(ch, tmp);
		      }
		      tmp = Panel->volume[slot][ch];
		      if (last_volume[ch] != tmp) {
		        last_volume[ch] = tmp;
			channelwindow->c_flags[ch] = Panel->c_flags[ch];
			channelwindow->setVolume(ch, tmp);
		      }
		      tmp = Panel->panning[slot][ch];
		      if (tmp < 128 && last_panning[ch] != tmp) {
		        last_panning[ch] = tmp;
			channelwindow->setPanning(ch, tmp);
		      }
		    }
		    Panel->ctime[slot][ch] = -1;
		  }
		} // for each slot


		if (amplitude < 0 && lastamp[ch]) {
			if (Panel->c_flags[ch] & FLAG_PERCUSSION)
				amplitude = lastamp[ch] - 4*DELTA_VEL;
			else amplitude = lastamp[ch] - DELTA_VEL;
			if (amplitude < 0) amplitude = 0;
		}

		if (amplitude != -1) {
			lastamp[ch] = amplitude;
			amplitude += last_sustain[ch];
			if (amplitude > 127) amplitude = 127;
			y1 = (amplitude * BAR_HGT) / 127;
			if (y1 > BAR_HGT) y1 = BAR_HGT;
			if (y1 < lastvol[ch]) {
				paint.setPen( erasepen );
	    			paint.drawLine( x1, BAR_TM, x1, BAR_BOT - y1 );
			}
			else if (y1 > lastvol[ch]) {
				if (Panel->c_flags[ch] & FLAG_PERCUSSION) paint.setPen( yellowpen );
					else paint.setPen( greenpen );
	    			paint.drawLine( x1, BAR_BOT - y1, x1, BAR_BOT );
			}
			lastvol[ch] = y1;
		}
	} // for each ch
}


kmidi'MeterWidget::paintEvent() (./kdemultimedia/kmidi/kmidi.cpp:539)

void MeterWidget::paintEvent( QPaintEvent * )
{
	remeter();
}


kmidi'MeterWidget::MeterWidget() (./kdemultimedia/kmidi/kmidi.cpp:544)

MeterWidget::MeterWidget( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    metertimer = new QTimer( this );
    connect( metertimer, SIGNAL(timeout()), SLOT(remeter()) );
    metertimer->start( 80, FALSE );
}



kmidi'MeterWidget::~MeterWidget() (./kdemultimedia/kmidi/kmidi.cpp:553)

MeterWidget::~MeterWidget()
{
}