浏览代码

Fix crash when calling FixInterpolation() on compressed sound data. Add better explanation as this function is normally not needed to be called.

Lasse Öörni 10 年之前
父节点
当前提交
1d165f3e55
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 1 1
      Source/Urho3D/Audio/Sound.cpp
  2. 3 2
      Source/Urho3D/Audio/Sound.h

+ 1 - 1
Source/Urho3D/Audio/Sound.cpp

@@ -293,7 +293,7 @@ void Sound::SetLoop(unsigned repeatOffset, unsigned endOffset)
 
 void Sound::FixInterpolation()
 {
-    if (!data_)
+    if (!data_ || compressed_)
         return;
     
     // If looped, copy loop start to loop end. If oneshot, insert silence to end

+ 3 - 2
Source/Urho3D/Audio/Sound.h

@@ -62,8 +62,6 @@ public:
     void SetLooped(bool enable);
     /// Define loop.
     void SetLoop(unsigned repeatOffset, unsigned endOffset);
-    /// Fix interpolation by copying data from loop start to loop end (looped), or adding silence (oneshot.)
-    void FixInterpolation();
     
     /// Return a new instance of a decoder sound stream. Used by compressed sounds.
     SharedPtr<SoundStream> GetDecoderStream() const;
@@ -94,6 +92,9 @@ public:
     /// Return whether is compressed.
     bool IsCompressed() const { return compressed_; }
     
+    /// Fix interpolation by copying data from loop start to loop end (looped), or adding silence (oneshot.) Called internally, does not normally need to be called, unless the sound data is modified manually on the fly.
+    void FixInterpolation();
+
 private:
     /// Load optional parameters from an XML file.
     void LoadParameters();