亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fifosamplebuffer.cpp

?? Audacity是一款用於錄音和編輯聲音的、免費的開放源碼軟體。它可以執行於Mac OS X、Microsoft Windows、GNU/Linux和其它作業系統
?? CPP
字號:
/*****************************************************************************
 *
 * A buffer class for temporarily storaging sound samples, operates as a 
 * first-in-first-out pipe.
 *
 * Samples are added to the end of the sample buffer with the 'putSamples' 
 * function, and are received from the beginning of the buffer by calling
 * the 'receiveSamples' function. The class automatically removes the 
 * outputted samples from the buffer, as well as grows the buffer size 
 * whenever necessary.
 *
 * Author        : Copyright (c) Olli Parviainen
 * Author e-mail : oparviai @ iki.fi
 * File created  : 13-Jan-2002
 *
 * Last changed  : $Date: 2004/03/14 15:51:43 $
 * File revision : $Revision: 1.1.1.1 $
 *
 * $Id: FIFOSampleBuffer.cpp,v 1.1.1.1 2004/03/14 15:51:43 mbrubeck Exp $
 *
 * License :
 * 
 *  SoundTouch sound processing library
 *  Copyright (c) Olli Parviainen
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *****************************************************************************/

#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <assert.h>
#include <stdexcept>

#include "FIFOSampleBuffer.h"

using namespace soundtouch;

// Constructor
FIFOSampleBuffer::FIFOSampleBuffer(uint numChannels)
{
    sizeInBytes = 0; // reasonable initial value
    buffer = NULL;  //new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE)];
    bufferUnaligned = NULL;
    samplesInBuffer = 0;
    bufferPos = 0;
    channels = numChannels;
}


// destructor
FIFOSampleBuffer::~FIFOSampleBuffer()
{
    delete[] bufferUnaligned;
}


// Sets number of channels, 1 = mono, 2 = stereo
void FIFOSampleBuffer::setChannels(const uint numChannels)
{
    uint usedBytes;

    usedBytes = channels * samplesInBuffer;
    channels = numChannels;
    samplesInBuffer = usedBytes / channels;
}


// if output location pointer 'bufferPos' isn't zero, 'rewinds' the buffer and
// zeroes this pointer by copying samples from the 'bufferPos' pointer 
// location on to the beginning of the buffer.
void FIFOSampleBuffer::rewind()
{
    if (bufferPos) 
    {
        memmove(buffer, ptrBegin(), sizeof(SAMPLETYPE) * channels * samplesInBuffer);
        bufferPos = 0;
    }
}


// Adds 'numSamples' pcs of samples from the 'samples' memory position to 
// the sample buffer.
void FIFOSampleBuffer::putSamples(const SAMPLETYPE *samples, uint numSamples)
{
    memcpy(ptrEnd(numSamples), samples, sizeof(SAMPLETYPE) * numSamples * channels);
    samplesInBuffer += numSamples;
}


// Increases the number of samples in the buffer without copying any actual
// samples.
//
// This function is used to update the number of samples in the sample buffer
// when accessing the buffer directly with 'ptrEnd' function. Please be 
// careful though!
void FIFOSampleBuffer::putSamples(uint numSamples)
{
    uint req;

    req = samplesInBuffer + numSamples;
    ensureCapacity(req);
    samplesInBuffer += numSamples;
}


// Returns a pointer to the end of the used part of the sample buffer (i.e. 
// where the new samples are to be inserted). This function may be used for 
// inserting new samples into the sample buffer directly. Please be careful! 
//
// Parameter 'slackCapacity' tells the function how much free capacity (in
// terms of samples) there _at least_ should be, in order to the caller to
// succesfully insert all the required samples to the buffer. When necessary, 
// the function grows the buffer size to comply with this requirement.
//
// When using this function as means for inserting new samples, also remember 
// to increase the sample count afterwards, by calling  the 
// 'putSamples(numSamples)' function.
SAMPLETYPE *FIFOSampleBuffer::ptrEnd(uint slackCapacity) 
{
    ensureCapacity(samplesInBuffer + slackCapacity);
    return buffer + samplesInBuffer * channels;
}


// Returns a pointer to the beginning of the currently non-outputted samples. 
// This function is provided for accessing the output samples directly. 
// Please be careful!
//
// When using this function to output samples, also remember to 'remove' the
// outputted samples from the buffer by calling the 
// 'receiveSamples(numSamples)' function
SAMPLETYPE *FIFOSampleBuffer::ptrBegin() const
{
    return buffer + bufferPos * channels;
}


