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


C++ AudioBuffer::setSample方法代码示例

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


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

示例1: processFifo


//.........这里部分代码省略.........
                            changeLevel = jmax (2, changeLevel);

                        currentInfo.sourceType = SourceType::sourceAudioFile;
                        currentInfo.fileImpulseResponse = newFile;
                        currentInfo.sourceData = nullptr;
                        currentInfo.sourceDataSize = 0;
                    }
                    else if (newSourceType == SourceType::sourceAudioBuffer)
                    {
                        double bufferSampleRate (arrayParameters->getUnchecked (1));
                        changeLevel = jmax (2, changeLevel);

                        currentInfo.sourceType = SourceType::sourceAudioBuffer;
                        currentInfo.bufferSampleRate = bufferSampleRate;
                        currentInfo.fileImpulseResponse = File();
                        currentInfo.sourceData = nullptr;
                        currentInfo.sourceDataSize = 0;
                    }
                }
                break;

                case ChangeRequest::changeImpulseResponseSize:
                {
                    int64 newSize = requestParameters[n];

                    if (currentInfo.impulseResponseSize != (size_t) newSize)
                        changeLevel = jmax (1, changeLevel);

                    currentInfo.impulseResponseSize = (size_t) newSize;
                }
                break;

                case ChangeRequest::changeStereo:
                {
                    bool newWantsStereo = requestParameters[n];

                    if (currentInfo.wantsStereo != newWantsStereo)
                        changeLevel = jmax (1, changeLevel);

                    currentInfo.wantsStereo = newWantsStereo;
                }
                break;

                case ChangeRequest::changeTrimming:
                {
                    bool newWantsTrimming = requestParameters[n];

                    if (currentInfo.wantsTrimming != newWantsTrimming)
                        changeLevel = jmax(1, changeLevel);

                    currentInfo.wantsTrimming = newWantsTrimming;
                }
                break;

                default:
                    jassertfalse;
                    break;
            }
        }

        if (currentInfo.sourceType == SourceType::sourceNone)
        {
            currentInfo.sourceType = SourceType::sourceAudioBuffer;

            if (currentInfo.sampleRate == 0)
                currentInfo.sampleRate = 44100;

            if (currentInfo.maximumBufferSize == 0)
                currentInfo.maximumBufferSize = 128;

            currentInfo.bufferSampleRate = currentInfo.sampleRate;
            currentInfo.impulseResponseSize = 1;
            currentInfo.fileImpulseResponse = File();
            currentInfo.sourceData = nullptr;
            currentInfo.sourceDataSize = 0;

            AudioBuffer<float> newBuffer;
            newBuffer.setSize (1, 1);
            newBuffer.setSample (0, 0, 1.f);

            copyBufferToTemporaryLocation (newBuffer);
        }

        // action depending on the change level
        if (changeLevel == 3)
        {
            interpolationBuffer.setSize (2, static_cast<int> (currentInfo.maximumBufferSize));

            processImpulseResponse();
            initializeConvolutionEngines();
        }
        else if (changeLevel == 2)
        {
            startThread();
        }
        else if (changeLevel == 1)
        {
            startThread();
        }
    }
开发者ID:COx2,项目名称:JUCE_JAPAN_DEMO,代码行数:101,代码来源:juce_Convolution.cpp


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