示例#1
0
 protected virtual void Dispose(bool disposing)
 {
     if (this.handle != 0)
     {
         BgmPlayer.ReleaseNative(this.handle);
         this.handle = 0;
     }
 }
示例#2
0
        public void Resume()
        {
            int errorCode = BgmPlayer.ResumeNative(this.handle);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
        }
示例#3
0
        public void Stop()
        {
            int errorCode = BgmPlayer.StopNative(this.handle);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
        }
示例#4
0
 private void GetLoopPosition()
 {
     if (this.loopStart < 0.0)
     {
         ulong start;
         ulong end;
         int   loopPosition = BgmPlayer.GetLoopPosition(this.handle, out start, out end);
         if (loopPosition != 0)
         {
             Error.ThrowNativeException(loopPosition);
         }
         double duration = this.Duration;
         this.loopStart = Math.Min(start * 0.001, duration);
         this.loopEnd   = Math.Min(end * 0.001, duration);
     }
 }
示例#5
0
        private void SetLoopPosition(double start, double end)
        {
            double duration = this.Duration;

            if (start < 0.0 || start > duration || end < 0.0 || end > duration)
            {
                throw new ArgumentOutOfRangeException();
            }
            ulong startRes = (ulong)(start * 1000.0);
            ulong endRes   = (ulong)(end * 1000.0);

            if (startRes > endRes)
            {
                startRes = endRes;
            }
            int errorCode = BgmPlayer.SetLoopPosition(this.handle, startRes, endRes);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            this.loopStart = start;
            this.loopEnd   = end;
        }