当前位置: 首页>>代码示例>>C++>>正文


C++ CSound::frames方法代码示例

本文整理汇总了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];
            }
        }
开发者ID:AlekseyDurachenko,项目名称:scibeats,代码行数:42,代码来源:plugin_datasource_iris_ccontrolwidget.cpp


注:本文中的CSound::frames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。