本文整理汇总了C++中fmod::System::setFileSystem方法的典型用法代码示例。如果您正苦于以下问题:C++ System::setFileSystem方法的具体用法?C++ System::setFileSystem怎么用?C++ System::setFileSystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::setFileSystem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key;
unsigned int version;
HANDLE threadhandle;
InitializeCriticalSection(&gCrit);
threadhandle = (HANDLE)_beginthreadex(NULL, 0, ProcessQueue, 0, 0, 0);
if (!threadhandle)
{
printf("Failed to create file thread.\n");
return 0;
}
/*
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->init(1, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->setStreamBufferSize(32768, FMOD_TIMEUNIT_RAWBYTES);
ERRCHECK(result);
result = system->setFileSystem(myopen, myclose, myread, myseek, myasyncread, myasynccancel, 2048);
ERRCHECK(result);
printf("====================================================================\n");
printf("Stream IO Example. Copyright (c) Firelight Technologies 2004-2014.\n");
printf("====================================================================\n");
printf("\n");
printf("\n");
printf("====================== CALLING CREATESOUND ON MP3 =======================\n");
result = system->createStream("../media/wave.mp3", FMOD_SOFTWARE | FMOD_LOOP_NORMAL | FMOD_2D | FMOD_IGNORETAGS, 0, &sound);
ERRCHECK(result);
printf("====================== CALLING PLAYSOUND ON MP3 =======================\n");
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
/*
Main loop.
*/
do
{
if (sound)
{
FMOD_OPENSTATE openstate;
bool starving;
sound->getOpenState(&openstate, 0, &starving, 0);
if (starving)
{
printf("Starving\n");
result = channel->setMute(true);
}
else
{
result = channel->setMute(false);
ERRCHECK(result);
}
}
if (_kbhit())
{
key = _getch();
switch (key)
{
case ' ' :
{
result = sound->release();
if (result == FMOD_OK)
{
sound = 0;
printf("Released sound.\n");
}
break;
}
}
//.........这里部分代码省略.........
示例2: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key;
unsigned int version;
/*
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->init(1, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->setFileSystem(myopen, myclose, myread, myseek, 0, 0, 2048);
ERRCHECK(result);
result = system->createStream("../media/wave.mp3", FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D, 0, &sound);
ERRCHECK(result);
printf("========================================================================\n");
printf("File Callbacks Example. Copyright (c) Firelight Technologies 2004-2015.\n");
printf("========================================================================\n");
printf("\n");
printf("Press space to pause, Esc to quit\n");
printf("\n");
/*
Play the sound.
*/
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
/*
Main loop.
*/
do
{
if (kbhit())
{
key = getch();
switch (key)
{
case ' ' :
{
bool paused;
channel->getPaused(&paused);
channel->setPaused(!paused);
break;
}
}
}
system->update();
if (channel)
{
unsigned int ms;
unsigned int lenms;
bool playing;
bool paused;
channel->isPlaying(&playing);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = channel->getPaused(&paused);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = channel->getPosition(&ms, FMOD_TIMEUNIT_MS);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = sound->getLength(&lenms, FMOD_TIMEUNIT_MS);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
//.........这里部分代码省略.........