public bool SeekForward(int ms)
{
if (_speed == 1) // not to exhaust log when ff
Log.Debug("BASS: SeekForward for {0} ms", Convert.ToString(ms));
if (State != PlayState.Playing)
{
return false;
}
if (ms <= 0)
{
return false;
}
try
{
MusicStream stream = GetCurrentStream();
long pos = Bass.BASS_ChannelGetPosition(stream.BassStream);
double timePos = Bass.BASS_ChannelBytes2Seconds(stream.BassStream, pos);
double newPos = timePos + (double)ms / 1000.0;
if (newPos >= stream.TotalStreamSeconds)
{
return false;
}
Bass.BASS_ChannelSetPosition(stream.BassStream, Bass.BASS_ChannelSeconds2Bytes(stream.BassStream, newPos));
Bass.BASS_ChannelSetPosition(_mixer.BassStream, 0, BASSMode.BASS_POS_BYTES); // reset the mixer
_mixer.SetSyncPos(stream, newPos);
}
catch
{
return false;
}
return true;
}