当前位置: 首页>>代码示例>>C++>>正文


C++ Sound::setSubSoundSentence方法代码示例

本文整理汇总了C++中fmod::Sound::setSubSoundSentence方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::setSubSoundSentence方法的具体用法?C++ Sound::setSubSoundSentence怎么用?C++ Sound::setSubSoundSentence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fmod::Sound的用法示例。


在下文中一共展示了Sound::setSubSoundSentence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
    exinfo.numsubsounds = 2;
    exinfo.numchannels = 1;
    exinfo.format = FMOD_SOUND_FORMAT_PCM16;

    /*
        Create the 'parent' stream that contains the substreams.  Set it to loop so that it loops between subsound 0 and 1.
    */
    result = system->createStream(0, FMOD_LOOP_NORMAL | FMOD_OPENUSER, &exinfo, &sound);
    ERRCHECK(result);

    /*
        Add 2 of our streams as children of the parent.  They should be the same format (ie mono/stereo and bitdepth) as the parent sound.
        When subsound 0 has finished and it is playing subsound 1, we will swap subsound 0 with a new sound, and the same for when subsound 1 has finished,
        causing a continual double buffered flip, which means continuous sound.
    */
    result = system->createStream(soundname[0], FMOD_DEFAULT, 0, &subsound[0]);
    ERRCHECK(result);

    result = system->createStream(soundname[1], FMOD_DEFAULT, 0, &subsound[1]);
    ERRCHECK(result);

    result = sound->setSubSound(0, subsound[0]);
    ERRCHECK(result);

    result = sound->setSubSound(1, subsound[1]);
    ERRCHECK(result);

    /*
        Set up the gapless sentence to contain these first 2 streams.
    */
    {
        int soundlist[2] = { 0, 1 };

        result = sound->setSubSoundSentence(soundlist, 2);
        ERRCHECK(result);
    }

    subsoundid = 0;
    sentenceid = 2;     /* The next sound to be appeneded to the stream. */

    printf("=============================================================================\n");
    printf("Real-time stitching example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("=============================================================================\n");
    printf("\n");
    printf("Press space to pause, Esc to quit\n");
    printf("\n");

    printf("Inserted subsound %d / 2 with sound %d / %d\n", 0, 0, NUMSOUNDS);
    printf("Inserted subsound %d / 2 with sound %d / %d\n", 1, 1, NUMSOUNDS);

    /*
        Play the sound.
    */

    result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
    ERRCHECK(result);

    /*
        Main loop.
    */
    do
    {
        unsigned int currentsubsoundid;

        if (_kbhit())
        {
开发者ID:Guitaroz,项目名称:Arcade-Space-Shooter,代码行数:67,代码来源:main.cpp


注:本文中的fmod::Sound::setSubSoundSentence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。