|
@@ -80,14 +80,34 @@ static Audio* GetAudio()
|
|
|
return GetScriptContext()->GetSubsystem<Audio>();
|
|
return GetScriptContext()->GetSubsystem<Audio>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static float GetMasterGainFromEnum(SoundType type, Audio* audio)
|
|
|
|
|
+{
|
|
|
|
|
+ return audio->GetMasterGain(type);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static float GetMasterGainFromHash(const StringHash& type, Audio* audio)
|
|
|
|
|
+{
|
|
|
|
|
+ return audio->GetMasterGain(type);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static StringHash GetHashFromType(SoundType type)
|
|
|
|
|
+{
|
|
|
|
|
+ return soundTypeHashes[type];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void RegisterAudio(asIScriptEngine* engine)
|
|
void RegisterAudio(asIScriptEngine* engine)
|
|
|
{
|
|
{
|
|
|
RegisterObject<Audio>(engine, "Audio");
|
|
RegisterObject<Audio>(engine, "Audio");
|
|
|
engine->RegisterObjectMethod("Audio", "void SetMode(int, int, bool, bool interpolate = true)", asMETHOD(Audio, SetMode), asCALL_THISCALL);
|
|
engine->RegisterObjectMethod("Audio", "void SetMode(int, int, bool, bool interpolate = true)", asMETHOD(Audio, SetMode), asCALL_THISCALL);
|
|
|
engine->RegisterObjectMethod("Audio", "bool Play()", asMETHOD(Audio, Play), asCALL_THISCALL);
|
|
engine->RegisterObjectMethod("Audio", "bool Play()", asMETHOD(Audio, Play), asCALL_THISCALL);
|
|
|
engine->RegisterObjectMethod("Audio", "void Stop()", asMETHOD(Audio, Stop), asCALL_THISCALL);
|
|
engine->RegisterObjectMethod("Audio", "void Stop()", asMETHOD(Audio, Stop), asCALL_THISCALL);
|
|
|
- engine->RegisterObjectMethod("Audio", "void set_masterGain(SoundType, float)", asMETHOD(Audio, SetMasterGain), asCALL_THISCALL);
|
|
|
|
|
- engine->RegisterObjectMethod("Audio", "float get_masterGain(SoundType) const", asMETHOD(Audio, GetMasterGain), asCALL_THISCALL);
|
|
|
|
|
|
|
+ engine->RegisterObjectMethod("Audio", "void SetMasterGain(SoundType, float)", asMETHODPR(Audio, SetMasterGain, (SoundType, float), void), asCALL_THISCALL);
|
|
|
|
|
+ engine->RegisterObjectMethod("Audio", "float GetMasterGain(SoundType) const", asFUNCTION(GetMasterGainFromEnum), asCALL_CDECL_OBJLAST);
|
|
|
|
|
+ engine->RegisterObjectMethod("Audio", "void SetMasterGain(const StringHash&in, float)", asMETHODPR(Audio, SetMasterGain, (const StringHash&, float), void), asCALL_THISCALL);
|
|
|
|
|
+ engine->RegisterObjectMethod("Audio", "float GetMasterGain(const StringHash&in) const", asFUNCTION(GetMasterGainFromHash), asCALL_CDECL_OBJLAST);
|
|
|
|
|
+ engine->RegisterObjectMethod("Audio", "void set_masterGain(const StringHash&in, float)", asMETHODPR(Audio, SetMasterGain, (const StringHash&, float), void), asCALL_THISCALL);
|
|
|
|
|
+ engine->RegisterObjectMethod("Audio", "float get_masterGain(const StringHash&in) const", asFUNCTION(GetMasterGainFromHash), asCALL_CDECL_OBJLAST);
|
|
|
|
|
+ engine->RegisterObjectMethod("Audio", "bool IsMasterGain(const StringHash&in) const", asMETHOD(Audio, IsMasterGain), asCALL_THISCALL);
|
|
|
engine->RegisterObjectMethod("Audio", "void set_listener(SoundListener@+)", asMETHOD(Audio, SetListener), asCALL_THISCALL);
|
|
engine->RegisterObjectMethod("Audio", "void set_listener(SoundListener@+)", asMETHOD(Audio, SetListener), asCALL_THISCALL);
|
|
|
engine->RegisterObjectMethod("Audio", "SoundListener@+ get_listener() const", asMETHOD(Audio, GetListener), asCALL_THISCALL);
|
|
engine->RegisterObjectMethod("Audio", "SoundListener@+ get_listener() const", asMETHOD(Audio, GetListener), asCALL_THISCALL);
|
|
|
engine->RegisterObjectMethod("Audio", "uint get_sampleSize() const", asMETHOD(Audio, GetSampleSize), asCALL_THISCALL);
|
|
engine->RegisterObjectMethod("Audio", "uint get_sampleSize() const", asMETHOD(Audio, GetSampleSize), asCALL_THISCALL);
|
|
@@ -97,6 +117,7 @@ void RegisterAudio(asIScriptEngine* engine)
|
|
|
engine->RegisterObjectMethod("Audio", "bool get_playing() const", asMETHOD(Audio, IsPlaying), 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->RegisterObjectMethod("Audio", "bool get_initialized() const", asMETHOD(Audio, IsInitialized), asCALL_THISCALL);
|
|
|
engine->RegisterGlobalFunction("Audio@+ get_audio()", asFUNCTION(GetAudio), asCALL_CDECL);
|
|
engine->RegisterGlobalFunction("Audio@+ get_audio()", asFUNCTION(GetAudio), asCALL_CDECL);
|
|
|
|
|
+ engine->RegisterGlobalFunction("StringHash GetHashFromSoundType(SoundType type) const", asFUNCTION(GetHashFromType), asCALL_CDECL);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void RegisterAudioAPI(asIScriptEngine* engine)
|
|
void RegisterAudioAPI(asIScriptEngine* engine)
|