本文整理汇总了C++中CSound::frames方法的典型用法代码示例。如果您正苦于以下问题:C++ CSound::frames方法的具体用法?C++ CSound::frames怎么用?C++ CSound::frames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSound
的用法示例。
在下文中一共展示了CSound::frames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSound
void CControlWidget::createSound(QIODevice *stream)
{
QList<QtMiniSEEDRecord *> recordList;
QtMiniSEEDDecoder miniseedDecoder;
int totalFrameCount = 0;
// 1: Read all records from the stream and calculate total samples
// we ignore the gap/overlap in the original trace
QtMiniSEEDRecord *rec;
while ((rec = miniseedDecoder.readRecord(stream)))
{
totalFrameCount += rec->sampleCount();
recordList.push_back(rec);
}
if (totalFrameCount > 0)
{
// 2: create sound object
CSound snd;
snd.setSampleRate(m_lastTraceItem->sampleRate());
snd.resize(totalFrameCount);
snd.setProperty(CSound::Software, "Qarthbeat");
snd.setProperty(CSound::Artist, QString("event%1").arg(m_lastTraceItem->eventItem()->eventId()));
snd.setProperty(CSound::Title, QString("%1.%2.%3.%4")
.arg(m_lastTraceItem->fdsn())
.arg(m_lastTraceItem->station())
.arg(m_lastTraceItem->location().trimmed())
.arg(m_lastTraceItem->channel()));
snd.setProperty(CSound::Comment, m_reply->request().url().toString());
// 3: unpack the samples and write it to the sound object
int currentFrame = -1;
qint32 tmpFrames[10240];
float *soundFrames = snd.frames();
foreach (QtMiniSEEDRecord *rec, recordList)
{
rec->unpack(&tmpFrames, 0, rec->sampleCount());
for (int i = 0; i < rec->sampleCount(); ++i)
{
soundFrames[++currentFrame] = tmpFrames[i];
}
}