/*
FxSound
Copyright (C) 2023 FxSound LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* FILE: hrdwr\comSftwr\comSftwr.c
* DATE: 9/7/97
* AUTHOR: Paul Titchener
* DESCRIPTION:
*
* These functions handle the direct reads and writes to the DSP card.
* This is the version for use with the software dsp dll.
*/
/* Standard includes */
#ifdef WIN32
#include <windows.h>
#include <winuser.h>
#endif
#include <time.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include "codedefs.h"
#include "pt_defs.h"
#include "platform.h"
#include "boardrv1.h"
/* For setting demo bypass mode */
//#include "product_type.h"
/*
#include "hrdwr.h"
#include "hutil.h"
*/
#include "u_comSftwr.h"
#include "comSftwr.h"
#include "c_dsps.h"
#include "demodef.h"
/* Make sure PT_DSP_BUILD is set */
#if !defined(PT_DSP_BUILD)
#error PT_DSP_BUILD Not Defined.
#endif
/* For writing parameters to DSP.
* Note that the hrdwrWriteParameterIfNotBusy uses a hard wait loop to
* complete the second write operation (the actual value).
*/
int COMSFTWR_DECL comSftwrWriteParam(PT_HANDLE *hp_comSftwr, long l_offset, long l_val)
{
float *flt_ptr;
struct comSftwrHdlType *cast_handle;
cast_handle = (struct comSftwrHdlType *)hp_comSftwr;
if (cast_handle == NULL)
return(NOT_OKAY);
flt_ptr = (float *)&l_val;
#ifdef COMSFTWR_MESSAGE_BOXES
if((l_offset < 0) || (l_offset > 256))
MessageBoxA(NULL, "Invalid l_offset in comSftwrWriteParam", NULL,
(MB_OK | MB_ICONERROR | MB_TASKMODAL ) );
if( dsp_params == NULL )
MessageBoxA(NULL, "dsp_params is NULL in comSftwrWriteParam", NULL,
(MB_OK | MB_ICONERROR | MB_TASKMODAL ) );
#endif
cast_handle->dsp_params[l_offset] = *flt_ptr;
/* Set the recue pending flag */
cast_handle->comSftwrReCuePending = 1;
return(OKAY);
}
/*
* FUNCTION: comSftwrProcessWaveBuffer()
* DESCRIPTION:
*
* Process the passed wave buffer, and send it back (no A/D or D/A).
* Currently only processes stereo to stereo or mono to mono signals.
*
*/
int COMSFTWR_DECL comSftwrProcessWaveBuffer(PT_HANDLE *hp_comSftwr, long *lp_data, long l_length,
int i_stereo_in_mode, int i_stereo_out_mode,
int i_buffer_type)
{
float *param_addr;
int index;
struct comSftwrHdlType *cast_handle;
cast_handle = (struct comSftwrHdlType *)hp_comSftwr;
if (cast_handle == NULL)
return(NOT_OKAY);
/* l_length comes in with the buffer size in samples */
/* Don't process the buffer if DSP is not available */
#ifdef COMSFTWR_CHECK_OUT_DSP
if( hutsyncCheckOutDsp( (unsigned short)i_processor_index) == 0 )
return(OKAY);
#endif
/* Set up pointer to correct parameter space */
param_addr = &(cast_handle->dsp_params[0]);
index = cast_handle->dsp_function_index;
#ifdef COMSFTWR_MESSAGE_BOXES
if( (index < 0) || (index > 62) )
MessageBoxA(NULL, "Invalid function index in comSftwrProcessWaveBuffer", NULL,
(MB_OK | MB_ICONERROR | MB_TASKMODAL ) );
if(lp_data == NULL)
MessageBoxA(NULL, "lpdata NULL in comSftwrProcessWaveBuffer", NULL,
(MB_OK | MB_ICONERROR | MB_TASKMODAL ) );
if(param_addr == NULL)
MessageBoxA(NULL, "param_addr NULL in comSftwrProcessWaveBuffer", NULL,
(MB_OK | MB_ICONERROR | MB_TASKMODAL ) );
if( (cast_handle->comSftDspProcessPtr[index]) == NULL)
MessageBoxA(NULL, "NULL function ptr in comSftwrProcessWaveBuffer", NULL,
(MB_OK | MB_ICONERROR | MB_TASKMODAL ) );
if( (l_length < 0) || (l_length > 256000) )
MessageBoxA(NULL, "Invalid function index in comSftwrProcessWaveBuffer", NULL,
(MB_OK | MB_ICONERROR | MB_TASKMODAL ) );
#endif
/* Only do DSPFX style muting if this is the DSPFX product */
#if (PT_DSP_BUILD == PT_DSP_DSPFX)
/* Note zeroing operation is dependent on input/output modes */
if( comSftwrDemoFlag[i_processor_index] &&
(sample_count[i_processor_index] > COMSFTWR_DEMO_SAMPLES_ALLOWED) )
{
dspsZeroOutput(lp_data, l_length,
param_addr,
dsp_memory[i_processor_index],
dsp_state[i_processor_index],
&(ComSftwrMeterData[i_processor_index]), i_buffer_type);
silence_count[i_processor_index] += l_length;
if( silence_count[i_processor_index] > COMSFTWR_DEMO_SILENCE_COUNT )
{
silence_count[i_processor_index] = 0;
sample_count[i_processor_index] = 0;
}
}
else
#endif
{
/*
#define COMSFTWR_AUTO_DEMO
#define COMSFTWR_AUTO_DEMO_SECS 7.5
*/
#ifdef COMSFTWR_AUTO_DEMO
{
/* On off toggling for demo */
static int count = 0;
static int on = 0;
long int tmp_buf[16384];
count += l_length;
if( count > 44100 * COMSFTWR_AUTO_DEMO_SECS )
{
count = 0;
if( on )
on = 0;
else
on = 1;
}
if( on )
{
(*cast_handle->comSftDspProcessPtr[index])(lp_data, l_length,
param_addr,
cast_handle->dsp_memory,
cast_handle->dsp_state,
&(cast_handle->ComSftwrMeterData), i_buffer_type);
}
else
{
int k;
int len;
len = l_length;
if(i_stereo_in_mode)
len *= 2;
for(k=0; k<=len; k++)
tmp_buf[k] = lp_data[k];
(*cast_handle->comSftDspProcessPtr[index])(tmp_buf, l_length,
param_addr,
cast_handle->dsp_memory,
cast_handle->dsp_state,
&(cast_handle->ComSftwrMeterData), i_buffer_type);
}
}
#else
(*cast_handle->comSftDspProcessPtr[index])(lp_data, l_length,
param_addr,
cast_handle->dsp_memory,
cast_handle->dsp_state,
&(cast_handle->ComSftwrMeterData), i_buffer_type);
#endif
}
/* Only do DSPFX style metering correction if this is the DSPFX product */
#if (PT_DSP_BUILD == PT_DSP_DSPFX)
/* Correct meter values for averaging. Values are coming back as floats,
* we need to convert them.
*/
{
float factor = (float)PC_24BIT_FLOAT_PLUS_CLIP/(float)l_length;
cast_handle->ComSftwrMeterData.left_in =
(long)( *(float *)&(ComSftwrMeterData[i_processor_index].left_in) * factor);
cast_handle->ComSftwrMeterData.right_in =
(long)( *(float *)&(ComSftwrMeterData.right_in) * factor);
cast_handle->ComSftwrMeterData[i_processor_index].left_out =
(long)( *(float *)&(ComSftwrMeterData.left_out) * factor);
cast_handle->ComSftwrMeterData.right_out =
(long)( *(float *)&(ComSftwrMeterData.right_out) * factor);
}
#endif
/* Check DSP back in */
#ifdef COMSFTWR_CHECK_OUT_DSP
hutsyncCheckInDsp( (unsigned short)i_processor_index );
#endif
cast_handle->sample_count += l_length;
return(OKAY);
}
/*
* FUNCTION: comSftwrProcessActiveBuffer()
* DESCRIPTION:
*
* Process the passed Active Movie buffer, and send it back (no A/D or D/A).
*
*/
int COMSFTWR_DECL comSftwrProcessActiveBuffer(PT_HANDLE *hp_comSftwr, short *sp_data, long l_length,
int i_stereo_in_mode, int i_stereo_out_mode,
int i_buffer_type)
{
struct comSftwrHdlType *cast_handle;
cast_handle = (struct comSftwrHdlType *)hp_comSftwr;
if (cast_handle == NULL)
return(NOT_OKAY);
/* l_length comes in with the buffer size in samples */
/* For now, call original saw style processing */
if( comSftwrProcessWaveBuffer(hp_comSftwr, (long *)sp_data, l_length,
i_stereo_in_mode, i_stereo_out_mode, i_buffer_type) != OKAY)
return(NOT_OKAY);
return(OKAY);
}
/* F
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
FxSound_application_and_DSP_源代码_FxSound-app_FxSound (642个子文件)
fxsound.aip 51KB
fxsound_update.aip 2KB
DLY8.ASM 48KB
MakeCabScript.bat 49B
Comsftwr.c 47KB
Play32StereoWithDFX.c 46KB
Play32StereoWithDFXLPFeedback.c 45KB
Play32StereoLPinFeedback.c 45KB
Play16.c 43KB
Play32.c 43KB
Play32WithLMS.c 43KB
Play16DMX.c 43KB
Play32DMX.c 43KB
Play16_10_7_03.c 43KB
Play32_10_7_03.c 43KB
Play16StereoWithDFX.c 41KB
Play32Back.c 41KB
Lex16.c 22KB
Lex32.c 22KB
Play32Butter.c 21KB
Play32BeatProto.c 20KB
Lex32loc.c 20KB
Maxi32Auto.c 18KB
Maxi32.c 18KB
Maxi16.c 18KB
AuralpInt.c 18KB
Dly8p.c 17KB
dly8p32.c 17KB
Play32BeforeVocal.c 16KB
Maxi32Test.c 16KB
Play32BeatWorking.c 15KB
Maxi32Orig.c 15KB
Lex32org.c 14KB
Play32FirstHeadProto.c 14KB
peq8p32.c 14KB
peq8p.c 14KB
Play32ProtoSplitFilters.c 13KB
Play32ProtoSplitFiltersHand.c 12KB
Play16Proto.c 11KB
Play32StereoProto.c 11KB
Play32Proto.c 11KB
Play16StereoProto.c 11KB
Play32ProtoOld.c 11KB
Play32OnOff.c 10KB
DLY8.C 10KB
Auralp.c 10KB
Auralp32.c 10KB
Wide32.c 9KB
Wide16.c 9KB
DLYBK8.C 7KB
DriverPackagesSigned.CAB 43KB
DriverPackages.CAB 34KB
dfx12ntx86.cat 11KB
dfx12ntx86.cat 11KB
dfx12ntamd64.cat 11KB
dfx12ntamd64.cat 11KB
fxvadntamd64.cat 10KB
fxvadntx86.cat 10KB
dfx12ntx86.cat 10KB
dfx12ntamd64.cat 10KB
dfx12ntamd64.cat 10KB
dfx12ntx86.cat 10KB
fxvadntx86.cat 9KB
fxvadntamd64.cat 9KB
dfx11_1ntx86.cat 9KB
dfx11_1ntamd64.cat 9KB
BinaryData.cpp 1.5MB
dfxpComm.cpp 58KB
FxController.cpp 52KB
pstr.cpp 49KB
Pwav.cpp 33KB
DfxInstall.cpp 29KB
pstrUserLibraryFilename.cpp 26KB
FileGeneral.cpp 25KB
Valswarp.cpp 25KB
Vals.cpp 25KB
sndDevicesGet.cpp 24KB
Qntitor2.cpp 21KB
dfxpUniversal.cpp 21KB
FxTheme.cpp 21KB
spectrumReset.cpp 20KB
sndDevicesSet.cpp 20KB
sndDevicesImplementDeviceRules.cpp 20KB
PwavIO.cpp 19KB
Qntitor.cpp 19KB
FxSettingsDialog.cpp 19KB
AudioPassthruPrivate.cpp 19KB
dfxpProcessReal.cpp 18KB
dfxpQnt.cpp 18KB
pstrArray.cpp 18KB
sndDevicesSetupDevices.cpp 17KB
MthBuffer.cpp 17KB
Valsfile.cpp 16KB
MthUtil.cpp 16KB
sndDevicesDoCapture.cpp 16KB
DfxDspPreset.cpp 15KB
FxEqualizer.cpp 15KB
FxMainWindow.cpp 14KB
Ptime.cpp 14KB
Com.cpp 14KB
共 642 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
好家伙VCC
- 粉丝: 2035
- 资源: 9145
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功