// Ensures that the buffer has enought capacity, i.e. space for _at least_
// 'capacityRequirement' number of samples. The buffer is grown in steps of
// 4 kilobytes to eliminate the need for frequently growing up the buffer,
// as well as to round the buffer size up to the virtual memory page size.
void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement)
{
    SAMPLETYPE *tempUnaligned, *temp;

    if (capacityRequirement > getCapacity()) 
    {
        // enlarge the buffer in 4kbyte steps (round up to next 4k boundary)
        sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & -4096;
        assert(sizeInBytes % 2 == 0);
        tempUnaligned = new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE) + 16 / sizeof(SAMPLETYPE)];
        if (tempUnaligned == NULL)
        {
            throw std::runtime_error("Couldn't allocate memory!\n");
        }
        temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & -16);
        memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE));
        delete[] bufferUnaligned;
        buffer = temp;
        bufferUnaligned = tempUnaligned;
        bufferPos = 0;
    } 
    else 
    {
        // simply rewind the buffer (if necessary)
        rewind();
    }
}


// Returns the current buffer capacity in terms of samples
uint FIFOSampleBuffer::getCapacity() const
{
    return sizeInBytes / (channels * sizeof(SAMPLETYPE));
}


// Returns the number of samples currently in the buffer
uint FIFOSampleBuffer::numSamples() const
{
    return samplesInBuffer;
}


// Output samples from beginning of the sample buffer. Copies demanded number
// of samples to output and removes them from the sample buffer. If there
// are less than 'numsample' samples in the buffer, returns all available.
//
// Returns number of samples copied.
uint FIFOSampleBuffer::receiveSamples(SAMPLETYPE *output, uint maxSamples)
{
    uint num;

    num = (maxSamples > samplesInBuffer) ? samplesInBuffer : maxSamples;

    memcpy(output, ptrBegin(), channels * sizeof(SAMPLETYPE) * num);
    return receiveSamples(num);
}


// Removes samples from the beginning of the sample buffer without copying them
// anywhere. Used to reduce the number of samples in the buffer, when accessing
// the sample buffer with the 'ptrBegin' function.
uint FIFOSampleBuffer::receiveSamples(uint maxSamples)
{
    if (maxSamples >= samplesInBuffer)
    {
        uint temp;

        temp = samplesInBuffer;
        samplesInBuffer = 0;
        return temp;
    }

    samplesInBuffer -= maxSamples;
    bufferPos += maxSamples;

    return maxSamples;
}


// Returns nonzero if the sample buffer is empty
int FIFOSampleBuffer::isEmpty() const
{
    return (samplesInBuffer == 0) ? 1 : 0;
}


