Browse Source

Audio::IsInterpolated() -> Audio::GetInterpolation().
Fixed comments in the audio library.

Lasse Öörni 14 years ago
parent
commit
9d15b80fc4

+ 1 - 1
Docs/ScriptAPI.dox

@@ -2463,7 +2463,7 @@ Properties:<br>
 - uint sampleSize (readonly)
 - int mixRate (readonly)
 - bool stereo (readonly)
-- bool interpolated (readonly)
+- bool interpolation (readonly)
 - bool playing (readonly)
 - bool initialized (readonly)
 

+ 4 - 4
Engine/Audio/Audio.cpp

@@ -303,7 +303,7 @@ Audio::~Audio()
     #endif
 }
 
-bool Audio::SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolate)
+bool Audio::SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolation)
 {
     Release();
     
@@ -349,10 +349,10 @@ bool Audio::SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpo
     
     mixRate_ = mixRate;
     stereo_ = stereo;
-    interpolate_ = interpolate;
+    interpolation_ = interpolation;
     
     LOGINFO("Set audio mode " + String(mixRate_) + " Hz " + (stereo_ ? "stereo" : "mono") + " " +
-        (interpolate_ ? "interpolated" : ""));
+        (interpolation_ ? "interpolated" : ""));
     
     return Play();
 }
@@ -497,7 +497,7 @@ void Audio::MixOutput(void *dest, unsigned samples)
         
         // Mix samples to clip buffer
         for (PODVector<SoundSource*>::Iterator i = soundSources_.Begin(); i != soundSources_.End(); ++i)
-            (*i)->Mix(clipPtr, workSamples, mixRate_, stereo_, interpolate_);
+            (*i)->Mix(clipPtr, workSamples, mixRate_, stereo_, interpolation_);
         
         // Copy output from clip buffer to destination
         clipPtr = clipBuffer_.Get();

+ 5 - 5
Engine/Audio/Audio.h

@@ -46,7 +46,7 @@ public:
     virtual ~Audio();
     
     /// Initialize sound output with specified buffer length and output mode.
-    bool SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolate = true);
+    bool SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolation = true);
     /// Run update on sound sources. Not required for continued playback, but frees unused sound sources & sounds and updates 3D positions.
     void Update(float timeStep);
     /// Restart sound output.
@@ -68,10 +68,10 @@ public:
     unsigned GetSampleSize() const { return sampleSize_; }
     /// Return mixing rate.
     int GetMixRate() const { return mixRate_; }
+    /// Return whether output is interpolated.
+    bool GetInterpolation() const { return interpolation_; }
     /// Return whether output is stereo.
     bool IsStereo() const { return stereo_; }
-    /// Return whether output is interpolated.
-    bool IsInterpolated() const { return interpolate_; }
     /// Return whether audio is being output.
     bool IsPlaying() const { return playing_; }
     /// Return whether an audio stream has been reserved.
@@ -115,10 +115,10 @@ private:
     unsigned fragmentSize_;
     /// Mixing rate.
     int mixRate_;
+    /// Mixing interpolation flag.
+    bool interpolation_;
     /// Stereo flag.
     bool stereo_;
-    /// Interpolation flag.
-    bool interpolate_;
     /// Playing flag.
     bool playing_;
     /// Master gain by sound source type.

+ 3 - 3
Engine/Audio/SoundSource.cpp

@@ -354,7 +354,7 @@ void SoundSource::Update(float timeStep)
     }
 }
 
-void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, bool interpolate)
+void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, bool interpolation)
 {
     if (!position_ || !sound_)
         return;
@@ -443,7 +443,7 @@ void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, boo
     // Choose the correct mixing routine
     if (!sound->IsStereo())
     {
-        if (interpolate)
+        if (interpolation)
         {
             if (stereo)
                 MixMonoToStereoIP(sound, dest, samples, mixRate);
@@ -460,7 +460,7 @@ void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, boo
     }
     else
     {
-        if (interpolate)
+        if (interpolation)
         {
             if (stereo)
                 MixStereoToStereoIP(sound, dest, samples, mixRate);

+ 3 - 3
Engine/Audio/SoundSource.h

@@ -97,10 +97,10 @@ public:
     void StopLockless();
     /// %Set new playback position without locking the audio mutex. Called internally.
     void SetPlayPositionLockless(signed char* position);
-    /// Update the sound source. Perform subclass specific operations. Called by Sound.
+    /// Update the sound source. Perform subclass specific operations. Called by Audio.
     virtual void Update(float timeStep);
-    /// Mix sound source output to a 32-bit clipping buffer. Called by Sound.
-    void Mix(int* dest, unsigned samples, int mixRate, bool stereo, bool interpolate);
+    /// Mix sound source output to a 32-bit clipping buffer. Called by Audio.
+    void Mix(int* dest, unsigned samples, int mixRate, bool stereo, bool interpolation);
     
     /// %Set sound attribute.
     void SetSoundAttr(ResourceRef value);

+ 1 - 1
Engine/Engine/AudioAPI.cpp

@@ -82,7 +82,7 @@ void RegisterAudio(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Audio", "uint get_sampleSize() const", asMETHOD(Audio, GetSampleSize), asCALL_THISCALL);
     engine->RegisterObjectMethod("Audio", "int get_mixRate() const", asMETHOD(Audio, GetMixRate), asCALL_THISCALL);
     engine->RegisterObjectMethod("Audio", "bool get_stereo() const", asMETHOD(Audio, IsStereo), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Audio", "bool get_interpolated() const", asMETHOD(Audio, IsInterpolated), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Audio", "bool get_interpolation() const", asMETHOD(Audio, GetInterpolation), asCALL_THISCALL);
     engine->RegisterObjectMethod("Audio", "bool get_playing() const", asMETHOD(Audio, IsPlaying), asCALL_THISCALL);
     engine->RegisterObjectMethod("Audio", "bool get_initialized() const", asMETHOD(Audio, IsInitialized), asCALL_THISCALL);
     engine->RegisterGlobalFunction("Audio@+ get_audio()", asFUNCTION(GetAudio), asCALL_CDECL);

+ 3 - 3
Engine/Engine/Engine.cpp

@@ -86,7 +86,7 @@ bool Engine::Initialize(const String& windowTitle, const String& logName, const
     bool lqShadows = false;
     bool sound = true;
     bool stereo = true;
-    bool interpolate = true;
+    bool interpolation = true;
     bool threads = true;
     bool logDebug = false;
     
@@ -105,7 +105,7 @@ bool Engine::Initialize(const String& windowTitle, const String& logName, const
             else if (argument == "nosound")
                 sound = false;
             else if (argument == "noip")
-                interpolate = false;
+                interpolation = false;
             else if (argument == "mono")
                 stereo = false;
             else if (argument == "prepass")
@@ -234,7 +234,7 @@ bool Engine::Initialize(const String& windowTitle, const String& logName, const
             renderer->SetShadowQuality(SHADOWQUALITY_LOW_16BIT);
         
         if (sound)
-            GetSubsystem<Audio>()->SetMode(buffer, mixRate, stereo, interpolate);
+            GetSubsystem<Audio>()->SetMode(buffer, mixRate, stereo, interpolation);
     }
     
     // Init FPU state of main thread