本文整理汇总了C++中fmod::System::isRecording方法的典型用法代码示例。如果您正苦于以下问题:C++ System::isRecording方法的具体用法?C++ System::isRecording怎么用?C++ System::isRecording使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::isRecording方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if (kbhit())
{
key = getch();
switch (key)
{
case 'r' :
case 'R' :
{
result = system->recordStart(recorddriver, sound, looping);
ERRCHECK(result);
break;
}
case 'p' :
case 'P' :
{
if (looping)
{
sound->setMode(FMOD_LOOP_NORMAL);
}
else
{
sound->setMode(FMOD_LOOP_OFF);
}
ERRCHECK(result);
result = system->playSound(FMOD_CHANNEL_REUSE, sound, false, &channel);
ERRCHECK(result);
break;
}
case 'l' :
case 'L' :
{
looping = !looping;
break;
}
case 's' :
case 'S' :
{
result = system->recordStop(recorddriver);
if (channel)
{
channel->stop();
channel = 0;
}
break;
}
case 'w' :
case 'W' :
{
printf("Writing to record.wav ... \r");
SaveToWav(sound);
Sleep(500);
break;
}
}
}
sound->getLength(&length, FMOD_TIMEUNIT_PCM);
ERRCHECK(result);
system->isRecording(recorddriver, &recording);
ERRCHECK(result);
system->getRecordPosition(recorddriver, &recordpos);
ERRCHECK(result);
if (channel)
{
channel->isPlaying(&playing);
ERRCHECK(result);
channel->getPosition(&playpos, FMOD_TIMEUNIT_PCM);
ERRCHECK(result);
}
printf("State: %-19s. Record pos = %6d : Play pos = %6d : Loop %-3s\r", recording ? playing ? "Recording / playing" : "Recording" : playing ? "Playing" : "Idle", recordpos, playpos, looping ? "On" : "Off");
fflush(stdout);
system->update();
fflush(stdout);
Sleep(10);
} while (key != 27);
printf("\n");
/*
Shut down
*/
result = sound->release();
ERRCHECK(result);
result = system->release();
ERRCHECK(result);
return 0;
}
示例2: FMOD_Main
//.........这里部分代码省略.........
unsigned int recordPos = 0;
result = system->getRecordPosition(DEVICE_INDEX, &recordPos);
if (result != FMOD_ERR_RECORD_DISCONNECTED)
{
ERRCHECK(result);
}
static unsigned int lastRecordPos = 0;
unsigned int recordDelta = (recordPos >= lastRecordPos) ? (recordPos - lastRecordPos) : (recordPos + soundLength - lastRecordPos);
lastRecordPos = recordPos;
samplesRecorded += recordDelta;
static unsigned int minRecordDelta = (unsigned int)-1;
if (recordDelta && (recordDelta < minRecordDelta))
{
minRecordDelta = recordDelta; /* Smallest driver granularity seen so far */
adjustedLatency = (recordDelta <= desiredLatency) ? desiredLatency : recordDelta; /* Adjust our latency if driver granularity is high */
}
/*
Delay playback until our desired latency is reached.
*/
if (!channel && samplesRecorded >= adjustedLatency)
{
result = system->playSound(sound, 0, false, &channel);
ERRCHECK(result);
}
if (channel)
{
/*
Stop playback if recording stops.
*/
bool isRecording = false;
result = system->isRecording(DEVICE_INDEX, &isRecording);
if (result != FMOD_ERR_RECORD_DISCONNECTED)
{
ERRCHECK(result);
}
if (!isRecording)
{
result = channel->setPaused(true);
ERRCHECK(result);
}
/*
Determine how much has been played since we last checked.
*/
unsigned int playPos = 0;
result = channel->getPosition(&playPos, FMOD_TIMEUNIT_PCM);
ERRCHECK(result);
static unsigned int lastPlayPos = 0;
unsigned int playDelta = (playPos >= lastPlayPos) ? (playPos - lastPlayPos) : (playPos + soundLength - lastPlayPos);
lastPlayPos = playPos;
samplesPlayed += playDelta;
/*
Compensate for any drift.
*/
int latency = samplesRecorded - samplesPlayed;
actualLatency = (0.97f * actualLatency) + (0.03f * latency);
int playbackRate = nativeRate;
if (actualLatency < (adjustedLatency - driftThreshold))