// Clears the sample buffer
void FIFOSampleBuffer::clear()
{
    samplesInBuffer = 0;
    bufferPos = 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费观看视频在线| 中文字幕一区日韩精品欧美| 久久久另类综合| 美腿丝袜亚洲三区| 欧美成人伊人久久综合网| 美女网站色91| 美脚の诱脚舐め脚责91| 日韩电影在线一区| 欧美不卡一区二区三区四区| 欧美一级黄色片| 成人晚上爱看视频| 亚洲激情一二三区| 日韩欧美一级精品久久| 91亚洲精品一区二区乱码| 91在线免费看| 日本亚洲三级在线| 国产专区综合网| 一区二区三区中文字幕| 精品久久五月天| 欧美国产97人人爽人人喊| 欧美日韩精品欧美日韩精品一 | 色噜噜偷拍精品综合在线| 日韩精品每日更新| 亚洲欧美日韩综合aⅴ视频| xfplay精品久久| 欧美电影影音先锋| 91麻豆免费看| 欧美精品视频www在线观看 | 国产精品久久久久久亚洲毛片| 欧美三级欧美一级| 色婷婷综合久久久久中文| 久久www免费人成看片高清| 亚洲大尺度视频在线观看| 国产精品久久久久久久久免费桃花| 亚洲久本草在线中文字幕| 日本亚洲最大的色成网站www| 国产一区二区三区久久悠悠色av| 青青草视频一区| 日韩成人一区二区三区在线观看| 欧美a一区二区| aaa欧美大片| 波多野结衣亚洲| 欧美乱妇23p| 亚洲天堂网中文字| 亚洲视频一二三| 久久成人麻豆午夜电影| 99久久国产免费看| 精品免费国产二区三区| 亚洲午夜免费视频| 午夜av区久久| 美女视频网站久久| 日本韩国欧美在线| 日本一区二区综合亚洲| 精品一区二区成人精品| 福利一区福利二区| 成人黄页毛片网站| 久久天天做天天爱综合色| 成人av在线播放网站| 精品一区二区三区在线播放| 亚洲电影一级黄| 综合久久久久综合| 专区另类欧美日韩| 中文字幕永久在线不卡| 亚洲视频一区在线| 欧美影院午夜播放| 丝袜美腿亚洲色图| 欧美电视剧在线看免费| 日本乱人伦aⅴ精品| 91免费视频网| 国产精品久久久久久久久免费桃花 | 视频在线观看91| 91天堂素人约啪| 亚洲特级片在线| 91免费观看视频在线| 自拍偷在线精品自拍偷无码专区| 国产一区高清在线| 久久久影视传媒| 国产一区欧美日韩| 久久久久久久久免费| 国产寡妇亲子伦一区二区| 国产成人精品免费| 久久精品视频一区二区| 亚洲成人先锋电影| 欧美日本国产视频| 免费在线成人网| 欧美成人乱码一区二区三区| 久久超碰97人人做人人爱| www亚洲一区| 国产精品91一区二区| 欧美日韩午夜在线| 蜜桃视频在线一区| 亚洲精品一区二区三区四区高清 | 成人h动漫精品| 日韩一区欧美小说| 在线一区二区视频| 热久久久久久久| 久久综合九色综合欧美亚洲| 国产精品99久久久久久宅男| 欧美国产精品中文字幕| 日本高清无吗v一区| 日韩激情av在线| 久久久精品国产免费观看同学| 成人av在线看| 午夜精品久久久久久久99水蜜桃| 日韩一级完整毛片| 国v精品久久久网| 洋洋av久久久久久久一区| 欧美一区二区播放| 亚洲6080在线| 久久亚洲一区二区三区四区| www.欧美日韩| 日韩精品一级二级 | 午夜精品久久久久久久| 久久综合九色综合97_久久久| 成人免费av在线| 青青国产91久久久久久| 国产欧美日韩不卡| 欧美精品日韩综合在线| 国v精品久久久网| 日韩二区三区在线观看| 中文字幕亚洲一区二区va在线| 欧美精品一二三| 色综合久久中文综合久久97| 久久99久国产精品黄毛片色诱| 国产精品麻豆欧美日韩ww| 懂色av一区二区三区免费观看| 一区二区三区在线看| 欧美国产精品一区二区| 欧美成人性战久久| 欧美色视频在线| 99热精品国产| 国产精品99久久久久久似苏梦涵| 视频一区中文字幕国产| 亚洲欧美视频在线观看视频| 久久久天堂av| 日韩欧美电影一区| 欧美午夜精品免费| 色悠悠久久综合| 波多野结衣视频一区| 国产精品一区二区果冻传媒| 免费人成在线不卡| 视频一区二区三区在线| 亚洲一区二区精品久久av| 欧美一区二区精品| 欧美日韩另类一区| 99在线精品免费| 成人中文字幕在线| 国产综合一区二区| 国模冰冰炮一区二区| 久久精品国产精品亚洲综合| 日韩精品三区四区| 偷偷要91色婷婷| 日韩影院免费视频| 无码av免费一区二区三区试看| 亚洲国产日韩精品| 亚洲高清在线精品| 日韩国产成人精品| 免费在线看成人av| 狠狠狠色丁香婷婷综合久久五月| 久久不见久久见免费视频1| 久久99国产精品麻豆| 精品综合免费视频观看| 国产寡妇亲子伦一区二区| 欧美日韩夫妻久久| 国产成人免费视频网站高清观看视频| 91在线你懂得| 色欧美片视频在线观看| 欧美色视频一区| 制服丝袜成人动漫| 国产精品主播直播| 成人国产在线观看| 欧洲av在线精品| 成人综合婷婷国产精品久久免费| 国产福利精品一区| 色综合天天在线| 另类综合日韩欧美亚洲| 国产精品一区二区视频| 成人黄动漫网站免费app| 在线视频综合导航| 欧美一区二区女人| 中文字幕不卡三区| 午夜av一区二区三区| 久久国产欧美日韩精品| av亚洲产国偷v产偷v自拍| 在线中文字幕一区二区| 精品美女一区二区| 亚洲狼人国产精品| 黄色精品一二区| 欧洲精品中文字幕| 精品国产亚洲一区二区三区在线观看| 久久日韩粉嫩一区二区三区| 一区二区三区中文在线| 久久99热这里只有精品| 91丨porny丨国产入口| 日韩一区二区三区免费观看| 中文字幕精品综合| 日韩电影在线一区二区| 99re66热这里只有精品3直播| 7777精品伊人久久久大香线蕉的 | 精品在线免费视频|