llstreamingaudio_fmod.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * @file llstreamingaudio_fmod.h
  3. * @author Tofu Linden
  4. * @brief Definition of LLStreamingAudio_FMOD implementation
  5. *
  6. * $LicenseInfo:firstyear=2009&license=viewergpl$
  7. *
  8. * Copyright (c) 2009, Linden Research, Inc.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #ifndef LL_STREAMINGAUDIO_FMOD_H
  34. #define LL_STREAMINGAUDIO_FMOD_H
  35. #include "stdtypes.h"
  36. #include "llstreamingaudio.h"
  37. // Stubs
  38. class LLAudioStreamManagerFMOD;
  39. namespace FMOD
  40. {
  41. class System;
  42. class Channel;
  43. class ChannelGroup;
  44. }
  45. // Interfaces
  46. class LLStreamingAudio_FMOD : public LLStreamingAudioInterface
  47. {
  48. protected:
  49. LOG_CLASS(LLStreamingAudio_FMOD);
  50. public:
  51. LLStreamingAudio_FMOD(FMOD::System* system);
  52. ~LLStreamingAudio_FMOD() override;
  53. bool supportsAdjustableBufferSizes() override { return true; }
  54. void setBufferSizes(U32 streambuffertime, U32 decodebuffertime) override;
  55. void start(const std::string& url) override;
  56. void stop() override;
  57. void pause(S32 pause) override;
  58. void update() override;
  59. S32 isPlaying() override;
  60. void setGain(F32 vol) override;
  61. F32 getGain() override { return mGain; }
  62. std::string getURL() override { return mURL; }
  63. bool newMetaData() override { return mNewMetaData; }
  64. void gotMetaData() override { mNewMetaData = false; }
  65. std::string getArtist() override { return mArtist; }
  66. std::string getTitle() override { return mTitle; }
  67. private:
  68. bool releaseDeadStreams(bool force);
  69. private:
  70. FMOD::System* mSystem;
  71. FMOD::Channel* mFMODInternetStreamChannelp;
  72. FMOD::ChannelGroup* mStreamGroup;
  73. LLAudioStreamManagerFMOD* mCurrentInternetStreamp;
  74. U32 mBufferMilliSeconds;
  75. F32 mGain;
  76. F32 mLastStarved;
  77. std::string mURL;
  78. std::string mArtist;
  79. std::string mTitle;
  80. std::list<LLAudioStreamManagerFMOD*> mDeadStreams;
  81. bool mPendingStart;
  82. bool mNewMetaData;
  83. };
  84. #endif // LL_STREAMINGAUDIO_FMOD_H