/indra/newview/llvieweraudio.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 88 lines · 46 code · 15 blank · 27 comment · 0 complexity · e8df6a58f70f6555f5b335b0ebb09166 MD5 · raw file

  1. /**
  2. * @file llvieweraudio.h
  3. * @brief Audio functions that used to be in viewer.cpp
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_VIEWERAUDIO_H
  27. #define LL_VIEWERAUDIO_H
  28. #include "llframetimer.h"
  29. #include "llsingleton.h"
  30. // comment out to turn off wind
  31. #define kAUDIO_ENABLE_WIND
  32. //#define kAUDIO_ENABLE_WATER 1 // comment out to turn off water
  33. #define kAUDIO_NUM_BUFFERS 30
  34. #define kAUDIO_NUM_SOURCES 30
  35. void init_audio();
  36. void audio_update_volume(bool force_update = true);
  37. void audio_update_listener();
  38. void audio_update_wind(bool force_update = true);
  39. class LLViewerAudio : public LLSingleton<LLViewerAudio>
  40. {
  41. public:
  42. enum EFadeState
  43. {
  44. FADE_IDLE,
  45. FADE_IN,
  46. FADE_OUT,
  47. };
  48. LLViewerAudio();
  49. virtual ~LLViewerAudio();
  50. void startInternetStreamWithAutoFade(std::string streamURI);
  51. void stopInternetStreamWithAutoFade();
  52. bool onIdleUpdate();
  53. EFadeState getFadeState() { return mFadeState; }
  54. bool isDone() { return mDone; };
  55. F32 getFadeVolume();
  56. bool getForcedTeleportFade() { return mForcedTeleportFade; };
  57. void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
  58. void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ;
  59. private:
  60. bool mDone;
  61. F32 mFadeTime;
  62. std::string mNextStreamURI;
  63. EFadeState mFadeState;
  64. LLFrameTimer stream_fade_timer;
  65. bool mIdleListnerActive;
  66. bool mForcedTeleportFade;
  67. boost::signals2::connection mTeleportFailedConnection;
  68. void registerIdleListener();
  69. void deregisterIdleListener() { mIdleListnerActive = false; };
  70. void startFading();
  71. void onTeleportFailed();
  72. };
  73. #endif //LL_VIEWER_H