www.pudn.com > w_ipp-sample-media_p_5.0.017.zip > umc_reverb_demoDlg.cpp
/*//////////////////////////////////////////////////////////////////////////////
//
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright(c) 2005 Intel Corporation. All Rights Reserved.
//
// Note: umc_reverb_demoDlg.cpp - implementation revereration algorithm
*/
#include "stdafx.h"
#include "umc_reverb_demo.h"
#include "umc_reverb_demoDlg.h"
#include "reverb_data.h"
using namespace UMC;
#include "directsound_render.h"
#include "umc_audio_render.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static FileInfoStruct fileInfo;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUmc_reverb_demoDlg dialog
CUmc_reverb_demoDlg::CUmc_reverb_demoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUmc_reverb_demoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUmc_reverb_demoDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CUmc_reverb_demoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUmc_reverb_demoDlg)
DDX_Control(pDX, IDC_BUTTON_PLAY, m_PlayButton);
DDX_Control(pDX, IDC_LIST, m_FileFromList);
//}}AFX_DATA_MAP
DDX_Control(pDX, IDC_CHECK_REVERB, m_ReverbEnable);
DDX_Control(pDX, IDC_CHECK_ROOMSIZE, m_RoomSizeEnable);
DDX_Control(pDX, IDC_CHECK_FINISHING, m_FinishingEnable);
DDX_Control(pDX, IDC_ROOMSIZE_SLIDER, m_RSSliderValue);
DDX_Control(pDX, IDC_FINISHING_SLIDER, m_FSliderValue);
DDX_Control(pDX, IDC_TEXT_MIN, m_TextMin);
DDX_Control(pDX, IDC_TEXT_MAX, m_TextMax);
DDX_Control(pDX, IDC_TEXT_SOFT, m_TextSoft);
DDX_Control(pDX, IDC_TEXT_HARD, m_TextHard);
DDX_Control(pDX, IDC_BUTTON_RSDEF, m_RSDef);
DDX_Control(pDX, IDC_BUTTON_FDEF, m_FDef);
DDX_Control(pDX, IDC_RSL_TEXT, m_TextRSLevel);
DDX_Control(pDX, IDC_RSL_MAX, m_TextRSLMax);
DDX_Control(pDX, IDC_RSL_MIN, m_TextRSLMin);
DDX_Control(pDX, IDC_RSL_SLIDER, m_RSLSliderValue);
}
BEGIN_MESSAGE_MAP(CUmc_reverb_demoDlg, CDialog)
//{{AFX_MSG_MAP(CUmc_reverb_demoDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_ADD, OnButtonAdd)
ON_BN_CLICKED(IDC_BUTTON_EXIT, OnButtonExit)
ON_BN_CLICKED(IDC_BUTTON_DELETE, OnButtonDelete)
ON_BN_CLICKED(IDC_BUTTON_STOP, OnButtonStop)
ON_BN_CLICKED(IDC_BUTTON_PLAY, OnButtonPlay)
ON_LBN_DBLCLK(IDC_LIST, OnDblclkList)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_CHECK_REVERB, OnBnClickedCheckReverb)
ON_BN_CLICKED(IDC_CHECK_ROOMSIZE, OnBnClickedCheckRoomsize)
ON_BN_CLICKED(IDC_CHECK_FINISHING, OnBnClickedCheckFinishing)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_ROOMSIZE_SLIDER, OnNMReleasedcaptureRoomsizeSlider)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_FINISHING_SLIDER, OnNMReleasedcaptureFinishingSlider)
ON_BN_CLICKED(IDC_BUTTON_RSDEF, OnBnClickedButtonRsdef)
ON_BN_CLICKED(IDC_BUTTON_FDEF, OnBnClickedButtonFdef)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_RSL_SLIDER, OnNMReleasedcaptureRslSlider)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUmc_reverb_demoDlg message handlers
BOOL CUmc_reverb_demoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
fileInfo.isPlaying = -1;
fileInfo.handler = CUmc_reverb_demoDlg::m_hWnd;
revInfo.reverb = FALSE;
revInfo.eReflect = FALSE;
revInfo.lReflect = FALSE;
m_RSSliderValue.SetPos(10);
m_FSliderValue.SetPos(20);
revInfo.RSSliderPos = 10;
revInfo.FSliderPos = 20;
m_RoomSizeEnable.EnableWindow(FALSE);
m_FinishingEnable.EnableWindow(FALSE);
m_RSSliderValue.EnableWindow(FALSE);
m_FSliderValue.EnableWindow(FALSE);
m_TextMin.EnableWindow(FALSE);
m_TextMax.EnableWindow(FALSE);
m_TextSoft.EnableWindow(FALSE);
m_TextHard.EnableWindow(FALSE);
m_RSDef.EnableWindow(FALSE);
m_FDef.EnableWindow(FALSE);
m_TextRSLevel.EnableWindow(FALSE);
m_RSLSliderValue.EnableWindow(FALSE);
m_TextRSLMax.EnableWindow(FALSE);
m_TextRSLMin.EnableWindow(FALSE);
m_RSLSliderValue.SetPos(10);
revInfo.LevelSliderPos = 10;
return TRUE; // return TRUE unless you set the focus to a control
}
void CUmc_reverb_demoDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CUmc_reverb_demoDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CUmc_reverb_demoDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CUmc_reverb_demoDlg::OnButtonAdd()
{
OPENFILENAME ofn;
memset(&ofn, 0, sizeof(OPENFILENAME));
char szFile[MAX_PATH_LEN] = "\0";
char szFileTitle[MAX_TITLE_LEN] = "";
char szFilter[] = "WAV Files (*.wav)\0*.wav\0";
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = this->m_hWnd;
ofn.hInstance = ::AfxGetInstanceHandle();
ofn.lpstrFile = szFile;
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFile = MAX_PATH_LEN;
ofn.nMaxFileTitle = MAX_TITLE_LEN;
ofn.lpstrFilter = szFilter;
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = "%HOMEDIR%";
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;// | OFN_ALLOWMULTISELECT;
if(::GetOpenFileName(&ofn))
{
UpdateData();
m_FileFromList.AddString(ofn.lpstrFile);
}
}
void CUmc_reverb_demoDlg::OnButtonExit()
{
CDialog::OnCancel();
}
void CUmc_reverb_demoDlg::OnButtonDelete()
{
if (m_FileFromList.GetCurSel() != LB_ERR)
{
m_FileFromList.DeleteString(m_FileFromList.GetCurSel());
}
UpdateData();
}
void CUmc_reverb_demoDlg::OnButtonStop()
{
m_PlayButton.SetWindowText("Play");
fileInfo.isPlaying = -1;
vm_thread_close(&(fileInfo.play_thread));
}
static int FillInFileStruct()
{
FILE *file_wav;
chunk_info cur_chunk;
file_wav = fopen(fileInfo.file_name, "rb");
if (file_wav == NULL) {
fileInfo.dlg->MessageBox("Failed to open file!!!", "Error", MB_ICONERROR);
return 1;
}
fread(&cur_chunk, 1, sizeof(cur_chunk), file_wav);
if (vm_string_strncmp(cur_chunk.ChunkName, "RIFF", 4) != 0) {
return 1;
}
fread(&cur_chunk.ChunkName, 1, sizeof(cur_chunk.ChunkName), file_wav);
if (vm_string_strncmp(cur_chunk.ChunkName, "WAVE", 4) != 0) {
return 1;
}
fread(&cur_chunk, 1, sizeof(cur_chunk), file_wav);
if (vm_string_strncmp(cur_chunk.ChunkName, "fmt ", 4) != 0) {
return 1;
}
fread(&(fileInfo.streamtype), 1, 2, file_wav);
if (fileInfo.streamtype != UMC::PCM_AUDIO) {
return 1;
}
fread(&(fileInfo.nchan), 1, 2, file_wav);
if ((fileInfo.nchan != 0x1) && (fileInfo.nchan != 0x2)) { //mono or stereo
fileInfo.dlg->MessageBox("This file is not a MONO one", "Error", MB_ICONERROR);
return 1;
}
fread(&(fileInfo.sRate), 1, 4, file_wav);
fseek(file_wav, 6, SEEK_CUR); //Bytes Per Second (16-19)& Bytes Per Sample (20-21)
fread(&(fileInfo.bitspersample), 1, 2, file_wav);
fseek(file_wav, cur_chunk.chunk_len - 16, SEEK_CUR);
fread(&cur_chunk, 1, sizeof(cur_chunk), file_wav);
if (vm_string_strncmp(cur_chunk.ChunkName, "fact", 4) == 0) { //fact chunk is present
fseek(file_wav, cur_chunk.chunk_len, SEEK_CUR); //length of fact
fread(&cur_chunk, 1, sizeof(cur_chunk), file_wav);
}
if (vm_string_strncmp(cur_chunk.ChunkName, "data", 4) != 0) {
return 1;
}
fileInfo.data_chunk = cur_chunk;
fileInfo.data = file_wav;
return 0;
}
static unsigned int playback_thread(void *ptr)
{
UMC::AudioRender* pRender = new UMC::DSoundAudioRender;
UMC::AudioRenderParams* pRenderParams = new UMC::AudioRenderParams;
UMC::ReverbFilter* pRevFilter = new UMC::ReverbFilter;
UMC::ReverbFilterParams* pRevParams = new UMC::ReverbFilterParams;
UMC::MediaReceiverParams* pMediaReceiverParams;
UMC::HWNDModuleContext HWNDContext;
UMC::Status umc_stat;
IppStatus ippStat;
pRenderParams->info.stream_type = (UMC::AudioStreamType)fileInfo.streamtype;
pRenderParams->info.channels = fileInfo.nchan;
pRenderParams->info.sample_frequency = fileInfo.sRate;
pRenderParams->info.bitPerSample = fileInfo.bitspersample;
/* passing the handler */
HWNDContext.m_hWnd = fileInfo.handler;
pRenderParams->pModuleContext = &HWNDContext;
/* patch */
pMediaReceiverParams = DynamicCast(pRenderParams);
umc_stat = pRender->Init(pMediaReceiverParams);
if (umc_stat != UMC::UMC_OK) {
fileInfo.dlg->MessageBox("Failed to Init render", "Error", MB_ICONERROR);
delete pRenderParams;
delete pRender;
delete pRevFilter;
delete pRevParams;
return 0;
}
Ipp16s *inBuf = ippsMalloc_16s(BUF_SIZE * fileInfo.nchan);
if (inBuf == NULL) {
fileInfo.dlg->MessageBox("Failed on malloc inBuf!!!", "", MB_ICONERROR);
delete pRenderParams;
delete pRender;
delete pRevFilter;
delete pRevParams;
return 0;
}
Ipp16s *outBuf = ippsMalloc_16s(BUF_SIZE * fileInfo.nchan);
if (outBuf == NULL) {
fileInfo.dlg->MessageBox("Failed on malloc outBuf!!!", "", MB_ICONERROR);
ippsFree(inBuf);
delete pRenderParams;
delete pRender;
delete pRevFilter;
delete pRevParams;
return 0;
}
UMC::MediaData* inData = new UMC::MediaData;
UMC::MediaData* outData = new UMC::MediaData;
inData->SetBufferPointer((unsigned char *)inBuf, BUF_SIZE * fileInfo.nchan * sizeof(Ipp16s));
outData->SetBufferPointer((unsigned char *)outBuf, BUF_SIZE * fileInfo.nchan * sizeof(Ipp16s));
/***** REVERBERATOR INIT *****/
pRevParams->fileSampleRate = fileInfo.sRate;
pRevParams->fileChannels = fileInfo.nchan;
pRevParams->maxFrameLen = BUF_SIZE;
pRevParams->eReflect = revInfo.eReflect;
pRevParams->lReflect = revInfo.lReflect;
pRevParams->eReflectScale = 0.5f + (revInfo.RSSliderPos / 10.f) * 0.5f;
pRevParams->decayTime = revInfo.FSliderPos / 20.f + 1.f;
pRevParams->outputLevel = (100 - revInfo.LevelSliderPos) * 0.01f;
int cleanLen = (int)(pRevParams->decayTime * fileInfo.sRate + 0.5);
umc_stat = pRevFilter->Init((UMC::BaseCodecParams *)pRevParams);
if (umc_stat != UMC::UMC_OK) {
fileInfo.dlg->MessageBox("Failed to Init RevFilter", "Error", MB_ICONERROR);
goto __exit;
}
int dataLen = fileInfo.data_chunk.chunk_len >> 1; //in shorts
if (fileInfo.nchan == 2) {
dataLen >>= 1;
}
while (dataLen != 0) {
if (fileInfo.isPlaying == -1) { //stop
goto __exit;
} else
if (fileInfo.isPlaying == 0) { //pause
pRender->Pause(TRUE);
continue;
}
pRender->Pause(FALSE);
if (revInfo.revParamsChanged == TRUE) {
revInfo.revParamsChanged = FALSE;
pRevParams->eReflect = revInfo.eReflect;
pRevParams->lReflect = revInfo.lReflect;
pRevParams->eReflectScale = 0.5f + (revInfo.RSSliderPos / 10.f) * 0.5f;
pRevParams->decayTime = revInfo.FSliderPos / 20.f + 1.f;
pRevParams->outputLevel = (100 - revInfo.LevelSliderPos) * 0.01f;
cleanLen = (int)(pRevParams->decayTime * fileInfo.sRate + 0.5);
umc_stat = pRevFilter->SetParams((UMC::BaseCodecParams *)pRevParams);
if (umc_stat != UMC::UMC_OK) {
fileInfo.dlg->MessageBox("Failed to check \"Room size\"!!!", "Error", MB_ICONERROR);
goto __exit;
}
}
int maxRead = (BUF_SIZE > dataLen) ? dataLen : BUF_SIZE;
int n = fread(inBuf, sizeof(Ipp16s), maxRead * fileInfo.nchan, fileInfo.data);
if (n != maxRead * fileInfo.nchan) {
if (ferror(fileInfo.data)) {
fileInfo.dlg->MessageBox("Failed on fread!!!", "", MB_ICONERROR);
goto __exit;
}
if (n == 0)
break;
else {
maxRead = n;
if (fileInfo.nchan == 2)
maxRead >>= 1;
}
}
// inData->SetDataSize(maxRead * fileInfo.nchan * sizeof(Ipp16s));
if (revInfo.reverb == TRUE) {
/* *****************************************************
* 1) sendFrame has been re-written
* 2) need use Lock & UnLock
*
*******************************************************/
UMC::Status umcRes;
do
{
umcRes = pRender->LockInputBuffer( outData );
if (UMC::UMC_NOT_ENOUGH_BUFFER == umcRes)
vm_time_sleep(5);
} while ( UMC::UMC_NOT_ENOUGH_BUFFER == umcRes );
pRevFilter->GetFrame(inData, outData);
outData->SetDataSize(maxRead * fileInfo.nchan * sizeof(Ipp16s));
umcRes = pRender->UnLockInputBuffer(outData);
// check error(s)
if (UMC::UMC_OK != umcRes)
break;
//umc_stat = pRender->SendFrame(outData);
} else {
UMC::Status umcRes;
do
{
umcRes = pRender->LockInputBuffer( outData );
if (UMC::UMC_NOT_ENOUGH_BUFFER == umcRes)
vm_time_sleep(5);
} while ( UMC::UMC_NOT_ENOUGH_BUFFER == umcRes );
Ipp16s* outBuf = (Ipp16s *)outData->GetDataPointer();
int len = (inData->GetDataSize());
memcpy(outBuf, inBuf, len);
outData->SetDataSize(maxRead * fileInfo.nchan * sizeof(Ipp16s));
umcRes = pRender->UnLockInputBuffer(outData);
// check error(s)
if (UMC::UMC_OK != umcRes)
break;
//umc_stat = pRender->SendFrame(inData);
}
if (umc_stat != UMC::UMC_OK) {
fileInfo.dlg->MessageBox("Failed on SendFrame!!!", "", MB_ICONERROR);
goto __exit;
}
dataLen -= maxRead;
}
if (revInfo.reverb == TRUE) { //the last echoes
UMC::ReverbFilterParams *pInfo = new UMC::ReverbFilterParams;
umc_stat = pRevFilter->GetInfo((UMC::BaseCodecParams *)pInfo);
if (umc_stat != UMC::UMC_OK) {
fileInfo.dlg->MessageBox("Failed to check \"Room size\"!!!", "Error", MB_ICONERROR);
delete pInfo;
goto __exit;
}
int dataLenClean = 0;
if (revInfo.eReflect) {
dataLenClean = pInfo->EarlyReflectionsDelayLineLen;
}
if (revInfo.lReflect) {
int dlen = (int)((pInfo->decayTime) * fileInfo.sRate + 0.5);
dataLenClean += dlen;
}
ippStat = ippsZero_16s(inBuf, BUF_SIZE * fileInfo.nchan);
if (ippStat != ippStsNoErr) {
fileInfo.dlg->MessageBox("Failed to clean InBuf!!!", "", MB_ICONERROR);
delete pInfo;
goto __exit;
}
while (dataLenClean != 0) {
/* *****************************************************
* 1) sendFrame has been re-written
* 2) need use Lock & UnLock
*
*******************************************************/
//------------------
UMC::Status umcRes;
do
{
umcRes = pRender->LockInputBuffer( outData );
if (UMC::UMC_NOT_ENOUGH_BUFFER == umcRes)
vm_time_sleep(5);
} while ( UMC::UMC_NOT_ENOUGH_BUFFER == umcRes );
//=========
int maxRead = (BUF_SIZE > dataLenClean) ? dataLenClean : BUF_SIZE;
inData->SetDataSize(maxRead * fileInfo.nchan * sizeof(Ipp16s));
outData->SetDataSize(maxRead * fileInfo.nchan * sizeof(Ipp16s));
pRevFilter->GetFrame(inData, outData);
//=========
umcRes = pRender->UnLockInputBuffer(outData);
// check error(s)
if (UMC::UMC_OK != umcRes)
break;
//------------------
//umc_stat = pRender->SendFrame(outData);
if (umc_stat != UMC::UMC_OK) {
fileInfo.dlg->MessageBox("Failed on SendFrame in cleaning!!!", "", MB_ICONERROR);
delete pInfo;
goto __exit;
}
dataLenClean -= maxRead;
}
delete pInfo;
}
fileInfo.isPlaying = -1;
fileInfo.dlg->m_PlayButton.SetWindowText("Play");
__exit:
ippsFree(outBuf);
ippsFree(inBuf);
delete outData;
delete inData;
delete pRevParams;
delete pRevFilter;
delete pRenderParams;
delete pRender;
return 0;
}
void CUmc_reverb_demoDlg::OnButtonPlay()
{
fileInfo.dlg = this;
if (fileInfo.isPlaying == -1) { // playback is stopped
int nIndex = m_FileFromList.GetCurSel();
if (m_FileFromList.GetText(nIndex, fileInfo.file_name) == LB_ERR) {
MessageBox("Choose the file to play!", "Attention", MB_ICONWARNING);
return;
}
int res = FillInFileStruct();
if (res != 0) {
MessageBox("The file is not of WAV format(mono or stereo)\nor is corrupted!", "", MB_ICONERROR);
return;
}
m_PlayButton.SetWindowText("Pause");
fileInfo.isPlaying = 1;
vm_thread_set_invalid(&(fileInfo.play_thread));
res = vm_thread_create(&(fileInfo.play_thread), playback_thread, &fileInfo);
if (res != 1) {
MessageBox("Failed to create a new thread", "Error", MB_ICONERROR);
return;
}
} else
if (fileInfo.isPlaying == 0) { // playback is paused
m_PlayButton.SetWindowText("Pause");
fileInfo.isPlaying = 1;
} else
if (fileInfo.isPlaying == 1) { // playback is run
m_PlayButton.SetWindowText("Play");
fileInfo.isPlaying = 0;
}
}
void CUmc_reverb_demoDlg::OnDblclkList()
{
fileInfo.isPlaying = -1;
vm_thread_close(&(fileInfo.play_thread));
this->OnButtonPlay();
}
void CUmc_reverb_demoDlg::OnBnClickedCheckReverb()
{
if (m_ReverbEnable.GetCheck() == 1) {
revInfo.reverb = TRUE;
m_RoomSizeEnable.EnableWindow(TRUE);
m_FinishingEnable.EnableWindow(TRUE);
m_RSSliderValue.EnableWindow(TRUE);
m_FSliderValue.EnableWindow(TRUE);
m_TextMin.EnableWindow(TRUE);
m_TextMax.EnableWindow(TRUE);
m_TextSoft.EnableWindow(TRUE);
m_TextHard.EnableWindow(TRUE);
m_RSDef.EnableWindow(TRUE);
m_FDef.EnableWindow(TRUE);
m_TextRSLevel.EnableWindow(TRUE);
m_RSLSliderValue.EnableWindow(TRUE);
m_TextRSLMax.EnableWindow(TRUE);
m_TextRSLMin.EnableWindow(TRUE);
} else {
revInfo.reverb = FALSE;
m_RoomSizeEnable.EnableWindow(FALSE);
m_FinishingEnable.EnableWindow(FALSE);
m_RSSliderValue.EnableWindow(FALSE);
m_FSliderValue.EnableWindow(FALSE);
m_TextMin.EnableWindow(FALSE);
m_TextMax.EnableWindow(FALSE);
m_TextSoft.EnableWindow(FALSE);
m_TextHard.EnableWindow(FALSE);
m_RSDef.EnableWindow(FALSE);
m_FDef.EnableWindow(FALSE);
m_TextRSLevel.EnableWindow(FALSE);
m_RSLSliderValue.EnableWindow(FALSE);
m_TextRSLMax.EnableWindow(FALSE);
m_TextRSLMin.EnableWindow(FALSE);
}
}
void CUmc_reverb_demoDlg::OnBnClickedCheckRoomsize()
{
if (m_RoomSizeEnable.GetCheck() == 1) {
revInfo.eReflect = TRUE;
} else {
revInfo.eReflect = FALSE;
}
revInfo.revParamsChanged = TRUE;
}
void CUmc_reverb_demoDlg::OnBnClickedCheckFinishing()
{
if (m_FinishingEnable.GetCheck() == 1) {
revInfo.lReflect = TRUE;
} else {
revInfo.lReflect = FALSE;
}
revInfo.revParamsChanged = TRUE;
}
void CUmc_reverb_demoDlg::OnNMReleasedcaptureRoomsizeSlider(NMHDR *pNMHDR, LRESULT *pResult)
{
int cur_pos = m_RSSliderValue.GetPos();
if (cur_pos != revInfo.RSSliderPos) {
revInfo.RSSliderPos = cur_pos;
revInfo.revParamsChanged = TRUE;
}
*pResult = 0;
}
void CUmc_reverb_demoDlg::OnNMReleasedcaptureFinishingSlider(NMHDR *pNMHDR, LRESULT *pResult)
{
int cur_pos = m_FSliderValue.GetPos();
if (cur_pos != revInfo.FSliderPos) {
revInfo.FSliderPos = cur_pos;
revInfo.revParamsChanged = TRUE;
}
*pResult = 0;
}
void CUmc_reverb_demoDlg::OnBnClickedButtonRsdef()
{
m_RSSliderValue.SetPos(10);
revInfo.RSSliderPos = 10;
revInfo.revParamsChanged = TRUE;
}
void CUmc_reverb_demoDlg::OnBnClickedButtonFdef()
{
m_FSliderValue.SetPos(20);
revInfo.FSliderPos = 20;
revInfo.revParamsChanged = TRUE;
}
void CUmc_reverb_demoDlg::OnNMReleasedcaptureRslSlider(NMHDR *pNMHDR, LRESULT *pResult)
{
int cur_pos = m_RSLSliderValue.GetPos();
if (cur_pos != revInfo.LevelSliderPos) {
revInfo.LevelSliderPos = cur_pos;
revInfo.revParamsChanged = TRUE;
}
*pResult = 0;
}
/* EOF */