本文整理汇总了C++中fmod::System::getRecordDriverInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ System::getRecordDriverInfo方法的具体用法?C++ System::getRecordDriverInfo怎么用?C++ System::getRecordDriverInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::getRecordDriverInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
do
{
key = getch();
if (key == 27)
{
return 0;
}
driver = key - '1';
} while (driver < 0 || driver >= numdrivers);
result = system->setDriver(driver);
ERRCHECK(result);
/*
Enumerate record devices
*/
result = system->getRecordNumDrivers(&numdrivers);
ERRCHECK(result);
printf("---------------------------------------------------------\n");
printf("Choose a RECORD driver\n");
printf("---------------------------------------------------------\n");
for (count=0; count < numdrivers; count++)
{
char name[256];
result = system->getRecordDriverInfo(count, name, 256, 0);
ERRCHECK(result);
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
recorddriver = 0;
do
{
key = getch();
if (key == 27)
{
return 0;
}
recorddriver = key - '1';
} while (recorddriver < 0 || recorddriver >= numdrivers);
printf("\n");
result = system->setSoftwareFormat(OUTPUTRATE, FMOD_SOUND_FORMAT_PCM16, 1, 0, FMOD_DSP_RESAMPLER_LINEAR);
ERRCHECK(result);
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
system->getSoftwareFormat(&outputfreq, 0, 0, 0, 0, 0);
ERRCHECK(result);
/*
Create a sound to record to.
*/
示例2: main
//.........这里部分代码省略.........
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
do
{
key = getch();
if (key == 27)
{
return 0;
}
driver = key - '1';
} while (driver < 0 || driver >= numdrivers);
result = system->setDriver(driver);
ERRCHECK(result);
/*
Enumerate record devices
*/
result = system->getRecordNumDrivers(&numdrivers);
ERRCHECK(result);
printf("---------------------------------------------------------\n");
printf("Choose a RECORD driver\n");
printf("---------------------------------------------------------\n");
for (count=0; count < numdrivers; count++)
{
char name[256];
result = system->getRecordDriverInfo(count, name, 256, 0);
ERRCHECK(result);
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
recorddriver = 0;
do
{
key = getch();
if (key == 27)
{
return 0;
}
recorddriver = key - '1';
} while (recorddriver < 0 || recorddriver >= numdrivers);
printf("\n");
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels = 2;
exinfo.format = FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency = 44100;
exinfo.length = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 5;
result = system->createSound(0, FMOD_2D | FMOD_SOFTWARE | FMOD_OPENUSER, &exinfo, &sound);
示例3: 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;
//.........这里部分代码省略.........
示例4: main
int main(int argc, char *argv[])
{
FMOD::System *system = 0;
FMOD::Sound *sound = 0;
FMOD_RESULT result;
FMOD_CREATESOUNDEXINFO exinfo;
int key, recorddriver, numdrivers, count;
unsigned int version;
FILE *fp;
unsigned int datalength = 0, soundlength;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
return 0;
}
/*
System initialization
*/
printf("---------------------------------------------------------\n");
printf("Select OUTPUT type\n");
printf("---------------------------------------------------------\n");
printf("1 : DirectSound\n");
printf("2 : Windows Multimedia WaveOut\n");
printf("3 : ASIO\n");
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
do
{
key = _getch();
} while (key != 27 && key < '1' && key > '5');
switch (key)
{
case '1' : result = system->setOutput(FMOD_OUTPUTTYPE_DSOUND);
break;
case '2' : result = system->setOutput(FMOD_OUTPUTTYPE_WINMM);
break;
case '3' : result = system->setOutput(FMOD_OUTPUTTYPE_ASIO);
break;
default : return 1;
}
ERRCHECK(result);
/*
Enumerate record devices
*/
result = system->getRecordNumDrivers(&numdrivers);
ERRCHECK(result);
printf("---------------------------------------------------------\n");
printf("Choose a RECORD driver\n");
printf("---------------------------------------------------------\n");
for (count=0; count < numdrivers; count++)
{
char name[256];
result = system->getRecordDriverInfo(count, name, 256, 0);
ERRCHECK(result);
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
recorddriver = 0;
do
{
key = _getch();
if (key == 27)
{
return 0;
}
recorddriver = key - '1';
} while (recorddriver < 0 || recorddriver >= numdrivers);
printf("\n");
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels = 1;
exinfo.format = FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency = 44100;
exinfo.length = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 2;
//.........这里部分代码省略.........
示例5: main
int main(int argc, char *argv[])
{
FMOD::System *system = 0;
FMOD::Sound *sound = 0;
FMOD_RESULT result;
FMOD_CREATESOUNDEXINFO exinfo;
int key, recorddriver, numdrivers, count;
unsigned int version;
FILE *fp;
unsigned int datalength = 0, soundlength;
bool iscoreaudio = false;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
return 0;
}
result = system->setOutput(FMOD_OUTPUTTYPE_COREAUDIO);
ERRCHECK(result);
/*
Enumerate record devices
*/
result = system->getRecordNumDrivers(&numdrivers);
ERRCHECK(result);
printf("---------------------------------------------------------\n");
printf("Choose a RECORD driver\n");
printf("---------------------------------------------------------\n");
for (count=0; count < numdrivers; count++)
{
char name[256];
result = system->getRecordDriverInfo(count, name, 256, 0);
ERRCHECK(result);
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
recorddriver = 0;
do
{
key = getch();
if (key == 27)
{
return 0;
}
recorddriver = key - '1';
} while (recorddriver < 0 || recorddriver >= numdrivers);
printf("\n");
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels = 2;
exinfo.defaultfrequency = 44100;
if (iscoreaudio)
{
exinfo.format = FMOD_SOUND_FORMAT_PCMFLOAT;
exinfo.length = exinfo.defaultfrequency * sizeof(float) * exinfo.numchannels * 2;
}
else
{
exinfo.format = FMOD_SOUND_FORMAT_PCM16;
exinfo.length = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 2;
}
result = system->createSound(0, FMOD_2D | FMOD_SOFTWARE | FMOD_OPENUSER, &exinfo, &sound);
ERRCHECK(result);
printf("========================================================================\n");
printf("Record to disk example. Copyright (c) Firelight Technologies 2004-2014.\n");
printf("========================================================================\n");
printf("\n");
printf("Press a key to start recording to record.wav\n");
printf("\n");
getch();
result = system->recordStart(recorddriver, sound, true);
ERRCHECK(result);
//.........这里部分代码省略.........
示例6: DetectPitch
//.........这里部分代码省略.........
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
do
{
//key = _getch();
key = '1'; //TODO: io devices
if (key == 27)
{
return(0);
}
driver = key - '1';
} while (driver < 0 || driver >= numdrivers);
result = system->setDriver(driver);
ERRCHECK(result);
/*
Enumerate record devices
*/
result = system->getRecordNumDrivers(&numdrivers);
ERRCHECK(result);
printf("---------------------------------------------------------\n");
printf("Choose a RECORD driver\n");
printf("---------------------------------------------------------\n");
for (count=0; count < numdrivers; count++)
{
char name[256];
result = system->getRecordDriverInfo(count, name, 256, 0);
ERRCHECK(result);
printf("%d : %s\n", count + 1, name);
}
printf("---------------------------------------------------------\n");
printf("Press a corresponding number or ESC to quit\n");
recorddriver = 0;
do
{
//key = _getch();
key = '1'; //TODO: io devices
if (key == 27)
{
return(0);
}
recorddriver = key - '1';
} while (recorddriver < 0 || recorddriver >= numdrivers);
printf("\n");
result = system->setSoftwareFormat(OUTPUT_RATE, FMOD_SOUND_FORMAT_PCM16, 1, 0, FMOD_DSP_RESAMPLER_LINEAR);
ERRCHECK(result);
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
/*
Create a sound to record to.
*/
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));