本文整理汇总了C++中Sampler::getGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ Sampler::getGroup方法的具体用法?C++ Sampler::getGroup怎么用?C++ Sampler::getGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sampler
的用法示例。
在下文中一共展示了Sampler::getGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotSaveSamplerBank
void SamplerBank::slotSaveSamplerBank(double v) {
if (v == 0.0f)
return;
QString s = QFileDialog::getSaveFileName(NULL, tr("Save Sampler Bank"));
QFile file(s);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::warning(NULL,
tr("Error Saving Sampler Bank"),
tr("Could not write the sampler bank to '%1'.").arg(s));
return;
}
QDomDocument doc("SamplerBank");
QDomElement root = doc.createElement("samplerbank");
doc.appendChild(root);
for (unsigned int i = 0; i < m_pPlayerManager->numSamplers(); ++i) {
Sampler* pSampler = m_pPlayerManager->getSampler(i);
QDomElement samplerNode = doc.createElement(QString("sampler"));
samplerNode.setAttribute("group", pSampler->getGroup());
TrackPointer pTrack = PlayerInfo::instance().getTrackInfo(pSampler->getGroup());
if (pTrack) {
QString samplerLocation = pTrack->getLocation();
samplerNode.setAttribute("location", samplerLocation);
}
root.appendChild(samplerNode);
}
QString docStr = doc.toString();
file.write(docStr.toUtf8().constData());
file.close();
}
示例2: slotSaveSamplerBank
void SamplerBank::slotSaveSamplerBank(double v) {
if (v == 0.0 || m_pPlayerManager == NULL) {
return;
}
QString filefilter = tr("Mixxx Sampler Banks (*.xml)");
QString samplerBankPath = QFileDialog::getSaveFileName(
NULL, tr("Save Sampler Bank"),
QString(),
tr("Mixxx Sampler Banks (*.xml)"),
&filefilter);
if (samplerBankPath.isNull() || samplerBankPath.isEmpty()) {
return;
}
// Manually add extension due to bug in QFileDialog
// via https://bugreports.qt-project.org/browse/QTBUG-27186
// Can be removed after switch to Qt5
QFileInfo fileName(samplerBankPath);
if (fileName.suffix().isEmpty()) {
QString ext = filefilter.section(".",1,1);
ext.chop(1);
samplerBankPath.append(".").append(ext);
}
// The user has picked a new directory via a file dialog. This means the
// system sandboxer (if we are sandboxed) has granted us permission to this
// folder. We don't need access to this file on a regular basis so we do not
// register a security bookmark.
QFile file(samplerBankPath);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::warning(NULL,
tr("Error Saving Sampler Bank"),
tr("Could not write the sampler bank to '%1'.")
.arg(samplerBankPath));
return;
}
QDomDocument doc("SamplerBank");
QDomElement root = doc.createElement("samplerbank");
doc.appendChild(root);
for (unsigned int i = 0; i < m_pPlayerManager->numSamplers(); ++i) {
Sampler* pSampler = m_pPlayerManager->getSampler(i + 1);
if (pSampler == NULL) {
continue;
}
QDomElement samplerNode = doc.createElement(QString("sampler"));
samplerNode.setAttribute("group", pSampler->getGroup());
TrackPointer pTrack = pSampler->getLoadedTrack();
if (pTrack) {
QString samplerLocation = pTrack->getLocation();
samplerNode.setAttribute("location", samplerLocation);
}
root.appendChild(samplerNode);
}
QString docStr = doc.toString();
file.write(docStr.toUtf8().constData());
file.close();
}