0
0

hi,

if i set the position of a stream to the full length, i got the FMOD.RESULT.ERR_INVALID_POSITION result.
if i decrease the value by 1, all works fine. is this correct? why?

here is my code:

[code:2rfoqkbv]
var mode = FMOD.MODE._2D | FMOD.MODE.CREATESTREAM | MODE.HARDWARE;
if (file.IsVBR) {
mode |= FMOD.MODE.ACCURATETIME;
}

system.createSound(file.FullFileName, mode, ref sound);

uint lenms = 0;
sound.getLength(ref lenms, FMOD.TIMEUNIT.MS);
LengthMs = lenms;

FMOD.Channel channel = null;
system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);
[/code:2rfoqkbv]

[code:2rfoqkbv]
// set the position through a slider
this.currentPositionMs = value;
var result = channel.setPosition(this.currentPositionMs, FMOD.TIMEUNIT.MS);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) {
result.ERRCHECK();
}
[/code:2rfoqkbv]

with this change it works:

[code:2rfoqkbv]
this.currentPositionMs = value >= this.LengthMs ? this.LengthMs – 1 : value;
[/code:2rfoqkbv]

i’m using the version 4.44.03

thx for any help

  • You must to post comments
0
0

Yes that is correct, if a sound was 5ms long, you could seek to 0, 1, 2, 3 or 4 ms into the sound, at 5ms the sound is finished.

  • tianqiujie

    Thank you, I soloved my problem by length – 1

  • You must to post comments
0
0

[quote="mathew":3r51s6hs]Yes that is correct, if a sound was 5ms long, you could seek to 0, 1, 2, 3 or 4 ms into the sound, at 5ms the sound is finished.[/quote:3r51s6hs]

thx

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.