1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751
|
#include "gvPS2Headset.h"
#if !defined(GV_NO_PS2_HEADSET)
#include "gvDevice.h"
#include "gvCodec.h"
#include "gvSource.h"
#include "gvUtil.h"
#include <liblgaud.h>
#if !defined(_PS2)
#error This file should only be used with the PlayStation2
#endif
/************
** DEFINES **
************/
#define GVI_PLAYBACK_STAYAHEAD_MILLISECONDS 50
/**********
** TYPES **
**********/
typedef struct
{
int m_handle;
GVBool m_playing;
GVScalar m_playbackVolume;
GVFrameStamp m_playbackClock;
GVISourceList m_playbackSources;
GVSample * m_playbackBuffer;
GVBool m_capturing;
GVScalar m_captureVolume;
GVFrameStamp m_captureClock;
GVScalar m_captureThreshold;
GVFrameStamp m_captureLastCrossedThresholdTime;
GVSample * m_captureBuffer;
int m_captureBufferBytes;
} GVIPS2HeadsetData;
/************
** GLOBALS **
************/
static GVIDeviceList GVIDevices;
/**************
** FUNCTIONS **
**************/
static GVIDevice * gviFindDeviceByID(GVDeviceID deviceID)
{
GVIDevice * device;
int num;
int i;
num = gviGetNumDevices(GVIDevices);
for(i = 0 ; i < num ; i++)
{
device = gviGetDevice(GVIDevices, i);
if(device->m_deviceID == deviceID)
return device;
}
return NULL;
}
static void gviFreeArrayDevice(void * elem)
{
GVIDevice * device = *(GVIDevice **)elem;
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
// close the device
lgAudClose(data->m_handle);
// playback specific cleanup
if(device->m_types & GV_PLAYBACK)
{
if(data->m_playbackSources)
gviFreeSourceList(data->m_playbackSources);
gsifree(data->m_playbackBuffer);
}
// capture specific cleanup
if(device->m_types & GV_CAPTURE)
{
gsifree(data->m_captureBuffer);
}
// free the device
gviFreeDevice(device);
}
GVBool gviPS2HeadsetStartup(void)
{
int result;
// create the array of devices
GVIDevices = gviNewDeviceList(gviFreeArrayDevice);
if(!GVIDevices)
return GVFalse;
// initialize the headset library
result = lgAudInit(gsimalloc, gsifree);
if(LGAUD_FAILED(result))
{
gviFreeDeviceList(GVIDevices);
GVIDevices = NULL;
return GVFalse;
}
return GVTrue;
}
void gviPS2HeadsetCleanup(void)
{
// free the device array
if(GVIDevices)
{
gviFreeDeviceList(GVIDevices);
GVIDevices = NULL;
}
// cleanup the headset library
lgAudDeInit();
}
static GVBool gviPlaybackDeviceThink(GVIDevice * device)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
int result;
int remainingBytes;
int numFrames;
int newBytes;
GVBool wroteToBuffer;
int size;
int i;
// don't do anything if we're not playing
if(!data->m_playing)
return GVTrue;
// get the remaining bytes
result = lgAudGetRemainingPlaybackBytes(data->m_handle, &remainingBytes);
if(LGAUD_FAILED(result))
return GVFalse;
// figure out how many bytes we need to write to stay ahead
newBytes = (gviMultiplyByBytesPerMillisecond(GVI_PLAYBACK_STAYAHEAD_MILLISECONDS) - remainingBytes);
newBytes = gviRoundUpToNearestMultiple(newBytes, GVIBytesPerFrame);
// figure out the number of frames that is
numFrames = (newBytes / GVIBytesPerFrame);
// write the frames
for(i = 0 ; i < numFrames ; i++)
{
// write a frame of sources to our buffer
wroteToBuffer = gviWriteSourcesToBuffer(data->m_playbackSources, data->m_playbackClock, data->m_playbackBuffer, 1);
// clear it if nothing was written
if(!wroteToBuffer)
memset(data->m_playbackBuffer, 0, (unsigned int)GVIBytesPerFrame);
// filter
if(device->m_playbackFilterCallback)
device->m_playbackFilterCallback(device, data->m_playbackBuffer, data->m_playbackClock);
// send it to the device
size = GVIBytesPerFrame;
result = lgAudWrite(data->m_handle, LGAUD_BLOCKMODE_BLOCKING, (u_char *)data->m_playbackBuffer, &size);
if(LGAUD_FAILED(result))
return GVFalse;
// update the clock
data->m_playbackClock++;
}
return GVTrue;
}
void gviPS2HeadsetThink(void)
{
GVIDevice * device;
GVBool rcode;
int num;
int i;
if(!GVIDevices)
return;
// loop through the devices backwards to that we can remove devices as we go
num = gviGetNumDevices(GVIDevices);
for(i = (num - 1) ; i >= 0 ; i--)
{
// get the device
device = gviGetDevice(GVIDevices, i);
// // check if playback is setup on the device
if(device->m_types & GV_PLAYBACK)
{
// let it think
rcode = gviPlaybackDeviceThink(device);
// check if the device was unplugged
if(!rcode)
gviDeviceUnplugged(device);
}
}
}
static GVBool gviDoesSupportOurFormat(lgAudSamplingFormat * formats, int count)
{
int i;
for(i = 0 ; i < count ; i++)
{
if(formats[i].Channels == 1)
if(formats[i].BitResolution == 16)
if(formats[i].LowerSamplingRate <= GV_SAMPLES_PER_SECOND)
if(formats[i].HigherSamplingRate >= GV_SAMPLES_PER_SECOND)
return GVTrue;
}
return GVFalse;
}
int gviPS2HeadsetListDevices(GVDeviceInfo devices[], int maxDevices, GVDeviceType types)
{
lgAudDeviceDesc headsetDesc;
GVDeviceType supportedTypes;
int result;
int index;
int numDevices = 0;
enumerate:
for(index = 0 ; numDevices < maxDevices ; index++)
{
// get the indexed device
result = lgAudEnumerate(index, &headsetDesc);
// check for the unplugged device error
if(result == LGAUD_ERR_DEVICE_LOST)
{
// as recommended by the docs, restart the enumeration
numDevices = 0;
goto enumerate;
}
// check for any other error
if(LGAUD_FAILED(result))
break;
// check what this device supports
supportedTypes = (GVDeviceType)0;
if(gviDoesSupportOurFormat(headsetDesc.RecordingFormats, headsetDesc.RecordingFormatsCount))
supportedTypes |= GV_CAPTURE;
if(gviDoesSupportOurFormat(headsetDesc.PlaybackFormats, headsetDesc.PlaybackFormatsCount))
supportedTypes |= GV_PLAYBACK;
// only add it if it supports a format for a type that the app requested
// this library doesn't support device names or default devices
if(supportedTypes & types)
{
// store this device's info in the array
devices[numDevices].m_id = index;
devices[numDevices].m_deviceType = supportedTypes;
devices[numDevices].m_defaultDevice = (GVDeviceType)0; // ps2 doesn't support default devices
// set the name and the hardware type based on the capabilities
if(supportedTypes == GV_CAPTURE)
{
_tcscpy(devices[numDevices].m_name, _T("USB Microphone"));
devices[numDevices].m_hardwareType = GVHardwarePS2Microphone;
}
else if(supportedTypes == GV_PLAYBACK)
{
_tcscpy(devices[numDevices].m_name, _T("USB Speakers"));
devices[numDevices].m_hardwareType = GVHardwarePS2Speakers;
}
else
{
_tcscpy(devices[numDevices].m_name, _T("USB Headset"));
devices[numDevices].m_hardwareType = GVHardwarePS2Headset;
}
// one more device
numDevices++;
}
}
// return the number of devices we found
return numDevices;
}
static void gviPS2HeadsetFreeDevice(GVIDevice * device)
{
// delete it from the array
// it will clear out internal data in the array's free function
gviDeleteDeviceFromList(GVIDevices, device);
}
static GVBool gviStartPlaybackDevice(GVIPS2HeadsetData * data)
{
int result;
// start the buffer
result = lgAudStartPlayback(data->m_handle);
if(LGAUD_FAILED(result))
return GVFalse;
// clear the clock
data->m_playbackClock = 0;
// started playing
data->m_playing = GVTrue;
return GVTrue;
}
static GVBool gviStartCaptureDevice(GVIPS2HeadsetData * data)
{
int result;
// start the buffer
result = lgAudStartRecording(data->m_handle);
if(LGAUD_FAILED(result))
return GVFalse;
// no data in the capture buffer
data->m_captureBufferBytes = 0;
// started capturing
data->m_capturing = GVTrue;
return GVTrue;
}
static GVBool gviPS2HeadsetStartDevice(GVIDevice * device, GVDeviceType type)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
if(type == GV_PLAYBACK)
return gviStartPlaybackDevice(data);
if(type == GV_CAPTURE)
return gviStartCaptureDevice(data);
if(type == GV_CAPTURE_AND_PLAYBACK)
{
if(!gviStartPlaybackDevice(data))
return GVFalse;
if(!gviStartCaptureDevice(data))
{
device->m_methods.m_stopDevice(device, GV_PLAYBACK);
return GVFalse;
}
return GVTrue;
}
return GVFalse;
}
static void gviPS2HeadsetStopDevice(GVIDevice * device, GVDeviceType type)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
if(type & GV_PLAYBACK)
{
// stop the playback buffer
lgAudStopPlayback(data->m_handle);
// stopped playing
data->m_playing = GVFalse;
// clear any pending sources & buffers
gviClearSourceList(data->m_playbackSources);
}
if(type & GV_CAPTURE)
{
// stop the capture buffer
lgAudStopRecording(data->m_handle);
// stopped capturing
data->m_capturing = GVFalse;
// so a stop then start isn't continuous
data->m_captureClock++;
}
}
static GVBool gviPS2HeadsetIsDeviceStarted(GVIDevice * device, GVDeviceType type)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
if(type == GV_PLAYBACK)
return data->m_playing;
if(type == GV_CAPTURE)
return data->m_capturing;
if(type == GV_CAPTURE_AND_PLAYBACK)
return (data->m_playing && data->m_capturing);
return GVFalse;
}
static void gviPS2HeadsetSetDeviceVolume(GVIDevice * device, GVDeviceType type, GVScalar volume)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
if(type & GV_PLAYBACK)
{
lgAudSetPlaybackVolume(data->m_handle, LGAUD_CH_BOTH, (u_char)(volume * 100));
data->m_playbackVolume = volume;
}
if(type & GV_CAPTURE)
{
lgAudSetRecordingVolume(data->m_handle, LGAUD_CH_BOTH, (u_char)(volume * 100));
data->m_captureVolume = volume;
}
}
static GVScalar gviPS2HeadsetGetDeviceVolume(GVIDevice * device, GVDeviceType type)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
if(type & GV_PLAYBACK)
return data->m_playbackVolume;
return data->m_captureVolume;
}
static void gviPS2HeadsetSetCaptureThreshold(GVIDevice * device, GVScalar threshold)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
data->m_captureThreshold = threshold;
}
static GVScalar gviPS2HeadsetGetCaptureThreshold(GVIDevice * device)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
return data->m_captureThreshold;
}
static int gviPS2HeadsetGetAvailableCaptureBytes(GVDevice device)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
int result;
int newBytes;
int numFrames;
// don't do anything if we're not capturing
if(!data->m_capturing)
return 0;
// get the number of new bytes
result = lgAudGetAvailableRecordingBytes(data->m_handle, &newBytes);
if(LGAUD_FAILED(result))
{
gviDeviceUnplugged(device);
return 0;
}
// figure out how many frames this is
numFrames = (newBytes / GVIBytesPerFrame);
// calculate how many bytes this is once encoded
newBytes = (numFrames * GVIEncodedFrameSize);
return newBytes;
}
static void gviProcessCapturedFrame(GVDevice device, GVByte * frameOut, GVSample * frameIn, GVScalar * volume, GVBool * threshold)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
GVScalar frameVolume;
// get the volume if requested
if(volume)
{
frameVolume = gviGetSamplesVolume(frameIn, GVISamplesPerFrame);
if(frameVolume > *volume)
*volume = frameVolume;
}
// check against the threshold
if(threshold && !*threshold)
{
if(volume)
{
// we already got the volume, so use that to check
*threshold = (*volume >= data->m_captureThreshold);
}
else
{
// we didn't get a volume, so check the samples directly
*threshold = gviIsOverThreshold(frameIn, GVISamplesPerFrame, data->m_captureThreshold);
}
}
// filter
if(device->m_captureFilterCallback)
device->m_captureFilterCallback(device, frameIn, data->m_captureClock);
// increment the capture clock
data->m_captureClock++;
// encode the buffer into the packet
gviEncode(frameOut, frameIn);
}
static GVBool gviPS2HeadsetCapturePacket(GVDevice device, GVByte * packet, int * len, GVFrameStamp * frameStamp, GVScalar * volume)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
GVBool overThreshold;
int result;
int numFrames;
int readSize;
int lenAvailable;
int framesAvailable;
GVSample * frameIn;
GVByte * frameOut;
// figure out how many encoded bytes they can handle
lenAvailable = *len;
// clear the len and volume
*len = 0;
if(volume)
*volume = 0;
// don't do anything if we're not capturing
if(!data->m_capturing)
return GVFalse;
// set the frameStamp
*frameStamp = data->m_captureClock;
// figure out how many frames they can handle
framesAvailable = (lenAvailable / GVIEncodedFrameSize);
// handle the data one frame at a time
overThreshold = GVFalse;
frameIn = data->m_captureBuffer;
frameOut = packet;
for(numFrames = 0 ; numFrames < framesAvailable ; numFrames++)
{
// read this frame
readSize = (GVIBytesPerFrame - data->m_captureBufferBytes);
result = lgAudRead(data->m_handle, LGAUD_BLOCKMODE_NOT_BLOCKING, ((u_char *)data->m_captureBuffer) + data->m_captureBufferBytes, &readSize);
if(LGAUD_FAILED(result))
{
gviDeviceUnplugged(device);
return GVFalse;
}
// check if we have a full frame
if(readSize != (GVIBytesPerFrame - data->m_captureBufferBytes))
{
// add to our count of how many bytes we have
data->m_captureBufferBytes += readSize;
break;
}
// process the frame
gviProcessCapturedFrame(device, frameOut, frameIn, volume, &overThreshold);
// we got a full frame, so there's no leftover
data->m_captureBufferBytes = 0;
// update the frame pointer
frameOut += GVIEncodedFrameSize;
}
// check if this packet crossed the threshold
if(overThreshold)
{
// store the time we crossed it
data->m_captureLastCrossedThresholdTime = data->m_captureClock;
}
else
{
// check if we are still on the overhang from a previous crossing
overThreshold = ((GVFrameStamp)(*frameStamp - data->m_captureLastCrossedThresholdTime) < GVI_HOLD_THRESHOLD_FRAMES);
}
// set the len
*len = (numFrames * GVIEncodedFrameSize);
// return false if we didn't get a packet
if(!overThreshold || (*len == 0))
return GVFalse;
return GVTrue;
}
static void gviPS2HeadsetPlayPacket(GVIDevice * device, const GVByte * packet, int len, GVSource source, GVFrameStamp frameStamp, GVBool mute)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
// don't do anything if we're not playing
if(!data->m_playing)
return;
//add it
gviAddPacketToSourceList(data->m_playbackSources, packet, len, source, frameStamp, mute, data->m_playbackClock);
}
static GVBool gviPS2HeadsetIsSourceTalking(GVDevice device, GVSource source)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
// don't do anything if we're not playing
if(!data->m_playing)
return GVFalse;
return gviIsSourceTalking(data->m_playbackSources, source);
}
static int gviPS2HeadsetListTalkingSources(GVDevice device, GVSource sources[], int maxSources)
{
GVIPS2HeadsetData * data = (GVIPS2HeadsetData *)device->m_data;
// don't do anything if we're not playing
if(!data->m_playing)
return GVFalse;
return gviListTalkingSources(data->m_playbackSources, sources, maxSources);
}
static GVBool gviPS2HeadsetInitDevice(GVIDevice * device, int deviceIndex, GVDeviceType type)
{
GVIPS2HeadsetData * data;
lgAudOpenParam openParam;
int result;
// setup the open param
openParam.Mode = 0;
if(type & GV_CAPTURE)
{
openParam.Mode |= LGAUD_MODE_RECORDING;
openParam.RecordingFormat.Channels = 1;
openParam.RecordingFormat.BitResolution = 16;
openParam.RecordingFormat.SamplingRate = GV_SAMPLES_PER_SECOND;
openParam.RecordingFormat.BufferMilliseconds = GVI_CAPTURE_BUFFER_MILLISECONDS;
}
if(type & GV_PLAYBACK)
{
openParam.Mode |= LGAUD_MODE_PLAYBACK;
openParam.PlaybackFormat.Channels = 1;
openParam.PlaybackFormat.BitResolution = 16;
openParam.PlaybackFormat.SamplingRate = GV_SAMPLES_PER_SECOND;
openParam.PlaybackFormat.BufferMilliseconds = GVI_PLAYBACK_BUFFER_MILLISECONDS;
}
// get a pointer to the data
data = (GVIPS2HeadsetData *)device->m_data;
// open the device
result = lgAudOpen(deviceIndex, &openParam, &data->m_handle);
if(LGAUD_FAILED(result))
return GVFalse;
// handle playback specific stuff
if(type & GV_PLAYBACK)
{
// create the array of sources
data->m_playbackSources = gviNewSourceList();
if(!data->m_playbackSources)
{
lgAudClose(data->m_handle);
return GVFalse;
}
// allocate the buffer
data->m_playbackBuffer = (GVSample *)gsimalloc((unsigned int)GVIBytesPerFrame);
if(!data->m_playbackBuffer)
{
gviFreeSourceList(data->m_playbackSources);
lgAudClose(data->m_handle);
return GVFalse;
}
// set data
//data->m_playbackVolume = gviGetMixerVolume(data, GV_PLAYBACK);
data->m_playbackVolume = 1.0;
}
// handle capture specific stuff
if(type & GV_CAPTURE)
{
// set some data vars
data->m_captureVolume = 1.0;
data->m_captureLastCrossedThresholdTime = (GVFrameStamp)(data->m_captureClock - GVI_HOLD_THRESHOLD_FRAMES - 1);
// allocate the buffer
data->m_captureBuffer = (GVSample *)gsimalloc((unsigned int)GVIBytesPerFrame);
if(!data->m_captureBuffer)
{
if(type & GV_PLAYBACK)
{
gviFreeSourceList(data->m_playbackSources);
gsifree(data->m_playbackBuffer);
}
lgAudClose(data->m_handle);
return GVFalse;
}
}
return GVTrue;
}
GVDevice gviPS2HeadsetNewDevice(GVDeviceID deviceID, GVDeviceType type)
{
GVIDevice * device;
GVBool result;
// check for no type
if(!(type & GV_CAPTURE_AND_PLAYBACK))
return NULL;
// check if the device already exists
if(gviFindDeviceByID(deviceID))
return NULL;
// create a new device
device = gviNewDevice(deviceID, GVHardwarePS2Headset, type, sizeof(GVIPS2HeadsetData));
if(!device)
return NULL;
// init the device
result = gviPS2HeadsetInitDevice(device, deviceID, type);
if(result == GVFalse)
{
gviFreeDevice(device);
return NULL;
}
// store the pointers
device->m_methods.m_freeDevice = gviPS2HeadsetFreeDevice;
device->m_methods.m_startDevice = gviPS2HeadsetStartDevice;
device->m_methods.m_stopDevice = gviPS2HeadsetStopDevice;
device->m_methods.m_isDeviceStarted = gviPS2HeadsetIsDeviceStarted;
device->m_methods.m_setDeviceVolume = gviPS2HeadsetSetDeviceVolume;
device->m_methods.m_getDeviceVolume = gviPS2HeadsetGetDeviceVolume;
device->m_methods.m_setCaptureThreshold = gviPS2HeadsetSetCaptureThreshold;
device->m_methods.m_getCaptureThreshold = gviPS2HeadsetGetCaptureThreshold;
device->m_methods.m_getAvailableCaptureBytes = gviPS2HeadsetGetAvailableCaptureBytes;
device->m_methods.m_capturePacket = gviPS2HeadsetCapturePacket;
device->m_methods.m_playPacket = gviPS2HeadsetPlayPacket;
device->m_methods.m_isSourceTalking = gviPS2HeadsetIsSourceTalking;
device->m_methods.m_listTalkingSources = gviPS2HeadsetListTalkingSources;
// add it to the list
gviAppendDeviceToList(GVIDevices, device);
return device;
}
#endif //!defined(GV_NO_PS2_HEADSET)
|