本文整理汇总了C++中fmod::System::setReverbProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ System::setReverbProperties方法的具体用法?C++ System::setReverbProperties怎么用?C++ System::setReverbProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::setReverbProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FMOD_Main
int FMOD_Main()
{
FMOD::Channel *channel = NULL;
unsigned int samplesRecorded = 0;
unsigned int samplesPlayed = 0;
bool dspEnabled = false;
void *extraDriverData = NULL;
Common_Init(&extraDriverData);
/*
Create a System object and initialize.
*/
FMOD::System *system = NULL;
FMOD_RESULT result = FMOD::System_Create(&system);
ERRCHECK(result);
unsigned int version = 0;
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
Common_Fatal("FMOD lib version %08x doesn't match header version %08x", version, FMOD_VERSION);
}
result = system->init(100, FMOD_INIT_NORMAL, extraDriverData);
ERRCHECK(result);
int numDrivers = 0;
result = system->getRecordNumDrivers(NULL, &numDrivers);
ERRCHECK(result);
if (numDrivers == 0)
{
Common_Fatal("No recording devices found/plugged in! Aborting.");
}
/*
Determine latency in samples.
*/
int nativeRate = 0;
int nativeChannels = 0;
result = system->getRecordDriverInfo(DEVICE_INDEX, NULL, 0, NULL, &nativeRate, NULL, &nativeChannels, NULL);
ERRCHECK(result);
unsigned int driftThreshold = (nativeRate * DRIFT_MS) / 1000; /* The point where we start compensating for drift */
unsigned int desiredLatency = (nativeRate * LATENCY_MS) / 1000; /* User specified latency */
unsigned int adjustedLatency = desiredLatency; /* User specified latency adjusted for driver update granularity */
int actualLatency = desiredLatency; /* Latency measured once playback begins (smoothened for jitter) */
/*
Create user sound to record into, then start recording.
*/
FMOD_CREATESOUNDEXINFO exinfo = {0};
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels = nativeChannels;
exinfo.format = FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency = nativeRate;
exinfo.length = nativeRate * sizeof(short) * nativeChannels; /* 1 second buffer, size here doesn't change latency */
FMOD::Sound *sound = NULL;
result = system->createSound(0, FMOD_LOOP_NORMAL | FMOD_OPENUSER, &exinfo, &sound);
ERRCHECK(result);
result = system->recordStart(DEVICE_INDEX, sound, true);
ERRCHECK(result);
unsigned int soundLength = 0;
result = sound->getLength(&soundLength, FMOD_TIMEUNIT_PCM);
ERRCHECK(result);
/*
Main loop
*/
do
{
Common_Update();
/*
Add a DSP effect -- just for fun
*/
if (Common_BtnPress(BTN_ACTION1))
{
FMOD_REVERB_PROPERTIES propOn = FMOD_PRESET_CONCERTHALL;
FMOD_REVERB_PROPERTIES propOff = FMOD_PRESET_OFF;
dspEnabled = !dspEnabled;
result = system->setReverbProperties(0, dspEnabled ? &propOn : &propOff);
ERRCHECK(result);
}
result = system->update();
ERRCHECK(result);
/*
Determine how much has been recorded since we last checked
*/
unsigned int recordPos = 0;
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
Create a DSP effect to play with.
*/
result = system->createDSPByType(FMOD_DSP_TYPE_FLANGE, &dsp);
ERRCHECK(result);
result = dsp->setParameter(FMOD_DSP_FLANGE_RATE, 4.0f);
ERRCHECK(result);
result = dsp->setBypass(true);
ERRCHECK(result);
adjustedlatency = LATENCY; /* This might change depending on record block size. */
/*
Main loop.
*/
do
{
static unsigned int lastrecordpos = 0, samplesrecorded = 0;
unsigned int recordpos = 0, recorddelta;
key = 0;
if (_kbhit())
{
key = _getch();
}
if (key == 'e' || key == 'E')
{
bool bypass;
dsp->getBypass(&bypass);
dsp->setBypass(!bypass);
if (bypass)
{
FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_CONCERTHALL;
system->setReverbProperties(&prop);
}
else
{
FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_OFF;
system->setReverbProperties(&prop);
}
printf("\n\n *** TURN DSP EFFECT %s ** \n\n", bypass ? "ON" : "OFF");
}
system->getRecordPosition(0, &recordpos);
ERRCHECK(result);
recorddelta = recordpos >= lastrecordpos ? recordpos - lastrecordpos : recordpos + soundlength - lastrecordpos;
samplesrecorded += recorddelta;
if (samplesrecorded >= adjustedlatency && !channel)
{
result = system->playSound(FMOD_CHANNEL_FREE, sound, 0, &channel);
ERRCHECK(result);
result = channel->addDSP(dsp, 0);
ERRCHECK(result);
}
if (channel && recorddelta)
{
unsigned int playrecorddelta;
unsigned int playpos = 0;
int adjusting = 0;
float smootheddelta;
float dampratio = 0.97f;
static unsigned int minrecorddelta = (unsigned int)-1;