aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llaudiostatus.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llaudiostatus.cpp412
1 files changed, 0 insertions, 412 deletions
diff --git a/linden/indra/newview/llaudiostatus.cpp b/linden/indra/newview/llaudiostatus.cpp
deleted file mode 100644
index f24d939..0000000
--- a/linden/indra/newview/llaudiostatus.cpp
+++ /dev/null
@@ -1,412 +0,0 @@
1/**
2 * @file llaudiostatus.cpp
3 * @brief Audio channel allocation information
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#include "llviewerprecompiledheaders.h"
30
31#include "llaudiostatus.h"
32
33#include "linked_lists.h"
34#include "llmath.h" // clampf()
35#include "llgl.h"
36#include "llview.h"
37#include "llfontgl.h"
38#include "llcircuit.h"
39#include "message.h"
40#include "sound_ids.h"
41#include "audioengine.h"
42
43#include "llui.h"
44#include "llagent.h"
45#include "llviewercontrol.h"
46#include "viewer.h"
47
48#include "llglheaders.h"
49
50//
51// Imported globals
52//
53extern LLMessageSystem* gMessageSystem;
54extern LLAudioEngine* gAudiop;
55
56//
57// Constants
58//
59
60
61LLAudiostatus::LLAudiostatus(const std::string& name, const LLRect& rect)
62 : LLView(name, rect, FALSE)
63{
64 mPage = 0;
65}
66
67//
68// Functions
69//
70
71EWidgetType LLAudiostatus::getWidgetType() const
72{
73 return WIDGET_TYPE_AUDIO_STATUS;
74}
75
76LLString LLAudiostatus::getWidgetTag() const
77{
78 return LL_AUDIOSTATUS_TAG;
79}
80
81const F32 AUDIOSTATUS_SIZE = 64;
82
83void LLAudiostatus::draw()
84{
85 /*
86 mPage = gSavedSettings.getS32("AudioInfoPage");
87
88 if (!getVisible() || !mPage)
89 {
90 return;
91 }
92
93 glMatrixMode(GL_MODELVIEW);
94 glPushMatrix();
95
96 // We're going to be drawing flat shaded rectangles
97 {
98 LLGLSNoTexture gls_ui_no_texture;
99
100 // Draw background black rectangle
101 glColor4f(0.f, 0.f, 0.f, 0.3f);
102 gl_rect_2d(0, 0, 325, -340); // -y is down (don't know why)
103 }
104
105 glPopMatrix();
106 glPushMatrix();
107
108 S32 channel;
109 char out_str[64];
110 LLColor4 color;
111
112 if (gAudiop)
113 {
114 for (channel = 0; channel < MAX_BUFFERS; channel++)
115 {
116 if (gAudiop->getFlags(channel) & LL_SOUND_FLAG_LOOP)
117 {
118 color.setVec(0.5f,0.5f,1.f,1.f);
119 }
120 else
121 {
122 color.setVec(1.f,1.f,1.f,1.f);
123 }
124
125 sprintf(out_str,"%d:",channel);
126
127 U8 render_style = LLFontGL::NORMAL;
128
129 if (gAudiop->getFlags(channel) & LL_SOUND_FLAG_SYNC_MASTER)
130 {
131 render_style |= LLFontGL::BOLD;
132 }
133
134 if (gAudiop->getFlags(channel) & LL_SOUND_FLAG_SYNC_SLAVE)
135 {
136 render_style |= LLFontGL::ITALIC;
137 }
138
139 if (gAudiop->getFlags(channel) & LL_SOUND_FLAG_SYNC_PENDING)
140 {
141 render_style |= LLFontGL::UNDERLINE;
142 }
143
144 LLFontGL::sMonospace->render(out_str, 0, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP, render_style, S32_MAX, S32_MAX, NULL);
145
146// render_style = LLFontGL::NORMAL;
147// if (gAudiop->mCurrentSyncMaster == channel)
148// {
149// render_style |= LLFontGL::BOLD;
150// }
151
152 if (!gAudiop->mBufferInUse[channel])
153 {
154 color.setVec(0.5f,0.5f,0.5f,1.f);
155 }
156 else if (gAudiop->isPlaying(channel))
157 {
158 color.setVec(0.f,1.f,0.f,1.f);
159 }
160 else
161 {
162 color.setVec(1.f,0.f,0.f,1.f);
163 }
164
165 if (gAudiop->mWindBufferID ==channel)
166 {
167 strcpy(out_str,"wind DMO");
168 }
169 else if (gAudiop->mWaterBufferID ==channel)
170 {
171 strcpy(out_str,"water DMO");
172 }
173 else if (gAudiop->mGUID[channel] == SND_CHIRP)
174 {
175 strcpy(out_str,"chirp");
176 }
177 else if (gAudiop->mGUID[channel] == SND_SHOT)
178 {
179 strcpy(out_str,"shot");
180 }
181 else if (gAudiop->mGUID[channel] == SND_MORTAR)
182 {
183 strcpy(out_str,"mortar");
184 }
185 else if (gAudiop->mGUID[channel] == SND_HIT)
186 {
187 strcpy(out_str,"hit");
188 }
189 else if (gAudiop->mGUID[channel] == SND_EXPLOSION)
190 {
191 strcpy(out_str,"explosion");
192 }
193 else if (gAudiop->mGUID[channel] == SND_BOING)
194 {
195 strcpy(out_str,"boing");
196 }
197 else if (gAudiop->mGUID[channel] == SND_MUNCH)
198 {
199 strcpy(out_str,"munch");
200 }
201 else if (gAudiop->mGUID[channel] == SND_PUNCH)
202 {
203 strcpy(out_str,"punch");
204 }
205 else if (gAudiop->mGUID[channel] == SND_SPLASH)
206 {
207 strcpy(out_str,"splash");
208 }
209 else if (gAudiop->mGUID[channel] == SND_CLICK)
210 {
211 strcpy(out_str,"click");
212 }
213 else if (gAudiop->mGUID[channel] == SND_ARROW_SHOT)
214 {
215 strcpy(out_str,"arrow");
216 }
217 else if (gAudiop->mGUID[channel] == SND_ARROW_THUD)
218 {
219 strcpy(out_str,"arrow thud");
220 }
221 else if (gAudiop->mGUID[channel] == SND_SILENCE)
222 {
223 strcpy(out_str,"silence");
224 }
225 else if (gAudiop->mGUID[channel] == SND_WELCOME)
226 {
227 strcpy(out_str,"welcome");
228 }
229 else if (gAudiop->mGUID[channel] == SND_WELCOME)
230 {
231 strcpy(out_str,"welcome");
232 }
233 else if (gAudiop->mGUID[channel] == SND_READY_FOR_BATTLE)
234 {
235 strcpy(out_str,"ready for battle");
236 }
237 else if (gAudiop->mGUID[channel] == SND_SQUISH)
238 {
239 strcpy(out_str,"squish");
240 }
241 else if (gAudiop->mGUID[channel] == SND_FOOTSTEPS)
242 {
243 strcpy(out_str,"footsteps");
244 }
245 else if (gAudiop->mGUID[channel] == SND_BALL_COLLISION)
246 {
247 strcpy(out_str,"ball collision");
248 }
249 else
250 {
251 gAudiop->mGUID[channel].toString(out_str);
252 }
253
254 out_str[8] = 0;
255 LLFontGL::sMonospace->render(out_str, 23, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP, render_style, S32_MAX, S32_MAX, NULL);
256
257 if (mPage == 1)
258 {
259 LLVector3 pos = gAudiop->getSourcePos(channel);
260 sprintf(out_str,"%6.2f %6.2f %6.2f",pos.mV[VX],pos.mV[VY],pos.mV[VZ]);
261 LLFontGL::sMonospace->render(out_str, 103, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
262
263 F32 gain = gAudiop->getSourceGain_dB(channel);
264 sprintf(out_str,"%7.2f",gain);
265 LLFontGL::sMonospace->render(out_str, 260, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
266
267 sprintf(out_str,"%X", gAudiop->mPriority[channel] >> 28);
268 LLFontGL::sMonospace->render(out_str, 315, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
269 }
270 else if (mPage == 4)
271 {
272 F32 indicator_width = 240;
273
274 glPushMatrix();
275 // We're going to be drawing flat shaded rectangles
276 LLGLSNoTexture gls_no_texture;
277 // Draw background black rectangle
278 glColor4f(0.f, 0.f, 0.f, 1.0f);
279
280 F32 length = gAudiop->getSourceLength(channel);
281 length = length/(44100.0*2.0); // length in seconds
282 length = length/10.f; // rescale per maximum length
283
284 gl_rect_2d(80, (-channel*10)-1, 80 + llfloor((F32)(indicator_width * length)), (-channel*10)-9); // -y is down (don't know why)
285
286 F32 current_pointer = gAudiop->getSourceCurrentSample(channel);
287 current_pointer = current_pointer/(44100.0*2.0); // length in seconds
288 current_pointer = current_pointer/10.f; // rescale per maximum length
289
290 if (!gAudiop->mBufferInUse[channel])
291 {
292 glColor4f(0.5f,0.5f,0.5f,1.f);
293 }
294 else if (gAudiop->isPlaying(channel))
295 {
296 glColor4f(0.f,1.f,0.f,1.f);
297 }
298 else
299 {
300 glColor4f(1.f,0.f,0.f,1.f);
301 }
302
303 gl_rect_2d(80, (-channel*10)-1, 80 + llfloor((F32)(indicator_width * current_pointer)), (-channel*10)-9); // -y is down (don't know why)
304
305 glPopMatrix();
306 {
307 LLGLSUIDefault gls_ui;
308
309 color.setVec(1.f,1.f,1.f,1.f);
310
311 sprintf(out_str,"%6.3f",length*10.f);
312 LLFontGL::sMonospace->render(out_str, 200, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP, render_style, S32_MAX, S32_MAX, NULL);
313
314 if (!(gAudiop->mVO_ID[channel].isNull()))
315 {
316 gAudiop->mVO_ID[channel].toString(out_str);
317 out_str[8] = 0;
318 LLFontGL::sMonospace->render(out_str, 260, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP, render_style, S32_MAX, S32_MAX, NULL);
319 }
320 if (gAudiop->mQueuedTrigger[channel])
321 {
322 gAudiop->mQueuedTrigger[channel]->mID.toString(out_str);
323 out_str[8] = 0;
324 LLFontGL::sMonospace->render(out_str, 320, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP, render_style, S32_MAX, S32_MAX, NULL);
325 }
326 }
327 }
328 else
329 {
330 S32 volume;
331 S32 freq;
332 S32 inside;
333 S32 outside;
334 LLVector3 orient;
335 S32 out_volume;
336 F32 min_dist;
337 F32 max_dist;
338
339 gAudiop->get3DParams(channel, &volume, &freq, &inside, &outside, &orient, &out_volume, &min_dist, &max_dist);
340
341 if (mPage == 2)
342 {
343 sprintf(out_str,"%4.2f %4.2f %4.2f",orient.mV[VX],orient.mV[VY],orient.mV[VZ]);
344 LLFontGL::sMonospace->render(out_str, 103, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
345
346 sprintf(out_str,"%4d %4d",inside, outside);
347 LLFontGL::sMonospace->render(out_str, 210, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
348
349 sprintf(out_str,"%6d", out_volume);
350 LLFontGL::sMonospace->render(out_str, 280, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
351 }
352 else // mPage == 3
353 {
354 F32 distance = 0.f;
355 if (gAudiop->isSourceAmbient(channel))
356 {
357 distance = dist_vec(gAudiop->getSourcePos(channel),LLVector3::zero);
358 }
359 else
360 {
361 distance = dist_vec(gAudiop->getSourcePos(channel),gAudiop->getListenerPos());
362 }
363
364 sprintf(out_str,"%6.2f %6.2f %6.2f",distance, min_dist, max_dist);
365 LLFontGL::sMonospace->render(out_str, 103, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
366
367 F32 gain = gAudiop->getSourceGain_dB(channel);
368 sprintf(out_str,"%7.2f",gain);
369 LLFontGL::sMonospace->render(out_str, 280, -channel*10, color, LLFontGL::LEFT, LLFontGL::TOP);
370 }
371 }
372 }
373 LLFontGL::sMonospace->render("Listener", 23, -(channel*10+5), color, LLFontGL::LEFT, LLFontGL::TOP);
374
375
376 if (mPage == 1)
377 {
378 LLVector3 lpos = gAudiop->getListenerPos();
379 sprintf(out_str,"%6.2f %6.2f %6.2f",lpos.mV[VX],lpos.mV[VY],lpos.mV[VZ]);
380 LLFontGL::sMonospace->render(out_str, 103, -(channel*10+5), color, LLFontGL::LEFT, LLFontGL::TOP);
381
382 F32 gain = gAudiop->getMasterGain_dB();
383 sprintf(out_str,"%7.2f",gain);
384 LLFontGL::sMonospace->render(out_str, 280, -(channel*10+5), color, LLFontGL::LEFT, LLFontGL::TOP);
385 }
386 else if (mPage == 2)
387 {
388 sprintf(out_str,"cone orient inner outer gain");
389 LLFontGL::sMonospace->render(out_str, 103, -(channel*10+5), color, LLFontGL::LEFT, LLFontGL::TOP);
390 }
391 else if (mPage == 3)
392 {
393 sprintf(out_str,"distance min max gain");
394 LLFontGL::sMonospace->render(out_str, 103, -(channel*10+5), color, LLFontGL::LEFT, LLFontGL::TOP);
395 }
396 }
397 else
398 {
399 LLFontGL::sMonospace->render("No Audio Engine available", 50 , -175,
400 LLColor4(1.f,0.1f,0.1f,1.f),
401 LLFontGL::LEFT, LLFontGL::TOP);
402 }
403
404 glPopMatrix();
405 */
406}
407
408
409
410
411
412