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


C++ TimeStamp::getMinutes方法代码示例

本文整理汇总了C++中TimeStamp::getMinutes方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeStamp::getMinutes方法的具体用法?C++ TimeStamp::getMinutes怎么用?C++ TimeStamp::getMinutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeStamp的用法示例。


在下文中一共展示了TimeStamp::getMinutes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

//This function should be called every tick/frame. This used the previous functions to
//Update time, get the current spectrum and the adaptive threshold and then does a check
//to see if a beat has occured. It also allows for some post-detection ignore clause.
//This function also does functions such as update the smoothing median list, create a
//timestamp object, update the lastBeatRegistered and checks to see if the song
//is still playing
bool BeatDetectorLite::update(float* left, float* right, int length) {
    float* stereo = (float*) malloc(length * sizeof(float));
    for(int i = 0; i < length; i++) {
        stereo[i] = left[i] + right[i];
    }

    if(previousFFT == NULL) {
        previousFFT = stereo;
        return false;
    }

    beatThreshold = calculateFluxAndSmoothing(stereo);

    //Beat detected
    if (specFlux > beatThreshold && (clock() - timeBetween) > 350)
    {
        smootherValues.push_back(specFlux);

        if (smootherValues.size() >= 5)
        {
            smootherValues.erase(smootherValues.begin());
        }

        timeBetween = clock();

        TimeStamp* t = new TimeStamp(currentMinutes, currentSeconds, currentMillis, specFlux);
        std::cout << "BEAT AT: " << t->getMinutes() << ":" << t->getSeconds() << ":" << t->getMilliseconds() << " -- BEAT FREQ: " << t->getFrequency() << " -- THRESHOLD: " << beatThreshold << std::endl;
        lastBeatRegistered = t;
        return true;
    }
    else if ((clock() - timeBetween) > 5000)
    {
        if (thresholdSmoother>0.4f)
            thresholdSmoother -= 0.4f;

        timeBetween = clock();
        return false;
    }

    return false;
}
开发者ID:calper95,项目名称:HackathonSoundBlaster,代码行数:47,代码来源:BeatDetectorLite.cpp


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