PageRenderTime 33ms CodeModel.GetById 3ms app.highlight 14ms RepoModel.GetById 7ms app.codeStats 1ms

/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
27#ifndef LL_VIEWERAUDIO_H
28#define LL_VIEWERAUDIO_H
29
30#include "llframetimer.h"
31#include "llsingleton.h"
32
33// comment out to turn off wind
34#define kAUDIO_ENABLE_WIND 
35//#define kAUDIO_ENABLE_WATER 1	// comment out to turn off water
36#define kAUDIO_NUM_BUFFERS 30
37#define kAUDIO_NUM_SOURCES 30 
38
39void init_audio();
40void audio_update_volume(bool force_update = true);
41void audio_update_listener();
42void audio_update_wind(bool force_update = true);
43
44class LLViewerAudio : public LLSingleton<LLViewerAudio>
45{
46public:
47
48	enum EFadeState
49	{
50		FADE_IDLE,
51		FADE_IN,
52		FADE_OUT,
53	};
54
55	LLViewerAudio();
56	virtual ~LLViewerAudio();
57	
58	void startInternetStreamWithAutoFade(std::string streamURI);
59	void stopInternetStreamWithAutoFade();
60	
61	bool onIdleUpdate();
62
63	EFadeState getFadeState() { return mFadeState; }
64	bool isDone() { return mDone; };
65	F32 getFadeVolume();
66	bool getForcedTeleportFade() { return mForcedTeleportFade; };
67	void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
68	void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ;
69
70private:
71
72	bool mDone;
73	F32 mFadeTime;
74	std::string mNextStreamURI;
75	EFadeState mFadeState;
76	LLFrameTimer stream_fade_timer;
77	bool mIdleListnerActive;
78	bool mForcedTeleportFade;
79	boost::signals2::connection	mTeleportFailedConnection;
80
81	void registerIdleListener();
82	void deregisterIdleListener() { mIdleListnerActive = false; };
83	void startFading();
84	void onTeleportFailed();
85
86};
87
88#endif //LL_VIEWER_H