Browse Source

Move SoundSource new function registration to APITemplates.h so it works on both SoundSource & SoundSource3D. Minor comment formatting fix. Add contributor.

Lasse Öörni 8 years ago
parent
commit
a90bc49b56

+ 1 - 0
Docs/Urho3D.dox

@@ -165,6 +165,7 @@ Urho3D development, contributions and bugfixes by:
 - lhinuz
 - lvshiling
 - marynate
+- meshonline
 - mightyCelu
 - neat3d
 - nemerle

+ 1 - 0
README.md

@@ -120,6 +120,7 @@ Urho3D development, contributions and bugfixes by:
 - lhinuz
 - lvshiling
 - marynate
+- meshonline
 - mightyCelu
 - neat3d
 - nemerle

+ 1 - 0
Source/Urho3D/AngelScript/APITemplates.h

@@ -877,6 +877,7 @@ template <class T> void RegisterSoundSource(asIScriptEngine* engine, const char*
     engine->RegisterObjectMethod(className, "void Play(Sound@+, float, float)", asMETHODPR(T, Play, (Sound*, float, float), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Play(Sound@+, float, float, float)", asMETHODPR(T, Play, (Sound*, float, float, float), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Stop()", asMETHOD(T, Stop), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void Seek(float)", asMETHOD(SoundSource, Seek), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_soundType(const String&in)", asMETHOD(T, SetSoundType), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "String get_soundType() const", asMETHOD(T, GetSoundType), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_frequency(float)", asMETHOD(T, SetFrequency), asCALL_THISCALL);

+ 0 - 1
Source/Urho3D/AngelScript/AudioAPI.cpp

@@ -56,7 +56,6 @@ void RegisterSoundSources(asIScriptEngine* engine)
     RegisterSoundSource<SoundSource3D>(engine, "SoundSource3D");
     // Allow creation of sound sources also outside scene
     RegisterObjectConstructor<SoundSource>(engine, "SoundSource");
-    engine->RegisterObjectMethod("SoundSource", "void Seek(float)", asMETHOD(SoundSource, Seek), asCALL_THISCALL);
     engine->RegisterObjectMethod("SoundSource3D", "void SetDistanceAttenuation(float, float, float)", asMETHOD(SoundSource3D, SetDistanceAttenuation), asCALL_THISCALL);
     engine->RegisterObjectMethod("SoundSource3D", "void SetAngleAttenuation(float, float)", asMETHOD(SoundSource3D, SetAngleAttenuation), asCALL_THISCALL);
     engine->RegisterObjectMethod("SoundSource3D", "void set_nearDistance(float)", asMETHOD(SoundSource3D, SetNearDistance), asCALL_THISCALL);

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

@@ -146,21 +146,21 @@ void SoundSource::RegisterObject(Context* context)
 
 void SoundSource::Seek(float seekTime)
 {
-    // ignore buffered sound stream
+    // Ignore buffered sound stream
     if (!audio_ || !sound_ || (soundStream_ && !sound_->IsCompressed()))
         return;
 
-    // set to valid range
+    // Set to valid range
     seekTime = Clamp(seekTime, 0.0f, sound_->GetLength());
 
     if (!soundStream_)
     {
-        // raw or wav format
+        // Raw or wav format
         SetPositionAttr((int)(seekTime * (sound_->GetSampleSize() * sound_->GetFrequency())));
     }
     else
     {
-        // ogg format
+        // Ogg format
         if (soundStream_->Seek((unsigned int)(seekTime * soundStream_->GetFrequency())))
         {
             timePosition_ = seekTime;