本文整理汇总了C++中fmod::Sound::getSubSound方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::getSubSound方法的具体用法?C++ Sound::getSubSound怎么用?C++ Sound::getSubSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::Sound
的用法示例。
在下文中一共展示了Sound::getSubSound方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ObtenerTiempoCancionCDAudio
UINT64 InformacionArchivoEx::_ObtenerTiempoCancionCDAudio(const TCHAR *Path, FMOD::System *InstanciaFMOD) {
char Letra[3];
Letra[0] = static_cast<char>(Path[0]);
Letra[1] = ':';
Letra[2] = '\0';
UINT Milisegundos = 0;
FMOD::Sound *Stream = NULL;
FMOD::Sound *PistaCD = NULL;
FMOD_RESULT Error = InstanciaFMOD->createStream(Letra, FMOD_OPENONLY, 0, &Stream);
if (Stream != NULL) {
Stream->getSubSound(InfoPath.Pista - 1, &PistaCD); // no s'identifica la pista en els cds d'audio posible error en funcio Info
if (PistaCD != NULL) {
PistaCD->getLength(&Milisegundos, FMOD_TIMEUNIT_MS);
PistaCD->release();
Stream->release();
}
}
return Milisegundos;
}
示例2: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
FMOD_MODE mode = FMOD_2D | FMOD_HARDWARE | FMOD_CREATESTREAM;
unsigned int version;
if (argc != 3) {
std::cout << "unpacker.exe fsbPath outdirPath" << std::endl;
return 1;
}
auto fsbPath = std::string(argv[1]);
auto outPath = std::string(argv[2]);
//fsbPath = "LoL_SFX_ziggs.fsb";
//fsbPath = "LoL_SFX_karma_base.fsb";
//fsbPath = "LoL_SFX_fiddlesticks.fsb";
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->setOutput(FMOD_OUTPUTTYPE_WAVWRITER);
result = system->init(1, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
auto codecHandle = registerLeagueCodec(system, 50);
int numsubsounds;
FMOD::Sound *subSound = nullptr;
char name[256];
int soundNum = 0;
try {
result = system->createSound(fsbPath.c_str(), mode, nullptr, &sound);
ERRCHECK(result);
result = sound->getNumSubSounds(&numsubsounds);
ERRCHECK(result);
soundNum = 0;
sound->getSubSound(0, &subSound);
subSound->getName(name, 256);
subSound->release();
makePath(outPath.c_str());
sound->release();
system->close();
system->release();
std::set<std::string> writtenFiles;
FMOD::Channel* channel;
bool playing;
for (int sndIdx = 0; sndIdx < numsubsounds; sndIdx++) {
ERRCHECK(FMOD::System_Create(&system));
ERRCHECK(system->getVersion(&version));
system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER_NRT);
auto outFilePath = outPath + "\\" + std::string(name) + ".wav";
if (writtenFiles.find(outFilePath) != writtenFiles.end()) {
int cnt = 1;
char arr[80];
do {
_itoa_s(cnt, arr, 10);
outFilePath = outPath + "\\" + std::string(name) + "_" + std::string(arr) + ".wav";
cnt++;
} while (writtenFiles.find(outFilePath) != writtenFiles.end());
}
writtenFiles.insert(outFilePath);
ERRCHECK(system->init(1, FMOD_INIT_STREAM_FROM_UPDATE, (void*)outFilePath.c_str()));
auto codecHandle = registerLeagueCodec(system, 50);
system->createSound(fsbPath.c_str(), mode, nullptr, &sound);
sound->getSubSound(sndIdx, &subSound);
system->playSound(FMOD_CHANNEL_FREE, subSound, false, &channel);
do {
system->update();
channel->isPlaying(&playing);
} while (playing);
subSound->release();
if (sndIdx < numsubsounds - 1) {
sound->getSubSound(sndIdx+1, &subSound);
subSound->getName(name, 256);
subSound->release();
outFilePath = outPath + "\\" + std::string(name) + ".wav";
//.........这里部分代码省略.........
示例3: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *cdsound;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key, numtracks, currenttrack = 0;
unsigned int version;
if (argc < 2)
{
printf("Usage: cdplayer <drivepath>\n");
printf("Example: cdplayer /dev/cdrom\n");
exit(-1);
}
printf("==================================================================\n");
printf("CDPlayer Example. Copyright (c) Firelight Technologies 2004-2011.\n");
printf("==================================================================\n\n");
/*
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);
/*
Bump up the file buffer size a bit from the 16k default for CDDA, because it is a slower medium.
*/
result = system->setStreamBufferSize(64*1024, FMOD_TIMEUNIT_RAWBYTES);
ERRCHECK(result);
result = system->createStream(argv[1], FMOD_OPENONLY, 0, &cdsound);
ERRCHECK(result);
result = cdsound->getNumSubSounds(&numtracks);
ERRCHECK(result);
result = cdsound->getSubSound(currenttrack, &sound);
ERRCHECK(result);
for (;;)
{
FMOD_TAG tag;
if (cdsound->getTag(0, -1, &tag) != FMOD_OK)
{
break;
}
if (tag.datatype == FMOD_TAGDATATYPE_CDTOC)
{
dump_cddb_query((FMOD_CDTOC *)tag.data);
}
}
printf("\n========================================\n");
printf("Press SPACE to pause\n");
printf(" n to skip to next track\n");
printf(" ESC to exit\n");
printf("========================================\n\n");
/*
Print out length of entire CD. Did you know you can also play 'cdsound' and it will play the whole CD without gaps?
*/
{
unsigned int lenms;
result = cdsound->getLength(&lenms, FMOD_TIMEUNIT_MS);
ERRCHECK(result);
printf("Total CD length %02d:%02d\n\n", lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100);
}
/*
Play a CD track
*/
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
/*
Main loop
*/
do
{
if (kbhit())
{
key = getch();
//.........这里部分代码省略.........
示例4: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *fsb;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key, count, numsubsounds;
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(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->createSound("../media/example.fsb", FMOD_DEFAULT, 0, &fsb);
ERRCHECK(result);
printf("===================================================================\n");
printf("FSB Example. Copyright (c) Firelight Technologies 2004-2011.\n");
printf("===================================================================\n");
printf("\n");
result = fsb->getNumSubSounds(&numsubsounds);
ERRCHECK(result);
for (count = 0; count < numsubsounds; count++)
{
FMOD::Sound *subsound;
char name[256];
result = fsb->getSubSound(count, &subsound);
ERRCHECK(result);
result = subsound->getName(name, 256);
ERRCHECK(result);
printf("Press '%c' to play \"%s\"\n", '1' + count, name);
}
printf("Press 'Esc' to quit\n");
printf("\n");
/*
Main loop.
*/
do
{
if (_kbhit())
{
key = _getch();
if (key >= '1' && key < '1' + numsubsounds)
{
FMOD::Sound *subsound;
int index = key - '1';
fsb->getSubSound(index, &subsound);
result = system->playSound(FMOD_CHANNEL_FREE, subsound, false, &channel);
ERRCHECK(result);
}
}
system->update();
{
unsigned int ms = 0;
unsigned int lenms = 0;
bool playing = 0;
bool paused = 0;
int channelsplaying = 0;
if (channel)
{
FMOD::Sound *currentsound = 0;
result = channel->isPlaying(&playing);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
{
ERRCHECK(result);
}
result = channel->getPaused(&paused);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
{
ERRCHECK(result);
}
//.........这里部分代码省略.........