music_sound.cpp
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "stdsound.h"
00025
00026 #include "music_sound.h"
00027 #include "nel/misc/path.h"
00028 #include "nel/georges/u_form_elm.h"
00029
00030
00031 using namespace std;
00032 using namespace NLMISC;
00033
00034 namespace NLSOUND {
00035
00036
00037
00038 CMusicSound::CMusicSound()
00039 {
00040
00041 _FileName= NULL;
00042 _FadeInLength= 2000;
00043 _FadeOutLength= 2000;
00044 _MinimumPlayTime= 10000;
00045 _TimeBeforeCanReplay= 0;
00046 LastStopTime= INT_MIN;
00047 }
00048
00049
00050 CMusicSound::~CMusicSound()
00051 {
00052 }
00053
00054
00055
00056 void CMusicSound::importForm(const std::string& filename, NLGEORGES::UFormElm& root)
00057 {
00058 NLGEORGES::UFormElm *psoundType;
00059 std::string dfnName;
00060
00061
00062 root.getNodeByName(&psoundType, ".SoundType");
00063 nlassert(psoundType != NULL);
00064 psoundType->getDfnName(dfnName);
00065 nlassert(dfnName == "music_sound.dfn");
00066
00067
00068 CSound::importForm(filename, root);
00069
00070
00071 std::string musicFileName;
00072 root.getValueByName(musicFileName, ".SoundType.FileName");
00073 musicFileName = CFile::getFilename(musicFileName);
00074 _FileName = CStringMapper::map(musicFileName);
00075
00076
00077 root.getValueByName(_FadeInLength, ".SoundType.FadeInLength");
00078 root.getValueByName(_FadeOutLength, ".SoundType.FadeOutLength");
00079 root.getValueByName(_MinimumPlayTime, ".SoundType.MinimumPlayTime");
00080 root.getValueByName(_TimeBeforeCanReplay, ".SoundType.TimeBeforeCanReplay");
00081
00082 }
00083
00084
00085 uint32 CMusicSound::getDuration()
00086 {
00087
00088
00089 return 0;
00090 }
00091
00092
00093 void CMusicSound::getSubSoundList(std::vector<std::pair<std::string, CSound*> > &subsounds) const
00094 {
00095 subsounds.clear();
00096 }
00097
00098
00099 void CMusicSound::serial(NLMISC::IStream &s)
00100 {
00101 s.serialVersion(0);
00102 CSound::serial(s);
00103
00104 CStringMapper::serialString(s, _FileName);
00105 s.serial(_FadeInLength, _FadeOutLength);
00106 s.serial(_MinimumPlayTime, _TimeBeforeCanReplay);
00107 }
00108
00109
00110 float CMusicSound::getMaxDistance() const
00111 {
00112
00113
00114 return 0.f;
00115 }
00116
00117
00118 bool CMusicSound::isDetailed() const
00119 {
00120 return false;
00121 }
00122
00123
00124
00125 }