tsoundoutthread.cpp

来自「QAM module to use in Java with an easy i」· C++ 代码 · 共 42 行

CPP
42
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "TSoundOutThread.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------

__fastcall SoundOut::SoundOut(Modulator *Modulator,CSound *Sound,int BufferSize,TThreadPriority tPriority)
        : TThread(true)
{
        Data.resize(BufferSize);
        mod=Modulator;
        pSound=Sound;
        FreeOnTerminate=false;
        Priority=tPriority;
        CntTo=Data.size()-1;
        OnTerminate=FinshedEvent;
        Finished=false;
        Resume();
}

void __fastcall SoundOut::FinshedEvent(TObject* Sender)
{
        Finished=true;
}

//---------------------------------------------------------------------------
void __fastcall SoundOut::Execute()
{
        while(!Terminated)
        {
                mod->Update(Data.begin(),CntTo);
                pSound->Write(Data);
        }
}
//---------------------------------------------------------------------------



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?