forked from metin-server/m2dev-client-src
New sound system & removed miles
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonApplication.h"
|
||||
|
||||
PyObject * sndPlaySound(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndPlaySound2D(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szFileName;
|
||||
char* szFileName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.PlaySound2D(szFileName);
|
||||
SoundEngine::Instance().PlaySound2D(szFileName);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndPlaySound3D(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndPlaySound3D(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
float fx;
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &fx))
|
||||
@@ -23,58 +22,43 @@ PyObject * sndPlaySound3D(PyObject * poSelf, PyObject * poArgs)
|
||||
float fz;
|
||||
if (!PyTuple_GetFloat(poArgs, 2, &fz))
|
||||
return Py_BuildException();
|
||||
char * szFileName;
|
||||
char* szFileName;
|
||||
if (!PyTuple_GetString(poArgs, 3, &szFileName))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.PlaySound3D(fx, fy, fz, szFileName);
|
||||
SoundEngine::Instance().PlaySound3D(szFileName, fx, fy, fz);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndPlayMusic(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndFadeInMusic(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szFileName;
|
||||
char* szFileName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.PlaySound2D(szFileName);
|
||||
SoundEngine::Instance().FadeInMusic(szFileName);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndFadeInMusic(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndFadeOutMusic(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szFileName;
|
||||
char* szFileName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.FadeInMusic(szFileName);
|
||||
SoundEngine::Instance().FadeOutMusic(szFileName);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndFadeOutMusic(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndFadeOutAllMusic(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szFileName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.FadeOutMusic(szFileName);
|
||||
SoundEngine::Instance().FadeOutAllMusic();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndFadeOutAllMusic(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndFadeLimitOutMusic(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.FadeOutAllMusic();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndFadeLimitOutMusic(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
char * szFileName;
|
||||
char* szFileName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||
return Py_BuildException();
|
||||
|
||||
@@ -82,95 +66,74 @@ PyObject * sndFadeLimitOutMusic(PyObject * poSelf, PyObject * poArgs)
|
||||
if (!PyTuple_GetFloat(poArgs, 1, &fLimitVolume))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.FadeLimitOutMusic(szFileName, fLimitVolume);
|
||||
SoundEngine::Instance().FadeOutMusic(szFileName, fLimitVolume);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndStopAllSound(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndStopAllSound(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.StopAllSound3D();
|
||||
SoundEngine::Instance().StopAllSound3D();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndSetMusicVolume(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndSetMasterVolume(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
float fVolume;
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.SetMusicVolume(fVolume);
|
||||
SoundEngine::Instance().SetMasterVolume(fVolume);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndSetSoundVolumef(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndSetMusicVolume(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
float fVolume;
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.SetSoundVolume(fVolume);
|
||||
SoundEngine::Instance().SetMusicVolume(fVolume);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
|
||||
PyObject * sndSetSoundVolume(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndSetSoundVolumef(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iVolume;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iVolume))
|
||||
float fVolume;
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.SetSoundVolume(iVolume);
|
||||
SoundEngine::Instance().SetSoundVolume(fVolume);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndSetSoundScale(PyObject * poSelf, PyObject * poArgs)
|
||||
PyObject* sndSetSoundVolume(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
float fScale;
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &fScale))
|
||||
float volume;
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &volume))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.SetSoundScale(fScale);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * sndSetAmbienceSoundScale(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
float fScale;
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &fScale))
|
||||
return Py_BuildException();
|
||||
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.SetAmbienceSoundScale(fScale);
|
||||
SoundEngine::Instance().SetSoundVolume(volume / 100.0f);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
void initsnd()
|
||||
{
|
||||
static PyMethodDef s_methods[] =
|
||||
static PyMethodDef s_methods[] =
|
||||
{
|
||||
{ "PlaySound", sndPlaySound, METH_VARARGS },
|
||||
{ "PlaySound", sndPlaySound2D, METH_VARARGS },
|
||||
{ "PlaySound3D", sndPlaySound3D, METH_VARARGS },
|
||||
{ "PlayMusic", sndPlayMusic, METH_VARARGS },
|
||||
{ "FadeInMusic", sndFadeInMusic, METH_VARARGS },
|
||||
{ "FadeOutMusic", sndFadeOutMusic, METH_VARARGS },
|
||||
{ "FadeOutAllMusic", sndFadeOutAllMusic, METH_VARARGS },
|
||||
{ "FadeLimitOutMusic", sndFadeLimitOutMusic, METH_VARARGS },
|
||||
{ "StopAllSound", sndStopAllSound, METH_VARARGS },
|
||||
|
||||
{ "SetMusicVolumef", sndSetMusicVolume, METH_VARARGS },
|
||||
{ "SetMasterVolume", sndSetMasterVolume, METH_VARARGS },
|
||||
{ "SetMusicVolume", sndSetMusicVolume, METH_VARARGS },
|
||||
{ "SetSoundVolumef", sndSetSoundVolumef, METH_VARARGS },
|
||||
{ "SetSoundVolume", sndSetSoundVolume, METH_VARARGS },
|
||||
{ "SetSoundScale", sndSetSoundScale, METH_VARARGS },
|
||||
{ "SetAmbienceSoundScale", sndSetAmbienceSoundScale, METH_VARARGS },
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
Py_InitModule("snd", s_methods);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user