Exemplo n.º 1
0
void SampleParams::updateSampleInfo()
{
	ui->namLabel->setText(mySample->name());
	ui->filenameLabel->setText(mySample->fileName());
	ui->durationLabel->setText(msToString(mySample->length()));
	switch (mySample->loopType())
	{
	case Sample::SimpleLoop:
		ui->simpleLoopRadio->setChecked(true);
		break;
	case Sample::AutoLoop:
		ui->autoLoopRadio->setChecked(true);
		break;
	default:
		ui->noLoopRadio->setChecked(true);
		break;
	}

	QMap<Qt::Key, QString> kbdKeys = KeyboardKey::getKeysMap();
	foreach(Qt::Key key, kbdKeys.keys())
		ui->keyCombo->addItem("Key " + kbdKeys.value(key), int(key));
	for (int i = 0; i < ui->keyCombo->count(); i++)
	{
		if ((Qt::Key)ui->keyCombo->itemData(i).toInt() == mySample->key().key())
		{
			ui->keyCombo->setCurrentIndex(i);
			break;
		}
	}
	ui->volumeSlider->setValue(mySample->getVolume());
	ui->panDial->setValue(mySample->getPan());
}
Exemplo n.º 2
0
void PlaybackWidget::update()
{
    //Check if the song is finished, and request the next one from playlist
    if(state == PLAYING && !BASS_ChannelIsActive(curchan))
    {
        state = STOPPED;
        emit songOver();
    }
    //Now update the gui elements
    QWORD pos = BASS_ChannelGetPosition(curchan, BASS_POS_BYTE);
    int ms = BASS_ChannelBytes2Seconds(curchan, pos);
    float ratio = (float)ms/cursonglength;
    ui.playedLbl->setText(msToString(ms));
    ui.totalLbl->setText("-" + msToString(cursonglength - ms));
    int val = ratio*ui.playSlider->maximum();
    ui.playSlider->setValue(val);
}