0
0

This function appears to be doing nothing any way I call it. I have 30 or so samples loaded raw from memory, and a loop point for each that the sample should continually loop back to–typical use for playing a MOD or such. The sample modes all include FMOD.MODE.LOOP_NORMAL (I’m using C#), and no matter what values I pass to SetLoopPoints for either my samples or channel, the entire sample is continuously looped. I tried LOOP_BIDI mode just to see if I could produce anything different, and it seemed to still be looping forward rather than bidirectional.

A couple code snippets:

Loading a sample from a file (SNES Rom) and creating an FMOD "Sound" structure from it.

[code:2o3xph8u]
Form1.RomRead.BaseStream.Seek(offset-1,SeekOrigin.Begin);
data = Form1.RomRead.ReadBytes(sizeinrom+9);
FMOD.RESULT result;
int length;
byte[] rawdata = SNESToRaw();

        FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
        //exinfo.cbsize = sizeof(exinfo);
        exinfo.format = FMOD.SOUND_FORMAT.PCM16;
        exinfo.length = (uint)rawdata.Length/2;
        exinfo.cbsize = System.Runtime.InteropServices.Marshal.SizeOf(exinfo);
        exinfo.numchannels = 1;
        exinfo.defaultfrequency = 11025;
        //exinfo.decodebuffersize = 1000;
        //exinfo.
        result = Form1.system.createSound(rawdata, (FMOD.MODE.HARDWARE | FMOD.MODE.OPENMEMORY | FMOD.MODE.OPENRAW | FMOD.MODE.LOOP_NORMAL), ref exinfo, ref sample);
        uint l1 = (uint)looppoint;
        uint l2 = (uint)(rawdata.Length/2)-1;
        //Should loop back every 1 ms.  I have tried many sets of values here, they all sound exactly the same.
        FMOD.RESULT res = sample.setLoopPoints(0, FMOD.TIMEUNIT.MS, 1, FMOD.TIMEUNIT.MS);

// FMOD.RESULT res = sample.setLoopPoints(l1, FMOD.TIMEUNIT.RAWBYTES, l2, FMOD.TIMEUNIT.RAWBYTES);

[/code:2o3xph8u]

Playing a Sound "allsamples[sel].sample" with a given frequency v:
[code:2o3xph8u]
Form1.system.playSound(FMOD.CHANNELINDEX.REUSE, allSamples[sel].sample, false, ref channel);
channel.setFrequency(v);
[/code:2o3xph8u]

The only modes it seems capable of are looping the entire audio sample, or not looping at all.

Any ideas as to what’s going on here?

  • You must to post comments
0
0

Please read the documentation for this (Sound::setLoopPoints), it would have answered your question straight away.

[quote:2a40iovy]
[b:2a40iovy]Remarks[/b:2a40iovy]
Not supported by static sounds created with FMOD_HARDWARE.

[/quote:2a40iovy]

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.