vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_Sound.C
Go to the documentation of this file.
1#include <stdio.h> // for fprintf, stderr, printf
2#include <string.h> // for strlen
3
4#include "vrpn_Connection.h" // for vrpn_HANDLERPARAM, etc
5#include "vrpn_Sound.h"
6
7// vrpn_Sound constructor.
9 : vrpn_BaseClass(name, c)
10{
12}
13
15{
17 d_connection->register_message_type("vrpn_Sound Load_Local");
19 d_connection->register_message_type("vrpn_Sound Load_Remote");
20 unload_sound = d_connection->register_message_type("vrpn_Sound Unload");
21 play_sound = d_connection->register_message_type("vrpn_Sound Play");
22 stop_sound = d_connection->register_message_type("vrpn_Sound Stop");
24 d_connection->register_message_type("vrpn_Sound Status");
25
27 d_connection->register_message_type("vrpn_Sound Listener_Pose");
29 d_connection->register_message_type("vrpn_Sound Listener_Velocity");
30
33 d_connection->register_message_type("vrpn_Sound Velocity");
35 d_connection->register_message_type("vrpn_Sound DistInfo");
37 d_connection->register_message_type("vrpn_Sound ConeInfo");
38
40 d_connection->register_message_type("vrpn_Sound DopFac");
44
46 d_connection->register_message_type("vrpn_Sound Load_Model_Local");
48 d_connection->register_message_type("vrpn_Sound Load_Model_Remote");
50 d_connection->register_message_type("vrpn_Sound Load_Poly_Quad");
52 d_connection->register_message_type("vrpn_Sound Load_Poly_Tri");
54 d_connection->register_message_type("vrpn_Sound Load_Material");
56 d_connection->register_message_type("vrpn_Sound Quad_Vertices");
58 d_connection->register_message_type("vrpn_Sound Tri_Vertices");
60 d_connection->register_message_type("vrpn_Sound Poly_OF");
62 d_connection->register_message_type("vrpn_Sound Poly_Material");
63
64 return 0;
65}
66
68
69vrpn_int32 vrpn_Sound::encodeSound_local(const char *filename,
70 const vrpn_SoundID id,
71 const vrpn_SoundDef sound, char **buf)
72{
73 vrpn_int32 len = static_cast<vrpn_int32>(
74 sizeof(vrpn_SoundID) + strlen(filename) + sizeof(vrpn_SoundDef) + 1);
75 vrpn_int32 ret = len;
76 char *mptr;
77 int i;
78
79 *buf = NULL;
80 try { *buf = new char[len]; }
81 catch (...) {
82 fprintf(stderr, "vrpn_Sound::encodeSound_local(): Out of memory.\n");
83 return 0;
84 }
85
86 mptr = *buf;
87 vrpn_buffer(&mptr, &len, id);
88
89 for (i = 0; i < 3; i++)
90 vrpn_buffer(&mptr, &len, sound.pose.position[i]);
91
92 for (i = 0; i < 4; i++)
93 vrpn_buffer(&mptr, &len, sound.pose.orientation[i]);
94
95 for (i = 0; i < 4; i++)
96 vrpn_buffer(&mptr, &len, sound.velocity[i]);
97
98 vrpn_buffer(&mptr, &len, sound.volume);
99
100 vrpn_buffer(&mptr, &len, sound.max_back_dist);
101 vrpn_buffer(&mptr, &len, sound.min_back_dist);
102 vrpn_buffer(&mptr, &len, sound.max_front_dist);
103 vrpn_buffer(&mptr, &len, sound.min_front_dist);
104
105 vrpn_buffer(&mptr, &len, sound.cone_inner_angle);
106 vrpn_buffer(&mptr, &len, sound.cone_outer_angle);
107 vrpn_buffer(&mptr, &len, sound.cone_gain);
108 vrpn_buffer(&mptr, &len, sound.dopler_scale);
109 vrpn_buffer(&mptr, &len, sound.equalization_val);
110 vrpn_buffer(&mptr, &len, sound.pitch);
111
112 vrpn_buffer(&mptr, &len, filename,
113 static_cast<vrpn_int32>(strlen(filename)) + 1);
114
115 return ret;
116}
117
118// Decodes the file and Client Index number
119vrpn_int32 vrpn_Sound::decodeSound_local(const char *buf, char **filename,
120 vrpn_SoundID *id, vrpn_SoundDef *sound,
121 const int payload)
122{
123 const char *mptr = buf;
124 int i;
125
126 *filename = NULL;
127 try { *filename =
128 new char[payload - sizeof(vrpn_SoundID) - sizeof(vrpn_SoundDef)]; }
129 catch (...) {
130 fprintf(stderr, "vrpn_Sound::decodeSound_local(): Out of memory.\n");
131 return -1;
132 }
133
134 vrpn_unbuffer(&mptr, id);
135
136 for (i = 0; i < 3; i++)
137 vrpn_unbuffer(&mptr, &(sound->pose.position[i]));
138
139 for (i = 0; i < 4; i++)
140 vrpn_unbuffer(&mptr, &(sound->pose.orientation[i]));
141
142 for (i = 0; i < 4; i++)
143 vrpn_unbuffer(&mptr, &(sound->velocity[i]));
144
145 vrpn_unbuffer(&mptr, &(sound->volume));
146
147 vrpn_unbuffer(&mptr, &(sound->max_back_dist));
148 vrpn_unbuffer(&mptr, &(sound->min_back_dist));
149 vrpn_unbuffer(&mptr, &(sound->max_front_dist));
150 vrpn_unbuffer(&mptr, &(sound->min_front_dist));
151
152 vrpn_unbuffer(&mptr, &(sound->cone_inner_angle));
153 vrpn_unbuffer(&mptr, &(sound->cone_outer_angle));
154 vrpn_unbuffer(&mptr, &(sound->cone_gain));
155 vrpn_unbuffer(&mptr, &(sound->dopler_scale));
156 vrpn_unbuffer(&mptr, &(sound->equalization_val));
157 vrpn_unbuffer(&mptr, &(sound->pitch));
158
159 vrpn_unbuffer(&mptr, *filename,
160 payload - sizeof(vrpn_SoundID) - sizeof(vrpn_SoundDef));
161
162 return 0;
163}
164
166vrpn_int32 vrpn_Sound::encodeSound_remote(const char * /*filename*/,
167 const vrpn_SoundID /*id*/,
168 char ** /*buf*/)
169{
170 return 0;
171}
173vrpn_int32 vrpn_Sound::decodeSound_remote(const char * /*buf*/,
174 char ** /*filename*/,
175 vrpn_SoundID * /*id*/,
176 const int /*payload*/)
177{
178 return 0;
179}
180
181// Encodes the client sound ID
182vrpn_int32 vrpn_Sound::encodeSoundID(const vrpn_SoundID id, char *buf)
183{
184 char *mptr = buf;
185 vrpn_int32 len = sizeof(vrpn_SoundID);
186
187 vrpn_buffer(&mptr, &len, id);
188
189 return (sizeof(vrpn_SoundID));
190}
191
192// Decodes the client sound ID
193vrpn_int32 vrpn_Sound::decodeSoundID(const char *buf, vrpn_SoundID *id)
194{
195 const char *mptr = buf;
196
197 vrpn_unbuffer(&mptr, id);
198
199 return 0;
200}
201
202// Sends all the information necessary to play a sound appropriately.
203// IE, The sounds position, orientation, velocity, volume and repeat count
205 const vrpn_SoundID id,
206 const vrpn_int32 repeat, char *buf)
207{
208 char *mptr = buf;
209 vrpn_int32 len =
210 sizeof(vrpn_SoundDef) + sizeof(vrpn_SoundID) + sizeof(vrpn_int32);
211 vrpn_int32 ret = len;
212 int i;
213
214 vrpn_buffer(&mptr, &len, repeat);
215 vrpn_buffer(&mptr, &len, id);
216
217 for (i = 0; i < 3; i++)
218 vrpn_buffer(&mptr, &len, sound.pose.position[i]);
219
220 for (i = 0; i < 4; i++)
221 vrpn_buffer(&mptr, &len, sound.pose.orientation[i]);
222
223 for (i = 0; i < 4; i++)
224 vrpn_buffer(&mptr, &len, sound.velocity[i]);
225
226 vrpn_buffer(&mptr, &len, sound.volume);
227
228 vrpn_buffer(&mptr, &len, sound.max_back_dist);
229 vrpn_buffer(&mptr, &len, sound.min_back_dist);
230 vrpn_buffer(&mptr, &len, sound.max_front_dist);
231 vrpn_buffer(&mptr, &len, sound.min_front_dist);
232
233 vrpn_buffer(&mptr, &len, sound.cone_inner_angle);
234 vrpn_buffer(&mptr, &len, sound.cone_outer_angle);
235 vrpn_buffer(&mptr, &len, sound.cone_gain);
236 vrpn_buffer(&mptr, &len, sound.dopler_scale);
237 vrpn_buffer(&mptr, &len, sound.equalization_val);
238 vrpn_buffer(&mptr, &len, sound.pitch);
239
240 return ret;
241}
242
243vrpn_int32 vrpn_Sound::decodeSoundDef(const char *buf, vrpn_SoundDef *sound,
244 vrpn_SoundID *id, vrpn_int32 *repeat)
245{
246 const char *mptr = buf;
247 int i;
248
249 vrpn_unbuffer(&mptr, repeat);
250 vrpn_unbuffer(&mptr, id);
251
252 for (i = 0; i < 3; i++)
253 vrpn_unbuffer(&mptr, &(sound->pose.position[i]));
254
255 for (i = 0; i < 4; i++)
256 vrpn_unbuffer(&mptr, &(sound->pose.orientation[i]));
257
258 for (i = 0; i < 4; i++)
259 vrpn_unbuffer(&mptr, &(sound->velocity[i]));
260
261 vrpn_unbuffer(&mptr, &(sound->volume));
262
263 vrpn_unbuffer(&mptr, &(sound->max_back_dist));
264 vrpn_unbuffer(&mptr, &(sound->min_back_dist));
265 vrpn_unbuffer(&mptr, &(sound->max_front_dist));
266 vrpn_unbuffer(&mptr, &(sound->min_front_dist));
267
268 vrpn_unbuffer(&mptr, &(sound->cone_inner_angle));
269 vrpn_unbuffer(&mptr, &(sound->cone_outer_angle));
270 vrpn_unbuffer(&mptr, &(sound->cone_gain));
271 vrpn_unbuffer(&mptr, &(sound->dopler_scale));
272 vrpn_unbuffer(&mptr, &(sound->equalization_val));
273 vrpn_unbuffer(&mptr, &(sound->pitch));
274
275 return 0;
276}
277
278// Sends information about the listener. IE position, orientation and velocity
279vrpn_int32 vrpn_Sound::encodeListenerPose(const vrpn_PoseDef pose, char *buf)
280{
281 char *mptr = buf;
282 vrpn_int32 len = sizeof(vrpn_ListenerDef);
283 vrpn_int32 ret = len;
284 int i;
285
286 for (i = 0; i < 3; i++)
287 vrpn_buffer(&mptr, &len, pose.position[i]);
288
289 for (i = 0; i < 4; i++)
290 vrpn_buffer(&mptr, &len, pose.orientation[i]);
291
292 return ret;
293}
294
295vrpn_int32 vrpn_Sound::decodeListenerPose(const char *buf, vrpn_PoseDef *pose)
296{
297 const char *mptr = buf;
298 int i;
299
300 for (i = 0; i < 3; i++)
301 vrpn_unbuffer(&mptr, &pose->position[i]);
302
303 for (i = 0; i < 4; i++)
304 vrpn_unbuffer(&mptr, &pose->orientation[i]);
305
306 return 0;
307}
308
310 const vrpn_int32 repeat, char *buf)
311{
312 char *mptr = buf;
313 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_int32);
314 vrpn_int32 ret = len;
315
316 vrpn_buffer(&mptr, &len, repeat);
317 vrpn_buffer(&mptr, &len, id);
318 return ret;
319}
320
321vrpn_int32 vrpn_Sound::decodeSoundPlay(const char *buf, vrpn_SoundID *id,
322 vrpn_int32 *repeat)
323{
324 const char *mptr = buf;
325
326 vrpn_unbuffer(&mptr, repeat);
327 vrpn_unbuffer(&mptr, id);
328 return 0;
329}
330
331vrpn_int32 vrpn_Sound::encodeListenerVelocity(const vrpn_float64 *velocity,
332 char *buf)
333{
334 char *mptr = buf;
335 vrpn_int32 len = sizeof(vrpn_float64) * 4;
336 vrpn_int32 ret = len;
337 int i;
338
339 for (i = 0; i < 4; i++)
340 vrpn_buffer(&mptr, &len, velocity[i]);
341
342 return ret;
343}
344
345vrpn_int32 vrpn_Sound::decodeListenerVelocity(const char *buf,
346 vrpn_float64 *velocity)
347{
348 const char *mptr = buf;
349
350 for (int i = 0; i < 4; i++)
351 vrpn_unbuffer(&mptr, &velocity[i]);
352
353 return 0;
354}
355
357 const vrpn_SoundID id, char *buf)
358{
359 char *mptr = buf;
360 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_PoseDef);
361 vrpn_int32 ret = len;
362 int i;
363
364 vrpn_buffer(&mptr, &len, id);
365
366 for (i = 0; i < 4; i++)
367 vrpn_buffer(&mptr, &len, pose.orientation[i]);
368
369 for (i = 0; i < 3; i++)
370 vrpn_buffer(&mptr, &len, pose.position[i]);
371
372 return ret;
373}
374
375vrpn_int32 vrpn_Sound::decodeSoundPose(const char *buf, vrpn_PoseDef *pose,
376 vrpn_SoundID *id)
377{
378 const char *mptr = buf;
379 int i;
380
381 vrpn_unbuffer(&mptr, id);
382
383 for (i = 0; i < 4; i++)
384 vrpn_unbuffer(&mptr, &pose->orientation[i]);
385
386 for (i = 0; i < 3; i++)
387 vrpn_unbuffer(&mptr, &pose->position[i]);
388
389 return 0;
390}
391
392vrpn_int32 vrpn_Sound::encodeSoundVelocity(const vrpn_float64 *velocity,
393 const vrpn_SoundID id, char *buf)
394{
395 char *mptr = buf;
396 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64) * 4;
397 vrpn_int32 ret = len;
398 int i;
399
400 vrpn_buffer(&mptr, &len, id);
401
402 for (i = 0; i < 4; i++)
403 vrpn_buffer(&mptr, &len, velocity[i]);
404
405 return ret;
406}
407
408vrpn_int32 vrpn_Sound::decodeSoundVelocity(const char *buf,
409 vrpn_float64 *velocity,
410 vrpn_SoundID *id)
411{
412 const char *mptr = buf;
413 int i;
414
415 vrpn_unbuffer(&mptr, id);
416
417 for (i = 0; i < 4; i++)
418 vrpn_unbuffer(&mptr, &velocity[i]);
419
420 return 0;
421}
422
423vrpn_int32 vrpn_Sound::encodeSoundDistInfo(const vrpn_float64 min_back,
424 const vrpn_float64 max_back,
425 const vrpn_float64 min_front,
426 const vrpn_float64 max_front,
427 const vrpn_SoundID id, char *buf)
428{
429 char *mptr = buf;
430 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64) * 4;
431 vrpn_int32 ret = len;
432
433 vrpn_buffer(&mptr, &len, id);
434
435 vrpn_buffer(&mptr, &len, min_back);
436 vrpn_buffer(&mptr, &len, max_back);
437 vrpn_buffer(&mptr, &len, min_front);
438 vrpn_buffer(&mptr, &len, max_front);
439
440 return ret;
441}
442vrpn_int32
443vrpn_Sound::decodeSoundDistInfo(const char *buf, vrpn_float64 *min_back,
444 vrpn_float64 *max_back, vrpn_float64 *min_front,
445 vrpn_float64 *max_front, vrpn_SoundID *id)
446{
447 const char *mptr = buf;
448 vrpn_unbuffer(&mptr, id);
449
450 vrpn_unbuffer(&mptr, min_back);
451 vrpn_unbuffer(&mptr, max_back);
452 vrpn_unbuffer(&mptr, min_front);
453 vrpn_unbuffer(&mptr, max_front);
454
455 return 0;
456}
457
458vrpn_int32 vrpn_Sound::encodeSoundConeInfo(const vrpn_float64 cone_inner_angle,
459 const vrpn_float64 cone_outer_angle,
460 const vrpn_float64 cone_gain,
461 const vrpn_SoundID id, char *buf)
462{
463 char *mptr = buf;
464 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64) * 3;
465 vrpn_int32 ret = len;
466
467 vrpn_buffer(&mptr, &len, id);
468
469 vrpn_buffer(&mptr, &len, cone_inner_angle);
470 vrpn_buffer(&mptr, &len, cone_outer_angle);
471 vrpn_buffer(&mptr, &len, cone_gain);
472
473 return ret;
474}
475
476vrpn_int32 vrpn_Sound::decodeSoundConeInfo(const char *buf,
477 vrpn_float64 *cone_inner_angle,
478 vrpn_float64 *cone_outer_angle,
479 vrpn_float64 *cone_gain,
480 vrpn_SoundID *id)
481{
482 const char *mptr = buf;
483
484 vrpn_unbuffer(&mptr, id);
485
486 vrpn_unbuffer(&mptr, cone_inner_angle);
487 vrpn_unbuffer(&mptr, cone_outer_angle);
488 vrpn_unbuffer(&mptr, cone_gain);
489
490 return 0;
491}
492
493vrpn_int32 vrpn_Sound::encodeSoundDoplerScale(const vrpn_float64 doplerfactor,
494 const vrpn_SoundID id, char *buf)
495{
496 char *mptr = buf;
497 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64);
498 vrpn_int32 ret = len;
499
500 vrpn_buffer(&mptr, &len, id);
501
502 vrpn_buffer(&mptr, &len, doplerfactor);
503
504 return ret;
505}
506
507vrpn_int32 vrpn_Sound::decodeSoundDoplerScale(const char *buf,
508 vrpn_float64 *doplerfactor,
509 vrpn_SoundID *id)
510{
511 const char *mptr = buf;
512
513 vrpn_unbuffer(&mptr, id);
514 vrpn_unbuffer(&mptr, doplerfactor);
515
516 return 0;
517}
518
519vrpn_int32 vrpn_Sound::encodeSoundEqFactor(const vrpn_float64 eqfactor,
520 const vrpn_SoundID id, char *buf)
521{
522 char *mptr = buf;
523 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64);
524 vrpn_int32 ret = len;
525
526 vrpn_buffer(&mptr, &len, id);
527
528 vrpn_buffer(&mptr, &len, eqfactor);
529
530 return ret;
531}
532
533vrpn_int32 vrpn_Sound::decodeSoundEqFactor(const char *buf,
534 vrpn_float64 *eqfactor,
535 vrpn_SoundID *id)
536{
537 const char *mptr = buf;
538
539 vrpn_unbuffer(&mptr, id);
540
541 vrpn_unbuffer(&mptr, eqfactor);
542
543 return 0;
544}
545
546vrpn_int32 vrpn_Sound::encodeSoundPitch(const vrpn_float64 pitch,
547 const vrpn_SoundID id, char *buf)
548{
549 char *mptr = buf;
550 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64);
551 vrpn_int32 ret = len;
552
553 vrpn_buffer(&mptr, &len, id);
554
555 vrpn_buffer(&mptr, &len, pitch);
556
557 return ret;
558}
559
560vrpn_int32 vrpn_Sound::decodeSoundPitch(const char *buf, vrpn_float64 *pitch,
561 vrpn_SoundID *id)
562{
563 const char *mptr = buf;
564
565 vrpn_unbuffer(&mptr, id);
566
567 vrpn_unbuffer(&mptr, pitch);
568
569 return 0;
570}
571
572vrpn_int32 vrpn_Sound::encodeSoundVolume(const vrpn_float64 volume,
573 const vrpn_SoundID id, char *buf)
574{
575 char *mptr = buf;
576 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64);
577 vrpn_int32 ret = len;
578
579 vrpn_buffer(&mptr, &len, id);
580
581 vrpn_buffer(&mptr, &len, volume);
582
583 return ret;
584}
585
586vrpn_int32 vrpn_Sound::decodeSoundVolume(const char *buf, vrpn_float64 *volume,
587 vrpn_SoundID *id)
588{
589 const char *mptr = buf;
590
591 vrpn_unbuffer(&mptr, id);
592 vrpn_unbuffer(&mptr, volume);
593
594 return 0;
595}
596
597vrpn_int32 vrpn_Sound::encodeLoadModel_local(const char *filename, char **buf)
598{
599 vrpn_int32 len =
600 static_cast<vrpn_int32>(sizeof(vrpn_SoundID) + strlen(filename) + 1);
601 vrpn_int32 ret = len;
602 char *mptr;
603
604 *buf = NULL;
605 try { *buf = new char[strlen(filename) + sizeof(vrpn_SoundID) + 1]; }
606 catch (...) {
607 fprintf(stderr, "vrpn_Sound::encodeLoadModel_local(): Out of memory.\n");
608 return 0;
609 }
610
611 mptr = *buf;
612 vrpn_buffer(&mptr, &len, filename,
613 static_cast<vrpn_int32>(strlen(filename)) + 1);
614
615 return ret;
616}
617
618vrpn_int32 vrpn_Sound::decodeLoadModel_local(const char *buf, char **filename,
619 const int payload)
620{
621 const char *mptr = buf;
622
623 *filename = NULL;
624 try { *filename = new char[payload - sizeof(vrpn_SoundID)]; }
625 catch (...) {
626 fprintf(stderr, "vrpn_Sound::decodeLoadModel_local(): Out of memory.\n");
627 return -1;
628 }
629
630 vrpn_unbuffer(&mptr, *filename, payload - sizeof(vrpn_SoundID));
631
632 return 0;
633}
634
636vrpn_int32 vrpn_Sound::encodeLoadModel_remote(const char * /*filename*/,
637 char ** /*buf*/)
638{
639 return 0;
640}
642vrpn_int32 vrpn_Sound::decodeLoadModel_remote(const char * /*buf*/,
643 char ** /*filename*/,
644 const int /*payload*/)
645{
646 return 0;
647}
648
649vrpn_int32 vrpn_Sound::encodeLoadPolyQuad(const vrpn_QuadDef quad, char *buf)
650{
651 char *mptr = buf;
652 vrpn_int32 len = sizeof(vrpn_QuadDef);
653 vrpn_int32 ret = len;
654 int i;
655
656 vrpn_buffer(&mptr, &len, quad.subQuad);
657 vrpn_buffer(&mptr, &len, quad.openingFactor);
658 vrpn_buffer(&mptr, &len, quad.tag);
659 for (i = 0; i < 4; i++)
660 for (int j(0); j < 3; j++)
661 vrpn_buffer(&mptr, &len, quad.vertices[i][j]);
662
664
665 return ret;
666}
667
668vrpn_int32 vrpn_Sound::decodeLoadPolyQuad(const char *buf, vrpn_QuadDef *quad)
669{
670 const char *mptr = buf;
671 int i;
672
673 vrpn_unbuffer(&mptr, &quad->subQuad);
674 vrpn_unbuffer(&mptr, &quad->openingFactor);
675 vrpn_unbuffer(&mptr, &quad->tag);
676 for (i = 0; i < 4; i++)
677 for (int j(0); j < 3; j++)
678 vrpn_unbuffer(&mptr, &quad->vertices[i][j]);
680
681 return 0;
682}
683
684vrpn_int32 vrpn_Sound::encodeLoadPolyTri(const vrpn_TriDef tri, char *buf)
685{
686 char *mptr = buf;
687 vrpn_int32 len = sizeof(vrpn_int32) + sizeof(vrpn_TriDef);
688 vrpn_int32 ret = len;
689 int i;
690
691 vrpn_buffer(&mptr, &len, tri.subTri);
692 vrpn_buffer(&mptr, &len, tri.openingFactor);
693 vrpn_buffer(&mptr, &len, tri.tag);
694 for (i = 0; i < 3; i++)
695 for (int j(0); j < 3; j++)
696 vrpn_buffer(&mptr, &len, tri.vertices[i][j]);
698
699 return ret;
700}
701
702vrpn_int32 vrpn_Sound::decodeLoadPolyTri(const char *buf, vrpn_TriDef *tri)
703{
704 const char *mptr = buf;
705 int i;
706
707 vrpn_unbuffer(&mptr, &tri->subTri);
708 vrpn_unbuffer(&mptr, &tri->openingFactor);
709 vrpn_unbuffer(&mptr, &tri->tag);
710 for (i = 0; i < 3; i++)
711 for (int j(0); j < 3; j++)
712 vrpn_unbuffer(&mptr, &tri->vertices[i][j]);
714
715 return 0;
716}
717
718vrpn_int32 vrpn_Sound::encodeLoadMaterial(const vrpn_int32 id,
719 const vrpn_MaterialDef material,
720 char *buf)
721{
722 char *mptr = buf;
723 vrpn_int32 len = sizeof(vrpn_int32) + sizeof(vrpn_MaterialDef);
724 vrpn_int32 ret = len;
725
726 vrpn_buffer(&mptr, &len, id);
727
728 vrpn_buffer(&mptr, &len, material.material_name, MAX_MATERIAL_NAME_LENGTH);
729 vrpn_buffer(&mptr, &len, material.transmittance_gain);
730 vrpn_buffer(&mptr, &len, material.transmittance_highfreq);
731 vrpn_buffer(&mptr, &len, material.reflectance_gain);
732 vrpn_buffer(&mptr, &len, material.reflectance_highfreq);
733
734 return ret;
735}
736
737vrpn_int32 vrpn_Sound::decodeLoadMaterial(const char *buf,
738 vrpn_MaterialDef *material,
739 vrpn_int32 *id)
740{
741 const char *mptr = buf;
742
743 vrpn_unbuffer(&mptr, id);
744
746 vrpn_unbuffer(&mptr, &material->transmittance_gain);
747 vrpn_unbuffer(&mptr, &material->transmittance_highfreq);
748 vrpn_unbuffer(&mptr, &material->reflectance_gain);
749 vrpn_unbuffer(&mptr, &material->reflectance_highfreq);
750
751 return 0;
752}
753
754vrpn_int32 vrpn_Sound::encodeSetQuadVert(const vrpn_float64 vertices[4][3],
755 const vrpn_int32 tag, char *buf)
756{
757 char *mptr = buf;
758 vrpn_int32 len = sizeof(vrpn_int32) + sizeof(vrpn_float64) * 12;
759 vrpn_int32 ret = len;
760
761 vrpn_buffer(&mptr, &len, tag);
762
763 for (int i = 0; i < 4; i++)
764 for (int j(0); j < 3; j++)
765 vrpn_buffer(&mptr, &len, vertices[i][j]);
766
767 return ret;
768}
769
770vrpn_int32 vrpn_Sound::decodeSetQuadVert(const char *buf,
771 vrpn_float64 (*vertices)[4][3],
772 vrpn_int32 *tag)
773{
774 const char *mptr = buf;
775
776 vrpn_unbuffer(&mptr, tag);
777
778 for (int i = 0; i < 4; i++)
779 for (int j(0); j < 3; j++)
780 vrpn_unbuffer(&mptr, vertices[i][j]);
781
782 return 0;
783}
784
785vrpn_int32 vrpn_Sound::encodeSetTriVert(const vrpn_float64 vertices[4][3],
786 const vrpn_int32 tag, char *buf)
787{
788 char *mptr = buf;
789 vrpn_int32 len = sizeof(vrpn_int32) + sizeof(vrpn_float64) * 9;
790 vrpn_int32 ret = len;
791
792 vrpn_buffer(&mptr, &len, tag);
793
794 for (int i = 0; i < 3; i++)
795 for (int j(0); j < 3; j++)
796 vrpn_buffer(&mptr, &len, vertices[i][j]);
797
798 return ret;
799}
800
801vrpn_int32 vrpn_Sound::decodeSetTriVert(const char *buf,
802 vrpn_float64 (*vertices)[3][3],
803 vrpn_int32 *tag)
804{
805 const char *mptr = buf;
806
807 vrpn_unbuffer(&mptr, tag);
808
809 for (int i = 0; i < 3; i++)
810 for (int j(0); j < 3; j++)
811 vrpn_unbuffer(&mptr, vertices[i][j]);
812
813 return 0;
814}
815
816vrpn_int32 vrpn_Sound::encodeSetPolyOF(const vrpn_float64 openingfactor,
817 const vrpn_int32 tag, char *buf)
818{
819 char *mptr = buf;
820 vrpn_int32 len = sizeof(vrpn_SoundID) + sizeof(vrpn_float64);
821 vrpn_int32 ret = len;
822
823 vrpn_buffer(&mptr, &len, tag);
824
825 vrpn_buffer(&mptr, &len, openingfactor);
826
827 return ret;
828}
829
830vrpn_int32 vrpn_Sound::decodeSetPolyOF(const char *buf,
831 vrpn_float64 *openingfactor,
832 vrpn_int32 *tag)
833{
834 const char *mptr = buf;
835
836 vrpn_unbuffer(&mptr, tag);
837
838 vrpn_unbuffer(&mptr, openingfactor);
839
840 return 0;
841}
842
843vrpn_int32 vrpn_Sound::encodeSetPolyMaterial(const char *material,
844 const vrpn_int32 tag, char *buf)
845{
846 vrpn_int32 len = sizeof(vrpn_SoundID) + 128;
847 vrpn_int32 ret = len;
848 char *mptr = buf;
849
850 vrpn_buffer(&mptr, &len, tag);
851 vrpn_buffer(&mptr, &len, material, 128);
852
853 return ret;
854}
855
856vrpn_int32 vrpn_Sound::decodeSetPolyMaterial(const char *buf, char **material,
857 vrpn_int32 *tag, const int)
858{
859 const char *mptr = buf;
860
861 vrpn_unbuffer(&mptr, tag);
862 vrpn_unbuffer(&mptr, *material, 128);
863
864 return 0;
865}
866
867/********************************************************************************************
868 Begin vrpn_Sound_Client
869 *******************************************************************************************/
871 : vrpn_Sound(name, c)
872 , vrpn_Text_Receiver(name, c)
873{
875 handle_receiveTextMessage);
876}
877
879
880/*Sends a play sound message to the server. Sends the id of the sound to play
881 and the repeat value. If 0 then it plays it continuously*/
883 vrpn_int32 repeat)
884{
885
886 char buf[sizeof(vrpn_SoundID) + sizeof(vrpn_int32)];
887 vrpn_int32 len;
888
889 len = encodeSoundPlay(id, repeat, buf);
890
892
893 if (vrpn_Sound::d_connection->pack_message(len, timestamp, play_sound,
894 d_sender_id, buf,
896 fprintf(stderr,
897 "vrpn_Sound_Client: cannot write message play: tossing\n");
898
899 return 0;
900}
901
902/*Stops a playing sound*/
904{
905 char buf[sizeof(vrpn_SoundID)];
906 vrpn_int32 len;
907
908 len = encodeSoundID(id, buf);
909
911
912 if (vrpn_Sound::d_connection->pack_message(len, timestamp, stop_sound,
913 d_sender_id, buf,
915 fprintf(stderr,
916 "vrpn_Sound_Client: cannot write message play: tossing\n");
917
918 return 0;
919}
920
921/*Loads a sound file on the server machine for playing. Returns a vrpn_SoundID
922 to
923 be used to refer to that sound from now on*/
925 const vrpn_SoundID id,
926 const vrpn_SoundDef soundDef)
927{
928 vrpn_int32 len;
929 char *buf;
930
931 len = encodeSound_local(sound, id, soundDef, &buf);
932
934
936 d_sender_id, buf,
938 fprintf(stderr,
939 "vrpn_Sound_Client: cannot write message load: tossing\n");
940 }
941
942 try {
943 delete[] buf;
944 } catch (...) {
945 fprintf(stderr, "vrpn_Sound_Client::loadSound(): delete failed\n");
946 return -1;
947 }
948 return id;
949}
950
951/*Unloads a sound file on the server side*/
953{
954 vrpn_int32 len;
955 char buf[sizeof(vrpn_SoundID)];
956
957 len = encodeSoundID(id, buf);
958
960
961 if (vrpn_Sound::d_connection->pack_message(len, timestamp, unload_sound,
962 d_sender_id, buf,
964 fprintf(stderr,
965 "vrpn_Sound_Client: cannot write message unload: tossing\n");
966
967 return 0;
968}
969
971 const vrpn_float64 volume)
972{
973 char buf[sizeof(vrpn_SoundID) + sizeof(vrpn_float64)];
974 vrpn_int32 len;
975
976 len = encodeSoundVolume(volume, id, buf);
977
979
981 d_sender_id, buf,
983 fprintf(
984 stderr,
985 "vrpn_Sound_Client: cannot write message change status: tossing\n");
986
987 return 0;
988}
989
991 vrpn_float64 position[3],
992 vrpn_float64 orientation[4])
993{
994 char buf[sizeof(vrpn_PoseDef) + sizeof(vrpn_SoundID)];
995 vrpn_int32 len;
996 vrpn_PoseDef tempdef;
997 int i;
998 for (i = 0; i < 4; i++) {
999 tempdef.orientation[i] = orientation[i];
1000 }
1001 for (i = 0; i < 3; i++) {
1002 tempdef.position[i] = position[i];
1003 }
1004
1005 len = encodeSoundPose(tempdef, id, buf);
1006
1008
1009 if (vrpn_Sound::d_connection->pack_message(len, timestamp, set_sound_pose,
1010 d_sender_id, buf,
1012 fprintf(
1013 stderr,
1014 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1015 }
1016
1017 return 0;
1018}
1019
1021 const vrpn_float64 velocity[4])
1022{
1023 char buf[sizeof(vrpn_float64) * 4 + sizeof(vrpn_SoundID)];
1024 vrpn_int32 len;
1025
1026 len = encodeSoundVelocity(velocity, id, buf);
1027
1029
1030 if (vrpn_Sound::d_connection->pack_message(len, timestamp,
1033 fprintf(
1034 stderr,
1035 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1036
1037 return 0;
1038}
1039
1041 const vrpn_SoundID id, const vrpn_float64 max_front_dist,
1042 const vrpn_float64 min_front_dist, const vrpn_float64 max_back_dist,
1043 const vrpn_float64 min_back_dist)
1044{
1045 char buf[sizeof(vrpn_float64) * 4 + sizeof(vrpn_SoundID)];
1046 vrpn_int32 len;
1047
1048 len = encodeSoundDistInfo(max_front_dist, min_front_dist, max_back_dist,
1049 min_back_dist, id, buf);
1050
1052
1053 if (vrpn_Sound::d_connection->pack_message(
1056 fprintf(
1057 stderr,
1058 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1059
1060 return 0;
1061}
1062
1064 const vrpn_float64 inner_angle,
1065 const vrpn_float64 outer_angle,
1066 const vrpn_float64 gain)
1067{
1068
1069 char buf[sizeof(vrpn_float64) * 3 + sizeof(vrpn_SoundID)];
1070 vrpn_int32 len;
1071
1072 len = encodeSoundConeInfo(inner_angle, outer_angle, gain, id, buf);
1073
1075
1076 if (vrpn_Sound::d_connection->pack_message(len, timestamp,
1079 fprintf(
1080 stderr,
1081 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1082
1083 return 0;
1084}
1085
1087 vrpn_float64 dopfactor)
1088{
1089
1090 char buf[sizeof(vrpn_float64) + sizeof(vrpn_SoundID)];
1091 vrpn_int32 len;
1092
1093 len = encodeSoundDoplerScale(dopfactor, id, buf);
1094
1096
1097 if (vrpn_Sound::d_connection->pack_message(
1100 fprintf(
1101 stderr,
1102 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1103
1104 return 0;
1105}
1106
1108 vrpn_float64 eq_value)
1109{
1110 char buf[sizeof(vrpn_float64) + sizeof(vrpn_SoundID)];
1111 vrpn_int32 len;
1112
1113 len = encodeSoundEqFactor(eq_value, id, buf);
1114
1116
1117 if (vrpn_Sound::d_connection->pack_message(len, timestamp,
1120 fprintf(
1121 stderr,
1122 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1123
1124 return 0;
1125}
1126
1128 vrpn_float64 pitch)
1129{
1130 char buf[sizeof(vrpn_float64) + sizeof(vrpn_SoundID)];
1131 vrpn_int32 len;
1132
1133 len = encodeSoundPitch(pitch, id, buf);
1134
1136
1137 if (vrpn_Sound::d_connection->pack_message(len, timestamp, set_sound_pitch,
1138 d_sender_id, buf,
1140 fprintf(
1141 stderr,
1142 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1143
1144 return 0;
1145}
1146
1147vrpn_int32 vrpn_Sound_Client::setListenerPose(const vrpn_float64 position[3],
1148 const vrpn_float64 orientation[4])
1149{
1150 char buf[sizeof(vrpn_PoseDef)];
1151 vrpn_int32 len;
1152 vrpn_PoseDef tempdef;
1153 int i;
1154
1155 for (i = 0; i < 4; i++) {
1156 tempdef.orientation[i] = orientation[i];
1157 }
1158 for (i = 0; i < 3; i++) {
1159 tempdef.position[i] = position[i];
1160 }
1161
1162 len = encodeListenerPose(tempdef, buf);
1163
1165
1166 if (vrpn_Sound::d_connection->pack_message(len, timestamp,
1169 fprintf(
1170 stderr,
1171 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1172
1173 return 0;
1174}
1175
1176vrpn_int32
1177vrpn_Sound_Client::setListenerVelocity(const vrpn_float64 velocity[4])
1178{
1179 char buf[sizeof(vrpn_float64) * 4];
1180 vrpn_int32 len;
1181
1182 len = encodeListenerVelocity(velocity, buf);
1183
1185
1186 if (vrpn_Sound::d_connection->pack_message(
1189 fprintf(
1190 stderr,
1191 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1192 }
1193
1194 return 0;
1195}
1196
1197vrpn_int32 vrpn_Sound_Client::LoadModel_local(const char *filename)
1198{
1199 vrpn_int32 len;
1200 char *buf;
1201
1202 len = encodeLoadModel_local(filename, &buf);
1203
1205
1206 if (vrpn_Sound::d_connection->pack_message(len, timestamp, load_model_local,
1207 d_sender_id, buf,
1209 fprintf(stderr,
1210 "vrpn_Sound_Client: cannot write message load: tossing\n");
1211
1212 return 1;
1213}
1214
1216vrpn_int32 vrpn_Sound_Client::LoadModel_remote(const char * /*data*/)
1217{
1218 return 0;
1219}
1220
1222{
1223 vrpn_int32 len;
1224 char buf[sizeof(vrpn_QuadDef)];
1225
1226 len = encodeLoadPolyQuad(quad, buf);
1227
1229
1230 if (vrpn_Sound::d_connection->pack_message(len, timestamp, load_polyquad,
1231 d_sender_id, buf,
1233 fprintf(stderr,
1234 "vrpn_Sound_Client: cannot write message load: tossing\n");
1235
1236 return quad.tag;
1237}
1238
1240{
1241 vrpn_int32 len;
1242 char buf[sizeof(vrpn_TriDef)];
1243
1244 len = encodeLoadPolyTri(tri, buf);
1245
1247
1248 if (vrpn_Sound::d_connection->pack_message(len, timestamp, load_polytri,
1249 d_sender_id, buf,
1251 fprintf(stderr,
1252 "vrpn_Sound_Client: cannot write message load: tossing\n");
1253
1254 return tri.tag;
1255}
1256
1257vrpn_int32 vrpn_Sound_Client::LoadMaterial(const vrpn_int32 id,
1258 const vrpn_MaterialDef material)
1259{
1260 vrpn_int32 len;
1261 char buf[sizeof(vrpn_MaterialDef) + sizeof(vrpn_int32)];
1262
1263 len = encodeLoadMaterial(id, material, buf);
1264
1266
1267 if (vrpn_Sound::d_connection->pack_message(len, timestamp, load_material,
1268 d_sender_id, buf,
1270 fprintf(stderr,
1271 "vrpn_Sound_Client: cannot write message load: tossing\n");
1272
1273 return id;
1274}
1275
1276vrpn_int32 vrpn_Sound_Client::setPolyOF(const int id, const vrpn_float64 OF)
1277{
1278 char buf[sizeof(vrpn_int32) + sizeof(vrpn_float64)];
1279 vrpn_int32 len;
1280
1281 len = encodeSetPolyOF(OF, id, buf);
1282
1284
1285 if (vrpn_Sound::d_connection->pack_message(
1288 fprintf(
1289 stderr,
1290 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1291
1292 return 0;
1293}
1294
1296 const vrpn_float64 vertices[4][3])
1297{
1298 char buf[sizeof(vrpn_int32) + sizeof(vrpn_float64) * 12];
1299 vrpn_int32 len;
1300
1301 len = encodeSetQuadVert(vertices, id, buf);
1302
1304
1305 if (vrpn_Sound::d_connection->pack_message(
1308 fprintf(
1309 stderr,
1310 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1311
1312 return 0;
1313}
1314
1316 const char *material_name)
1317{
1318 char buf[sizeof(vrpn_int32) + sizeof(material_name)];
1319 vrpn_int32 len;
1320
1321 len = encodeSetPolyMaterial(material_name, id, buf);
1322
1324
1325 if (vrpn_Sound::d_connection->pack_message(len, timestamp,
1328 fprintf(
1329 stderr,
1330 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1331
1332 return 0;
1333}
1335 const vrpn_float64 vertices[3][3])
1336{
1337 char buf[sizeof(vrpn_int32) + sizeof(vrpn_float64) * 9];
1338 vrpn_int32 len;
1339
1340 len = encodeSetTriVert(vertices, id, buf);
1341
1343
1344 if (vrpn_Sound::d_connection->pack_message(
1347 fprintf(
1348 stderr,
1349 "vrpn_Sound_Client: cannot write message change status: tossing\n");
1350
1351 return 0;
1352}
1353
1355{
1358}
1359
1360void vrpn_Sound_Client::handle_receiveTextMessage(void *userdata,
1361 const vrpn_TEXTCB t)
1362{
1365}
1366
1367void vrpn_Sound_Client::receiveTextMessage(const char *message, vrpn_uint32,
1368 vrpn_uint32, struct timeval)
1369{
1370 printf("Virtual: %s\n", message);
1371 return;
1372}
1373
1374/********************************************************************************************
1375 Begin vrpn_Sound_Server
1376 *******************************************************************************************/
1377#ifndef VRPN_CLIENT_ONLY
1379 : vrpn_Sound(name, c)
1380 , vrpn_Text_Sender(name, c)
1381{
1382 /*Register the handlers*/
1383 register_autodeleted_handler(load_sound_local, handle_loadSoundLocal, this,
1384 d_sender_id);
1385 register_autodeleted_handler(load_sound_remote, handle_loadSoundRemote,
1386 this, d_sender_id);
1387 register_autodeleted_handler(unload_sound, handle_unloadSound, this,
1388 d_sender_id);
1389 register_autodeleted_handler(play_sound, handle_playSound, this,
1390 d_sender_id);
1391 register_autodeleted_handler(stop_sound, handle_stopSound, this,
1392 d_sender_id);
1393 register_autodeleted_handler(change_sound_status, handle_changeSoundStatus,
1394 this, d_sender_id);
1395
1396 register_autodeleted_handler(set_listener_pose, handle_setListenerPose,
1397 this, d_sender_id);
1399 handle_setListenerVelocity, this, d_sender_id);
1400
1401 register_autodeleted_handler(set_sound_pose, handle_setSoundPose, this,
1402 d_sender_id);
1403 register_autodeleted_handler(set_sound_velocity, handle_setSoundVelocity,
1404 this, d_sender_id);
1406 set_sound_distanceinfo, handle_setSoundDistanceinfo, this, d_sender_id);
1407 register_autodeleted_handler(set_sound_coneinfo, handle_setSoundConeinfo,
1408 this, d_sender_id);
1409
1411 set_sound_doplerfactor, handle_setSoundDoplerfactor, this, d_sender_id);
1412 register_autodeleted_handler(set_sound_eqvalue, handle_setSoundEqvalue,
1413 this, d_sender_id);
1414 register_autodeleted_handler(set_sound_pitch, handle_setSoundPitch, this,
1415 d_sender_id);
1416 register_autodeleted_handler(set_sound_volume, handle_setSoundVolume, this,
1417 d_sender_id);
1418
1419 register_autodeleted_handler(load_model_local, handle_loadModelLocal, this,
1420 d_sender_id);
1421 register_autodeleted_handler(load_model_remote, handle_loadModelRemote,
1422 this, d_sender_id);
1423 register_autodeleted_handler(load_polyquad, handle_loadPolyquad, this,
1424 d_sender_id);
1425 register_autodeleted_handler(load_polytri, handle_loadPolytri, this,
1426 d_sender_id);
1427 register_autodeleted_handler(load_material, handle_loadMaterial, this,
1428 d_sender_id);
1430 handle_setPolyquadVertices, this, d_sender_id);
1432 handle_setPolytriVertices, this, d_sender_id);
1434 set_poly_openingfactor, handle_setPolyOpeningfactor, this, d_sender_id);
1435 register_autodeleted_handler(set_poly_material, handle_setPolyMaterial,
1436 this, d_sender_id);
1437}
1438
1440
1441/******************************************************************************
1442 Callback Handler routines.
1443 ******************************************************************************/
1444
1445int vrpn_Sound_Server::handle_loadSoundLocal(void *userdata,
1447{
1448
1450 vrpn_SoundID id;
1451 vrpn_SoundDef soundDef;
1452 char *filename;
1453
1454 me->decodeSound_local(p.buffer, &filename, &id, &soundDef,
1455 p.payload_len);
1456 me->loadSoundLocal(filename, id, soundDef);
1457 try {
1458 delete[] filename;
1459 } catch (...) {
1460 fprintf(stderr, "vrpn_Sound_Server::handle_loadSoundLocal(): delete failed\n");
1461 return -1;
1462 }
1463 return 0;
1464}
1465
1466/* not supported */
1467int vrpn_Sound_Server::handle_loadSoundRemote(void *,
1469{
1470 return 0;
1471}
1472int vrpn_Sound_Server::handle_playSound(void *userdata, vrpn_HANDLERPARAM p)
1473{
1474
1476 vrpn_SoundID id;
1477 vrpn_SoundDef soundDef;
1478 vrpn_int32 repeat;
1479
1480 me->decodeSoundDef(p.buffer, &soundDef, &id, &repeat);
1481 me->playSound(id, repeat, soundDef);
1482 return 0;
1483}
1484
1485int vrpn_Sound_Server::handle_stopSound(void *userdata, vrpn_HANDLERPARAM p)
1486{
1488 vrpn_SoundID id;
1489
1490 me->decodeSoundID(p.buffer, &id);
1491 me->stopSound(id);
1492 return 0;
1493}
1494
1495int vrpn_Sound_Server::handle_unloadSound(void *userdata, vrpn_HANDLERPARAM p)
1496{
1498 vrpn_SoundID id;
1499
1500 me->decodeSoundID(p.buffer, &id);
1501 me->unloadSound(id);
1502 return 0;
1503}
1504
1505int vrpn_Sound_Server::handle_changeSoundStatus(void *userdata,
1507{
1509 vrpn_SoundID id;
1510 vrpn_SoundDef soundDef;
1511 vrpn_int32 repeat;
1512
1513 me->decodeSoundDef(p.buffer, &soundDef, &id, &repeat);
1514 me->changeSoundStatus(id, soundDef);
1515 return 0;
1516}
1517
1518int vrpn_Sound_Server::handle_setListenerPose(void *userdata,
1520{
1522 vrpn_PoseDef pose;
1523
1524 me->decodeListenerPose(p.buffer, &pose);
1525 me->setListenerPose(pose);
1526 return 0;
1527}
1528
1529int vrpn_Sound_Server::handle_setListenerVelocity(void *userdata,
1531{
1533 vrpn_float64 velocity[4];
1534
1535 me->decodeListenerVelocity(p.buffer, velocity);
1536 me->setListenerVelocity(velocity);
1537 return 0;
1538}
1539
1540int vrpn_Sound_Server::handle_setSoundPose(void *userdata, vrpn_HANDLERPARAM p)
1541{
1543 vrpn_PoseDef pose;
1544 vrpn_int32 id;
1545
1546 me->decodeSoundPose(p.buffer, &pose, &id);
1547 me->setSoundPose(id, pose);
1548 return 0;
1549}
1550
1551int vrpn_Sound_Server::handle_setSoundVelocity(void *userdata,
1553{
1555 vrpn_float64 velocity[4];
1556 vrpn_int32 id;
1557
1558 me->decodeSoundVelocity(p.buffer, velocity, &id);
1559 me->setSoundVelocity(id, velocity);
1560 return 0;
1561}
1562
1563int vrpn_Sound_Server::handle_setSoundDistanceinfo(void *userdata,
1565{
1567 vrpn_float64 dist[4];
1568 vrpn_int32 id;
1569 /* order is min_back, max_back, min_front, max_front */
1570 me->decodeSoundDistInfo(p.buffer, &dist[0], &dist[1], &dist[2],
1571 &dist[3], &id);
1572 me->setSoundDistInfo(id, dist);
1573 return 0;
1574}
1575
1576int vrpn_Sound_Server::handle_setSoundConeinfo(void *userdata,
1578{
1580 vrpn_float64 cinfo[3];
1581 vrpn_int32 id;
1582
1583 me->decodeSoundConeInfo(p.buffer, &cinfo[0], &cinfo[1], &cinfo[2],
1584 &id);
1585 me->setSoundConeInfo(id, cinfo);
1586 return 0;
1587}
1588
1589int vrpn_Sound_Server::handle_setSoundDoplerfactor(void *userdata,
1591{
1593 vrpn_float64 df;
1594 vrpn_int32 id;
1595
1596 me->decodeSoundDoplerScale(p.buffer, &df, &id);
1597 me->setSoundDoplerFactor(id, df);
1598 return 0;
1599}
1600
1601int vrpn_Sound_Server::handle_setSoundEqvalue(void *userdata,
1603{
1605 vrpn_float64 val;
1606 vrpn_int32 id;
1607
1608 me->decodeSoundEqFactor(p.buffer, &val, &id);
1609 me->setSoundEqValue(id, val);
1610 return 0;
1611}
1612
1613int vrpn_Sound_Server::handle_setSoundPitch(void *userdata, vrpn_HANDLERPARAM p)
1614{
1616 vrpn_float64 pitch;
1617 vrpn_int32 id;
1618
1619 me->decodeSoundPitch(p.buffer, &pitch, &id);
1620 me->setSoundPitch(id, pitch);
1621 return 0;
1622}
1623
1624int vrpn_Sound_Server::handle_setSoundVolume(void *userdata,
1626{
1628 vrpn_float64 vol;
1629 vrpn_int32 id;
1630
1631 me->decodeSoundVolume(p.buffer, &vol, &id);
1632 me->setSoundVolume(id, vol);
1633 return 0;
1634}
1635
1636int vrpn_Sound_Server::handle_loadModelLocal(void *userdata,
1638{
1640 char *filename;
1641
1642 me->decodeLoadModel_local(p.buffer, &filename, p.payload_len);
1643 me->loadModelLocal(filename);
1644 try {
1645 delete[] filename;
1646 } catch (...) {
1647 fprintf(stderr, "vrpn_Sound_Server::handle_loadModelLocal(): delete failed\n");
1648 return -1;
1649 }
1650 return 0;
1651}
1652
1653/* not handled yet */
1654int vrpn_Sound_Server::handle_loadModelRemote(void *,
1656{
1657 return 0;
1658}
1659
1660int vrpn_Sound_Server::handle_loadPolyquad(void *userdata, vrpn_HANDLERPARAM p)
1661{
1663 vrpn_QuadDef quad;
1664
1665 me->decodeLoadPolyQuad(p.buffer, &quad);
1666 me->loadPolyQuad(&quad);
1667 return 0;
1668}
1669
1670int vrpn_Sound_Server::handle_loadPolytri(void *userdata, vrpn_HANDLERPARAM p)
1671{
1673 vrpn_TriDef tri;
1674
1675 me->decodeLoadPolyTri(p.buffer, &tri);
1676 me->loadPolyTri(&tri);
1677 return 0;
1678}
1679
1680int vrpn_Sound_Server::handle_loadMaterial(void *userdata, vrpn_HANDLERPARAM p)
1681{
1683 vrpn_MaterialDef material;
1684 vrpn_int32 id;
1685
1686 me->decodeLoadMaterial(p.buffer, &material, &id);
1687
1688 me->loadMaterial(&material, id);
1689 return 0;
1690}
1691
1692int vrpn_Sound_Server::handle_setPolyquadVertices(void *userdata,
1694{
1696 vrpn_float64(*vertices)[4][3] = NULL;
1697 vrpn_int32 id;
1698
1699 me->decodeSetQuadVert(p.buffer, vertices, &id);
1700 me->setPolyQuadVertices(*vertices, id);
1701 return 0;
1702}
1703
1704int vrpn_Sound_Server::handle_setPolytriVertices(void *userdata,
1706{
1708 vrpn_float64(*vertices)[3][3] = NULL;
1709 vrpn_int32 id;
1710
1711 me->decodeSetTriVert(p.buffer, vertices, &id);
1712 me->setPolyTriVertices(*vertices, id);
1713 return 0;
1714}
1715
1716int vrpn_Sound_Server::handle_setPolyOpeningfactor(void *userdata,
1718{
1720 vrpn_float64 of;
1721 vrpn_int32 id;
1722
1723 me->decodeSetPolyOF(p.buffer, &of, &id);
1724 me->setPolyOF(of, id);
1725 return 0;
1726}
1727
1728int vrpn_Sound_Server::handle_setPolyMaterial(void *userdata,
1730{
1732 char **material = NULL;
1733 vrpn_int32 id;
1734
1735 me->decodeSetPolyMaterial(p.buffer, material, &id, p.payload_len);
1736 me->setPolyMaterial(*material, id);
1737 return 0;
1738}
1739
1740#endif /*#ifndef VRPN_CLIENT_ONLY */
int register_autodeleted_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
Registers a handler with the connection, and remembers to delete at destruction.
vrpn_Connection * d_connection
Connection that this object talks to.
void client_mainloop(void)
Handles functions that all clients should provide in their mainloop() (warning of no server,...
vrpn_int32 d_sender_id
Sender ID registered with the connection.
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
virtual int init(void)
Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
Generic connection class not specific to the transport mechanism.
virtual vrpn_int32 register_message_type(const char *name)
virtual int mainloop(const struct timeval *timeout=NULL)=0
Call each time through program main loop to handle receiving any incoming messages and sending any pa...
vrpn_int32 setSoundDopScale(const vrpn_SoundID id, vrpn_float64 dopfactor)
vrpn_int32 LoadModel_local(const char *filename)
vrpn_int32 setSoundPitch(const vrpn_SoundID id, vrpn_float64 pitch)
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_int32 LoadPolyTri(const vrpn_TriDef tri)
vrpn_int32 playSound(const vrpn_SoundID id, vrpn_int32 repeat)
Definition vrpn_Sound.C:882
vrpn_int32 setSoundVelocity(const vrpn_SoundID id, const vrpn_float64 velocity[4])
vrpn_int32 setPolyOF(const int id, const vrpn_float64 OF)
vrpn_int32 setSoundPose(const vrpn_SoundID id, vrpn_float64 position[3], vrpn_float64 orientation[4])
Definition vrpn_Sound.C:990
vrpn_int32 setSoundEqValue(const vrpn_SoundID id, vrpn_float64 eq_value)
vrpn_int32 setTriVertices(const int id, const vrpn_float64 vertices[3][3])
vrpn_int32 setSoundConeInfo(const vrpn_SoundID id, const vrpn_float64 inner_angle, const vrpn_float64 outer_angle, const vrpn_float64 gain)
vrpn_int32 setSoundVolume(const vrpn_SoundID id, const vrpn_float64 volume)
Definition vrpn_Sound.C:970
vrpn_int32 setQuadVertices(const int id, const vrpn_float64 vertices[4][3])
vrpn_int32 LoadPolyQuad(const vrpn_QuadDef quad)
vrpn_int32 setPolyMaterialName(const int id, const char *materialname)
vrpn_int32 setListenerVelocity(const vrpn_float64 velocity[4])
vrpn_int32 setListenerPose(const vrpn_float64 position[3], const vrpn_float64 orientation[4])
vrpn_int32 stopSound(const vrpn_SoundID id)
Definition vrpn_Sound.C:903
virtual void receiveTextMessage(const char *message, vrpn_uint32 type, vrpn_uint32 level, struct timeval msg_time)
vrpn_Sound_Client(const char *name, vrpn_Connection *c)
Definition vrpn_Sound.C:870
vrpn_int32 setSoundDistances(const vrpn_SoundID id, const vrpn_float64 max_front_dist, const vrpn_float64 min_front_dist, const vrpn_float64 max_back_dist, const vrpn_float64 min_back_dist)
vrpn_int32 LoadModel_remote(const char *data)
vrpn_int32 unloadSound(const vrpn_SoundID id)
Definition vrpn_Sound.C:952
vrpn_SoundID loadSound(const char *sound, const vrpn_SoundID id, const vrpn_SoundDef soundDef)
Definition vrpn_Sound.C:924
vrpn_int32 LoadMaterial(const vrpn_int32 id, const vrpn_MaterialDef material)
vrpn_Sound_Server(const char *name, vrpn_Connection *c)
virtual void setSoundPitch(vrpn_SoundID id, vrpn_float64 pitch)=0
virtual void loadPolyTri(vrpn_TriDef *tri)=0
virtual void loadModelLocal(const char *filename)=0
virtual void setSoundDoplerFactor(vrpn_SoundID id, vrpn_float64 doplerfactor)=0
virtual void setPolyQuadVertices(vrpn_float64 vertices[4][3], const vrpn_int32 id)=0
virtual void setSoundEqValue(vrpn_SoundID id, vrpn_float64 eqvalue)=0
virtual void setSoundVolume(vrpn_SoundID id, vrpn_float64 volume)=0
virtual void setPolyOF(vrpn_float64 OF, vrpn_int32 tag)=0
virtual void playSound(vrpn_SoundID id, vrpn_int32 repeat, vrpn_SoundDef soundDef)=0
virtual void setListenerVelocity(vrpn_float64 *velocity)=0
virtual void setSoundVelocity(vrpn_SoundID id, vrpn_float64 *velocity)=0
virtual void setListenerPose(vrpn_PoseDef pose)=0
virtual void setSoundConeInfo(vrpn_SoundID id, vrpn_float64 *coneinfo)=0
virtual void loadMaterial(vrpn_MaterialDef *material, vrpn_int32 id)=0
virtual void setSoundPose(vrpn_SoundID id, vrpn_PoseDef pose)=0
virtual void setSoundDistInfo(vrpn_SoundID id, vrpn_float64 *distinfo)=0
virtual void unloadSound(vrpn_SoundID id)=0
virtual void changeSoundStatus(vrpn_SoundID id, vrpn_SoundDef soundDef)=0
virtual void loadPolyQuad(vrpn_QuadDef *quad)=0
virtual void setPolyTriVertices(vrpn_float64 vertices[3][3], const vrpn_int32 id)=0
virtual void setPolyMaterial(const char *material, vrpn_int32 tag)=0
virtual void stopSound(vrpn_SoundID id)=0
virtual void loadSoundLocal(char *filename, vrpn_SoundID id, vrpn_SoundDef soundDef)=0
vrpn_int32 encodeSoundID(const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:182
vrpn_int32 load_model_local
Definition vrpn_Sound.h:126
vrpn_int32 decodeSetQuadVert(const char *buf, vrpn_float64(*vertices)[4][3], vrpn_int32 *tag)
Definition vrpn_Sound.C:770
vrpn_int32 set_polyquad_vertices
Definition vrpn_Sound.h:131
vrpn_int32 encodeSound_local(const char *filename, const vrpn_SoundID id, const vrpn_SoundDef soundDef, char **buf)
Definition vrpn_Sound.C:69
vrpn_int32 decodeSoundEqFactor(const char *buf, vrpn_float64 *eqfactor, vrpn_SoundID *id)
Definition vrpn_Sound.C:533
vrpn_int32 set_sound_coneinfo
Definition vrpn_Sound.h:120
vrpn_int32 decodeListenerPose(const char *buf, vrpn_PoseDef *pose)
Definition vrpn_Sound.C:295
vrpn_int32 set_listener_pose
Definition vrpn_Sound.h:114
vrpn_int32 decodeSoundPose(const char *buf, vrpn_PoseDef *pose, vrpn_SoundID *id)
Definition vrpn_Sound.C:375
vrpn_int32 encodeSound_remote(const char *filename, const vrpn_SoundID id, char **buf)
Definition vrpn_Sound.C:166
vrpn_int32 encodeLoadModel_local(const char *filename, char **buf)
Definition vrpn_Sound.C:597
vrpn_Sound(const char *name, vrpn_Connection *c)
Definition vrpn_Sound.C:8
vrpn_int32 encodeLoadPolyQuad(const vrpn_QuadDef quad, char *buf)
Definition vrpn_Sound.C:649
vrpn_int32 set_sound_pitch
Definition vrpn_Sound.h:123
vrpn_int32 decodeSoundPlay(const char *buf, vrpn_SoundID *id, vrpn_int32 *repeat)
Definition vrpn_Sound.C:321
vrpn_int32 decodeSetPolyOF(const char *buf, vrpn_float64 *openingfactor, vrpn_int32 *tag)
Definition vrpn_Sound.C:830
vrpn_int32 encodeSoundDef(const vrpn_SoundDef sound, const vrpn_SoundID id, const vrpn_int32 repeat, char *buf)
Definition vrpn_Sound.C:204
vrpn_int32 decodeSoundDef(const char *buf, vrpn_SoundDef *sound, vrpn_SoundID *id, vrpn_int32 *repeat)
Definition vrpn_Sound.C:243
vrpn_int32 decodeSoundPitch(const char *buf, vrpn_float64 *pitch, vrpn_SoundID *id)
Definition vrpn_Sound.C:560
vrpn_int32 set_sound_distanceinfo
Definition vrpn_Sound.h:119
vrpn_int32 load_sound_remote
Definition vrpn_Sound.h:107
vrpn_int32 encodeLoadModel_remote(const char *filename, char **buf)
Definition vrpn_Sound.C:636
vrpn_int32 encodeSoundConeInfo(const vrpn_float64 cone_inner_angle, const vrpn_float64 cone_outer_angle, const vrpn_float64 cone_gain, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:458
vrpn_int32 unload_sound
Definition vrpn_Sound.h:108
vrpn_int32 decodeSoundVelocity(const char *buf, vrpn_float64 *velocity, vrpn_SoundID *id)
Definition vrpn_Sound.C:408
vrpn_int32 decodeSoundDistInfo(const char *buf, vrpn_float64 *min_back, vrpn_float64 *max_back, vrpn_float64 *min_front, vrpn_float64 *max_front, vrpn_SoundID *id)
Definition vrpn_Sound.C:443
vrpn_int32 set_sound_velocity
Definition vrpn_Sound.h:118
vrpn_int32 decodeLoadPolyTri(const char *buf, vrpn_TriDef *tri)
Definition vrpn_Sound.C:702
vrpn_int32 encodeSoundPlay(const vrpn_SoundID id, const vrpn_int32 repeat, char *buf)
Definition vrpn_Sound.C:309
struct timeval timestamp
Definition vrpn_Sound.h:138
vrpn_int32 encodeSoundDistInfo(const vrpn_float64 min_back, const vrpn_float64 max_back, const vrpn_float64 min_front, const vrpn_float64 max_front, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:423
vrpn_int32 play_sound
Definition vrpn_Sound.h:109
vrpn_int32 decodeSetPolyMaterial(const char *buf, char **material, vrpn_int32 *tag, const int payload)
Definition vrpn_Sound.C:856
vrpn_int32 load_material
Definition vrpn_Sound.h:130
vrpn_int32 decodeSetTriVert(const char *buf, vrpn_float64(*vertices)[3][3], vrpn_int32 *tag)
Definition vrpn_Sound.C:801
vrpn_int32 set_listener_velocity
Definition vrpn_Sound.h:116
vrpn_int32 decodeLoadModel_remote(const char *buf, char **filename, const int payload)
Definition vrpn_Sound.C:642
vrpn_int32 decodeLoadMaterial(const char *buf, vrpn_MaterialDef *material, vrpn_int32 *id)
Definition vrpn_Sound.C:737
vrpn_int32 encodeListenerVelocity(const vrpn_float64 *velocity, char *buf)
Definition vrpn_Sound.C:331
vrpn_int32 load_model_remote
Definition vrpn_Sound.h:127
vrpn_int32 set_sound_doplerfactor
Definition vrpn_Sound.h:121
vrpn_int32 encodeLoadMaterial(const vrpn_int32 id, const vrpn_MaterialDef material, char *buf)
Definition vrpn_Sound.C:718
vrpn_int32 encodeListenerPose(const vrpn_PoseDef pose, char *buf)
Definition vrpn_Sound.C:279
vrpn_int32 decodeSoundVolume(const char *buf, vrpn_float64 *volume, vrpn_SoundID *id)
Definition vrpn_Sound.C:586
vrpn_int32 decodeSound_remote(const char *buf, char **filename, vrpn_SoundID *id, const int payload)
Definition vrpn_Sound.C:173
vrpn_int32 decodeSoundConeInfo(const char *buf, vrpn_float64 *cone_inner_angle, vrpn_float64 *cone_outer_angle, vrpn_float64 *cone_gain, vrpn_SoundID *id)
Definition vrpn_Sound.C:476
vrpn_int32 load_polytri
Definition vrpn_Sound.h:129
vrpn_int32 encodeSoundEqFactor(const vrpn_float64 eqfactor, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:519
vrpn_int32 encodeSoundVolume(const vrpn_float64 volume, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:572
vrpn_int32 set_sound_volume
Definition vrpn_Sound.h:124
int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
Definition vrpn_Sound.C:14
vrpn_int32 set_sound_pose
Definition vrpn_Sound.h:117
vrpn_int32 encodeSetQuadVert(const vrpn_float64 vertices[4][3], const vrpn_int32 tag, char *buf)
Definition vrpn_Sound.C:754
vrpn_int32 load_sound_local
Definition vrpn_Sound.h:105
vrpn_int32 change_sound_status
Definition vrpn_Sound.h:112
vrpn_int32 encodeSetTriVert(const vrpn_float64 vertices[3][3], const vrpn_int32 tag, char *buf)
Definition vrpn_Sound.C:785
vrpn_int32 encodeLoadPolyTri(const vrpn_TriDef tri, char *buf)
Definition vrpn_Sound.C:684
vrpn_int32 set_sound_eqvalue
Definition vrpn_Sound.h:122
vrpn_int32 set_poly_material
Definition vrpn_Sound.h:134
vrpn_int32 stop_sound
Definition vrpn_Sound.h:110
vrpn_int32 encodeSoundDoplerScale(const vrpn_float64 doplerfactor, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:493
vrpn_int32 decodeLoadPolyQuad(const char *buf, vrpn_QuadDef *quad)
Definition vrpn_Sound.C:668
vrpn_int32 encodeSoundPose(const vrpn_PoseDef pose, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:356
vrpn_int32 decodeSound_local(const char *buf, char **filename, vrpn_SoundID *id, vrpn_SoundDef *soundDef, const int payload)
Definition vrpn_Sound.C:119
vrpn_int32 decodeSoundID(const char *buf, vrpn_SoundID *id)
Definition vrpn_Sound.C:193
vrpn_int32 load_polyquad
Definition vrpn_Sound.h:128
vrpn_int32 encodeSetPolyOF(const vrpn_float64 openingfactor, const vrpn_int32 tag, char *buf)
Definition vrpn_Sound.C:816
vrpn_int32 set_poly_openingfactor
Definition vrpn_Sound.h:133
vrpn_int32 encodeSoundPitch(const vrpn_float64 pitch, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:546
vrpn_int32 encodeSoundVelocity(const vrpn_float64 *velocity, const vrpn_SoundID id, char *buf)
Definition vrpn_Sound.C:392
vrpn_int32 set_polytri_vertices
Definition vrpn_Sound.h:132
vrpn_int32 decodeLoadModel_local(const char *buf, char **filename, const int payload)
Definition vrpn_Sound.C:618
vrpn_int32 decodeSoundDoplerScale(const char *buf, vrpn_float64 *doplerfactor, vrpn_SoundID *id)
Definition vrpn_Sound.C:507
vrpn_int32 encodeSetPolyMaterial(const char *material, const vrpn_int32 tag, char *buf)
Definition vrpn_Sound.C:843
vrpn_int32 decodeListenerVelocity(const char *buf, vrpn_float64 *velocity)
Definition vrpn_Sound.C:345
Allows a user to handle text messages directly, in addition to having the.
Definition vrpn_Text.h:69
virtual int register_message_handler(void *userdata, vrpn_TEXTHANDLER handler)
Definition vrpn_Text.h:73
Allows a user to send text messages from a device (usually,.
Definition vrpn_Text.h:40
This structure is what is passed to a vrpn_Connection message callback.
const char * buffer
vrpn_float64 reflectance_highfreq
Definition vrpn_Sound.h:78
vrpn_float64 reflectance_gain
Definition vrpn_Sound.h:77
char material_name[MAX_MATERIAL_NAME_LENGTH]
Definition vrpn_Sound.h:74
vrpn_float64 transmittance_gain
Definition vrpn_Sound.h:75
vrpn_float64 transmittance_highfreq
Definition vrpn_Sound.h:76
vrpn_float64 orientation[4]
Definition vrpn_Sound.h:29
vrpn_float64 position[3]
Definition vrpn_Sound.h:28
vrpn_int32 subQuad
Definition vrpn_Sound.h:82
vrpn_float64 vertices[4][3]
Definition vrpn_Sound.h:85
char material_name[MAX_MATERIAL_NAME_LENGTH]
Definition vrpn_Sound.h:86
vrpn_int32 tag
Definition vrpn_Sound.h:84
vrpn_float64 openingFactor
Definition vrpn_Sound.h:83
vrpn_PoseDef pose
Definition vrpn_Sound.h:39
vrpn_float64 min_front_dist
Definition vrpn_Sound.h:42
vrpn_float64 velocity[4]
Definition vrpn_Sound.h:40
vrpn_float64 equalization_val
Definition vrpn_Sound.h:49
vrpn_float64 cone_outer_angle
Definition vrpn_Sound.h:46
vrpn_float64 max_front_dist
Definition vrpn_Sound.h:41
vrpn_float64 cone_inner_angle
Definition vrpn_Sound.h:45
vrpn_float64 max_back_dist
Definition vrpn_Sound.h:43
vrpn_float64 pitch
Definition vrpn_Sound.h:50
vrpn_float64 dopler_scale
Definition vrpn_Sound.h:48
vrpn_float64 min_back_dist
Definition vrpn_Sound.h:44
vrpn_float32 volume
Definition vrpn_Sound.h:51
vrpn_float64 cone_gain
Definition vrpn_Sound.h:47
Structure passed back to user-level code from a vrpn_Text_Receiver.
Definition vrpn_Text.h:22
char message[vrpn_MAX_TEXT_LEN]
Definition vrpn_Text.h:24
vrpn_TEXT_SEVERITY type
Definition vrpn_Text.h:25
vrpn_uint32 level
Definition vrpn_Text.h:26
struct timeval msg_time
Definition vrpn_Text.h:23
vrpn_int32 tag
Definition vrpn_Sound.h:92
char material_name[MAX_MATERIAL_NAME_LENGTH]
Definition vrpn_Sound.h:94
vrpn_float64 vertices[3][3]
Definition vrpn_Sound.h:93
vrpn_float64 openingFactor
Definition vrpn_Sound.h:91
vrpn_int32 subTri
Definition vrpn_Sound.h:90
const vrpn_uint32 vrpn_CONNECTION_RELIABLE
Classes of service for messages, specify multiple by ORing them together Priority of satisfying these...
VRPN_API int vrpn_unbuffer(const char **buffer, timeval *t)
Utility routine for taking a struct timeval from a buffer that was sent as a message.
VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen, const timeval t)
Utility routine for placing a timeval struct into a buffer that is to be sent as a message.
#define vrpn_gettimeofday
Definition vrpn_Shared.h:99
#define MAX_MATERIAL_NAME_LENGTH
Definition vrpn_Sound.h:17
vrpn_int32 vrpn_SoundID
Definition vrpn_Sound.h:25