diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llaudio/audioengine_fmod.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llaudio/audioengine_fmod.cpp')
-rw-r--r-- | linden/indra/llaudio/audioengine_fmod.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/linden/indra/llaudio/audioengine_fmod.cpp b/linden/indra/llaudio/audioengine_fmod.cpp index cc2042d..16d820c 100644 --- a/linden/indra/llaudio/audioengine_fmod.cpp +++ b/linden/indra/llaudio/audioengine_fmod.cpp | |||
@@ -33,9 +33,6 @@ | |||
33 | #include "linden_common.h" | 33 | #include "linden_common.h" |
34 | 34 | ||
35 | #include "audioengine_fmod.h" | 35 | #include "audioengine_fmod.h" |
36 | |||
37 | #if LL_FMOD | ||
38 | |||
39 | #include "listener_fmod.h" | 36 | #include "listener_fmod.h" |
40 | 37 | ||
41 | #include "llerror.h" | 38 | #include "llerror.h" |
@@ -72,7 +69,7 @@ F32 gCurrentPanGainR = 0.5f; | |||
72 | 69 | ||
73 | 70 | ||
74 | // Safe strcpy | 71 | // Safe strcpy |
75 | #if LL_WINDOWS || LL_LINUX | 72 | #if 0 //(unused) //LL_WINDOWS || LL_LINUX |
76 | static size_t strlcpy( char* dest, const char* src, size_t dst_size ) | 73 | static size_t strlcpy( char* dest, const char* src, size_t dst_size ) |
77 | { | 74 | { |
78 | size_t source_len = 0; | 75 | size_t source_len = 0; |
@@ -655,11 +652,11 @@ LLAudioBufferFMOD::~LLAudioBufferFMOD() | |||
655 | } | 652 | } |
656 | 653 | ||
657 | 654 | ||
658 | BOOL LLAudioBufferFMOD::loadWAV(const char *filename) | 655 | BOOL LLAudioBufferFMOD::loadWAV(const std::string& filename) |
659 | { | 656 | { |
660 | // Try to open a wav file from disk. This will eventually go away, as we don't | 657 | // Try to open a wav file from disk. This will eventually go away, as we don't |
661 | // really want to block doing this. | 658 | // really want to block doing this. |
662 | if (filename == NULL) | 659 | if (filename.empty()) |
663 | { | 660 | { |
664 | // invalid filename, abort. | 661 | // invalid filename, abort. |
665 | return FALSE; | 662 | return FALSE; |
@@ -705,7 +702,7 @@ BOOL LLAudioBufferFMOD::loadWAV(const char *filename) | |||
705 | fclose(sound_file); | 702 | fclose(sound_file); |
706 | } | 703 | } |
707 | #else | 704 | #else |
708 | mSamplep = FSOUND_Sample_Load(FSOUND_UNMANAGED, filename, FSOUND_LOOP_NORMAL, 0, 0); | 705 | mSamplep = FSOUND_Sample_Load(FSOUND_UNMANAGED, filename.c_str(), FSOUND_LOOP_NORMAL, 0, 0); |
709 | #endif | 706 | #endif |
710 | 707 | ||
711 | if (!mSamplep) | 708 | if (!mSamplep) |
@@ -777,11 +774,11 @@ void LLAudioEngine_FMOD::initInternetStream() | |||
777 | 774 | ||
778 | // Leave the net buffer properties at the default. | 775 | // Leave the net buffer properties at the default. |
779 | //FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80); | 776 | //FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80); |
780 | mInternetStreamURL[0] = 0; | 777 | mInternetStreamURL.clear(); |
781 | } | 778 | } |
782 | 779 | ||
783 | 780 | ||
784 | void LLAudioEngine_FMOD::startInternetStream(const char* url) | 781 | void LLAudioEngine_FMOD::startInternetStream(const std::string& url) |
785 | { | 782 | { |
786 | if (!mInited) | 783 | if (!mInited) |
787 | { | 784 | { |
@@ -791,16 +788,16 @@ void LLAudioEngine_FMOD::startInternetStream(const char* url) | |||
791 | 788 | ||
792 | // "stop" stream but don't clear url, etc. in calse url == mInternetStreamURL | 789 | // "stop" stream but don't clear url, etc. in calse url == mInternetStreamURL |
793 | stopInternetStream(); | 790 | stopInternetStream(); |
794 | if (url) | 791 | if (!url.empty()) |
795 | { | 792 | { |
796 | llinfos << "Starting internet stream: " << url << llendl; | 793 | llinfos << "Starting internet stream: " << url << llendl; |
797 | mCurrentInternetStreamp = new LLAudioStreamFMOD(url); | 794 | mCurrentInternetStreamp = new LLAudioStreamFMOD(url); |
798 | strlcpy(mInternetStreamURL, url, 1024); | 795 | mInternetStreamURL = url; |
799 | } | 796 | } |
800 | else | 797 | else |
801 | { | 798 | { |
802 | llinfos << "Set internet stream to null" << llendl; | 799 | llinfos << "Set internet stream to null" << llendl; |
803 | mInternetStreamURL[0] = 0; | 800 | mInternetStreamURL.clear(); |
804 | } | 801 | } |
805 | } | 802 | } |
806 | 803 | ||
@@ -930,7 +927,7 @@ void LLAudioEngine_FMOD::stopInternetStream() | |||
930 | mDeadStreams.push_back(mCurrentInternetStreamp); | 927 | mDeadStreams.push_back(mCurrentInternetStreamp); |
931 | } | 928 | } |
932 | mCurrentInternetStreamp = NULL; | 929 | mCurrentInternetStreamp = NULL; |
933 | //mInternetStreamURL[0] = 0; | 930 | //mInternetStreamURL.clear(); |
934 | } | 931 | } |
935 | } | 932 | } |
936 | 933 | ||
@@ -963,7 +960,7 @@ int LLAudioEngine_FMOD::isInternetStreamPlaying() | |||
963 | { | 960 | { |
964 | return 1; // Active and playing | 961 | return 1; // Active and playing |
965 | } | 962 | } |
966 | else if (mInternetStreamURL[0]) | 963 | else if (!mInternetStreamURL.empty()) |
967 | { | 964 | { |
968 | return 2; // "Paused" | 965 | return 2; // "Paused" |
969 | } | 966 | } |
@@ -993,19 +990,18 @@ void LLAudioEngine_FMOD::setInternetStreamGain(F32 vol) | |||
993 | } | 990 | } |
994 | 991 | ||
995 | 992 | ||
996 | const char* LLAudioEngine_FMOD::getInternetStreamURL() | 993 | const std::string& LLAudioEngine_FMOD::getInternetStreamURL() |
997 | { | 994 | { |
998 | return mInternetStreamURL; | 995 | return mInternetStreamURL; |
999 | } | 996 | } |
1000 | 997 | ||
1001 | 998 | ||
1002 | LLAudioStreamFMOD::LLAudioStreamFMOD(const char *url) : | 999 | LLAudioStreamFMOD::LLAudioStreamFMOD(const std::string& url) : |
1003 | mInternetStream(NULL), | 1000 | mInternetStream(NULL), |
1004 | mReady(FALSE) | 1001 | mReady(FALSE) |
1005 | { | 1002 | { |
1006 | mInternetStreamURL[0] = 0; | 1003 | mInternetStreamURL = url; |
1007 | strlcpy(mInternetStreamURL, url, 1024); | 1004 | mInternetStream = FSOUND_Stream_Open(url.c_str(), FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); |
1008 | mInternetStream = FSOUND_Stream_Open(url, FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); | ||
1009 | if (!mInternetStream) | 1005 | if (!mInternetStream) |
1010 | { | 1006 | { |
1011 | llwarns << "Couldn't open fmod stream, error " | 1007 | llwarns << "Couldn't open fmod stream, error " |
@@ -1171,6 +1167,3 @@ void * F_CALLBACKAPI windCallback(void *originalbuffer, void *newbuffer, int len | |||
1171 | 1167 | ||
1172 | return newbuffer; | 1168 | return newbuffer; |
1173 | } | 1169 | } |
1174 | |||
1175 | #endif // LL_FMOD | ||
1176 | |||