0
0

I set loop point for channel but this affects the whole sound. Is this bug or feature or method in wrong class?

TSound/TChannel – lightweight wrappers for FMOD::Sound/FMOD::Channel

[code:3oes6ny3]
TChannel PlaySubSound(TSound &sound, int ms_begin, int ms_end)
{
TChannel result_chan = sound.Play(true/paused/);
if (FMOD::Channel *fmod_channel = result_chan.GetFMODChannel())
{
//FMOD_RESULT fmod_res = fmod_channel->setLoopPoints(ms_begin, FMOD_TIMEUNIT_MS, ms_end, FMOD_TIMEUNIT_MS);
FMOD_RESULT fmod_res = fmod_channel->setLoopPoints(3000, FMOD_TIMEUNIT_MS, 4000, FMOD_TIMEUNIT_MS);
assert(FMOD_OK == fmod_res);
fmod_res = fmod_channel->setPosition(ms_begin, FMOD_TIMEUNIT_MS);
assert(FMOD_OK == fmod_res);
fmod_res = fmod_channel->setPaused(false);
assert(FMOD_OK == fmod_res);

        //nasty temporary debug code
        {
            ::Sleep(10000); //ten samples from 3000 to 4000

            fmod_res = fmod_channel->stop();

            ::Sleep(2000); //silence

            assert(FMOD_OK == fmod_res);

            (void)sound.Play(); //from 0 to 4000 and endless looping in (3000 to 4000)
        }
    }
    return result_chan;
}

TChannel TSound::Play(bool paused) throw()
{
........... FMOD_RESULT fmod_res = fmod_system->playSound(FMOD_CHANNEL_FREE, m_sound, paused, &channel);

}
[/code:3oes6ny3]

  • You must to post comments
0
0

affects the whole sound? Do you mean it loops the whole sound instead of the loop points you specified?

Did you read the documentation on Channel::setLoopPoints? There is plenty of detail on what you can and can’t do.

[quote:1zrcfx75]
Not supported by static sounds created with FMOD_HARDWARE.
Supported by sounds created with FMOD_SOFTWARE, or sounds of any type (hardware or software) created with System::createStream or FMOD_CREATESTREAM.
[/quote:1zrcfx75]

  • You must to post comments
0
0

[quote="brett":2qvs7c6e]affects the whole sound? Do you mean it loops the whole sound instead of the loop points you specified?
[/quote:2qvs7c6e]
No. when i create other channel after, this channel is looped in same points. (I have described this in the source code in previos post).

[quote="brett":2qvs7c6e]
Did you read the documentation on Channel::setLoopPoints? There is plenty of detail on what you can and can’t do.

[quote:2qvs7c6e]
Not supported by static sounds created with FMOD_HARDWARE.
Supported by sounds created with FMOD_SOFTWARE, or sounds of any type (hardware or software) created with System::createStream or FMOD_CREATESTREAM.
[/quote:2qvs7c6e][/quote:2qvs7c6e]

[code:2qvs7c6e]
TSound::TSound(TAudio *audio, const TSoundName &sound_name, bool loop) throw()
.....

        FMOD_RESULT fmod_res = fmod_system->createSound(
            begin(m_data), //array of file data, chars
            FMOD_IGNORETAGS | FMOD_SOFTWARE | FMOD_LOOP_NORMAL*loop | (FMOD_CREATESTREAM) | FMOD_OPENMEMORY, 
            &fmod_createinfo, &m_sound);

[/code:2qvs7c6e]

music file format is ".ogg"
[i:2qvs7c6e][b:2qvs7c6e]edit misinformation:[/b:2qvs7c6e]file format is ".oxm" – xm with samples in ogg.-> music file format is ".ogg" [/i:2qvs7c6e]

  • You must to post comments
0
0

I’ll try next week to write minimal-one-function sample code with this mistake.

  • You must to post comments
0
0

Have you tried creating it as a sample and seeing if the effect persists? The fact that it’s playing as a stream may affect how the looping logic works.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.