浏览代码

Code convention / comment edits and remove unnecessary ? operator.

Lasse Öörni 8 年之前
父节点
当前提交
8e32ad01b4

+ 2 - 2
Source/Urho3D/Audio/OggVorbisSoundStream.cpp

@@ -59,14 +59,14 @@ OggVorbisSoundStream::~OggVorbisSoundStream()
     }
     }
 }
 }
 
 
-bool OggVorbisSoundStream::Seek(unsigned int sample_number)
+bool OggVorbisSoundStream::Seek(unsigned sample_number)
 {
 {
     if (!decoder_)
     if (!decoder_)
         return false;
         return false;
     
     
     stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
     stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
     
     
-    return (stb_vorbis_seek(vorbis, sample_number) == 1) ? true : false;
+    return stb_vorbis_seek(vorbis, sample_number) == 1;
 }
 }
 
 
 unsigned OggVorbisSoundStream::GetData(signed char* dest, unsigned numBytes)
 unsigned OggVorbisSoundStream::GetData(signed char* dest, unsigned numBytes)

+ 2 - 2
Source/Urho3D/Audio/OggVorbisSoundStream.h

@@ -39,8 +39,8 @@ public:
     /// Destruct.
     /// Destruct.
     ~OggVorbisSoundStream();
     ~OggVorbisSoundStream();
 
 
-    /// Seek to sample number
-    virtual bool Seek(unsigned int sample_number);
+    /// Seek to sample number. Return true on success.
+    virtual bool Seek(unsigned sample_number);
 
 
     /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
     /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
     virtual unsigned GetData(signed char* dest, unsigned numBytes);
     virtual unsigned GetData(signed char* dest, unsigned numBytes);

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

@@ -161,7 +161,7 @@ void SoundSource::Seek(float seekTime)
     else
     else
     {
     {
         // Ogg format
         // Ogg format
-        if (soundStream_->Seek((unsigned int)(seekTime * soundStream_->GetFrequency())))
+        if (soundStream_->Seek((unsigned)(seekTime * soundStream_->GetFrequency())))
         {
         {
             timePosition_ = seekTime;
             timePosition_ = seekTime;
         }
         }

+ 2 - 2
Source/Urho3D/Audio/SoundStream.h

@@ -36,8 +36,8 @@ public:
     /// Destruct.
     /// Destruct.
     ~SoundStream();
     ~SoundStream();
 
 
-    /// Seek to sample number
-    virtual bool Seek(unsigned int sample_number);
+    /// Seek to sample number. Return true on success. Need not be implemented by all streams.
+    virtual bool Seek(unsigned sample_number);
     
     
     /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
     /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
     virtual unsigned GetData(signed char* dest, unsigned numBytes) = 0;
     virtual unsigned GetData(signed char* dest, unsigned numBytes) = 0;