Closed lowlyocean closed 7 years ago
Whole plugin is a WIP ;) but pulseaudio should kinda work (resampling should be moved to separate thread prolly though). Configuration dialog is WIP (missing) so you need to manually edit INI for what device to use. I haven't work on this for a while but IIRC device enumeration code (pa_get_devicelist
) should be working so just needs a GTK+ dialog.
OK, refreshed my memory a little. So manually editing ini to something like:
[devices]
port_0=
port_1=singstar
[singstar 1]
device_api=pulse
[pulse]
audio_device_1=alsa_card.pci-0000_00_1b.0
hi @jackun
Does it work with officials PS2 singstar microphones?
If your OS recognizes it as a microphone then probably. There's no passthrough though but probably should add that.
Do I need to have the Logitech USB headset actually plugged in for the pulseaudio device to come up? Looking for the headset now to test that. In the meantime, I get the following stack trace once I select my network adapter in SOCOM 2 LAN mode. Any clue what would cause USBasync() call to fail? Do you think the game is checking if the Logitech USB headset is plugged in?
Thread 5 (Thread 0xf2cb3b40 (LWP 17365)):
#0 0xf7fd8be9 in __kernel_vsyscall ()
#1 0xf6d82334 in raise () from /lib/i386-linux-gnu/libpthread.so.0
#2 0x08366a3f in pxTrap () at /build/pcsx2-QnCjtZ/pcsx2-1.3.1-1094-gf062b0f+dfsg/common/src/Utilities/Exceptions.cpp:94
#3 0x08378fb1 in SysPageFaultSignalFilter (signal=11, siginfo=0xf2cb260c) at /build/pcsx2-QnCjtZ/pcsx2-1.3.1-1094-gf062b0f+dfsg/common/src/Utilities/Linux/LnxHostSys.cpp:70
#4 <signal handler called>
#5 0xf6ce2ea2 in ?? () from /lib/i386-linux-gnu/libc.so.6
#6 0xf08c82c3 in cpu_physical_memory_rw(unsigned int, unsigned char*, int, int) () from /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel.so.0.5.2
#7 0xf08cd2c4 in get_dwords(unsigned int, unsigned int*, int) () from /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel.so.0.5.2
#8 0xf08cd487 in ohci_read_td(unsigned int, ohci_td*) () from /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel.so.0.5.2
#9 0xf08ce007 in ohci_service_td(OHCIState*, ohci_ed*) () from /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel.so.0.5.2
#10 0xf08ce5d0 in ohci_service_ed_list(OHCIState*, unsigned int) () from /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel.so.0.5.2
#11 0xf08ce818 in ohci_frame_boundary(void*) () from /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel.so.0.5.2
#12 0xf08c8185 in USBasync () from /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel.so.0.5.2
#13 0x08080ab2 in psxRcntUpdate () at /build/pcsx2-QnCjtZ/pcsx2-1.3.1-1094-gf062b0f+dfsg/pcsx2/IopCounters.cpp:467
#14 0x080a89d7 in iopEventTest () at /build/pcsx2-QnCjtZ/pcsx2-1.3.1-1094-gf062b0f+dfsg/pcsx2/R3000A.cpp:199
#15 0x342d8da8 in ?? ()
#16 0x080aa923 in _cpuEventTest_Shared () at /build/pcsx2-QnCjtZ/pcsx2-1.3.1-1094-gf062b0f+dfsg/pcsx2/R5900.cpp:406
#17 0x09f04005 in eeRecDispatchers ()
#18 0x00000000 in ?? ()
This is what my file looks like now... how do I know what should go under the audio_device_1? Is there some command I can run to check? Or is that one you specify the one that should be there? Thanks
[devices] port_0= port_1=logitech_usbmic wheel_type_0=0 wheel_type_1=0
[logitech_usbmic 1] device_api=pulse
[pulse] audio_device_1=alsa_card.pci-0000_00_1b.0
alsa_card.pci-0000_00_1b.0
is just an example. pacmd list-sources|grep name:
should list inputs if I'm not mistaken.
Does this take, e.g. a webcam microphone and present it to PCSX2 as the microphone channel of the Logitech USB headset? If so- don't I also need to specify what pulseaudio sink the Logitech headset's speaker should get routed to? I'm sorry if I'm misunderstanding how this works- I thought that I need to plug in an actual physical Logitech USB headset and I can perform two-way communication with any game (no need to specify pulseaudio sink or source). Whoops
Well, yes. It emulates a singstar or a logitech usb mic so any mic should work.
Okay thanks for clearing that up. So right now is it safe to assume that if the game was sending audio TO the Logitech headset (e.g. from other users playing in the same online lobby), there is no way for me to route that audio to my speakers/headphones on the PC running PCSX2.
Edit: just tried changing audio_device_1 to one of the outputs of pacmd list-sources, still run into that segfault during USBasync. Will need to investigate another time
Oh right, as a headset. Currently it works as a microphone device type only (has only an input terminal) so yeah game shouldn't even detect it as a headset that it can send audio to.
Edit: Mic code is based largely on qemu code, just turned it a mic instead, so adding the usb device part is pretty much copy/paste.
About crash, I think usb stack should be stopped or something exiting back to main menu. Usb devices get reset, SOCOM unloads some modules and, need to get debug build of PSCX2 to confirm but, sets first HCCA intr address to 0x0000400d
but IOPmem memory range around 0x2400400d
is cleared to 0x0d000040
and finally whole HCCA area gets cleared to 0x0d000040
edit: ok, 0x0d000040
comes from unaligned (?) read from 0x2400400d
, as everything around 0x2400400c
gets cleared to 0x0000400d
I'd like to help get bidirectional headset audio working for use with SOCOM, but based on what you just wrote I realize that I'd need some PS2 architecture diagram with memory mapping in order to dive in and be productive. Not familiar with USB or PulseAudio API's either. I can, however, test builds as you release them since I do have a copy of SOCOM II here.
You can just hack around it with resetting ohci bits by patching ohci_frame_boundary in usb-ohci.cpp, for now:
/* Process all the lists at the end of the frame */
if (ohci->ctl & OHCI_CTL_PLE) {
int n;
n = ohci->frame_number & 0x1f;
if (le32_to_cpu(hcca.intr[n]) == 0x400d) //or any descriptor
{
ohci->ctl = (ohci->ctl & OHCI_CTL_IR) | OHCI_USB_SUSPEND;
ohci->old_ctl = 0;
return;
}
ohci_service_ed_list(ohci, le32_to_cpu(hcca.intr[n]));
}
The same bug actually manifests when you reboot a game, but then plugin can reset OHCI in USBsetRam() function.
Yea, don't run into that crash now with suggested patch. Alas, game does not recognize microphone. Guess it's all or nothing as far as being able to use Voice Chat in SOCOM
Ok, just in case, I'm turning the AudioSource classes to AudioDevices (so both sink/source) and added a headset device. I'm giving it a mono mic and stereo headphones for now. SOCOM kind of started to poll it, but for some reason it seemed to check if bass boost is set even if none defined in descriptor (on mic, no less, if I got my feature units right lol) so a little trial and error is needed i guess.
Really excited to see development continue on this plugin. I did try latest build and noticed the new "headset" device; set my PulseAudio source and sink then tried issuing a voice command in SOCOM 2's single player mode. The microphone volume indicator in the game did not budge, so I'm assuming that whatever you're looking at now with respect to bass boost needs to be sorted out before any audio is actually exchanged with the game. I wonder if the game is selective with respect to the USB product ID and vendor ID, though the one you specified in usb-headset.cpp matches the headset shipped with the first SOCOM game and I don't see why it wouldn't work with the second game
Seems that I deleted microphone (I think) feature unit from descriptor when juggling stuff around.
Ah, okay. Tried the update, same results. I guess I'm not sure if I'm expecting too much too soon. Have you verified bidirectional audio with some particular game / test sequence? I could try reproducing it if that helps
Yeah, too soon :D Just a skeleton copying my Cloud II headphone usb dongle. Haven't played SOCOMs before so when/where in the game can one test it? Or some other game?
In socom 2 single player, if you hold the "O" button it will bring up voice recognition. Should be able to issue the command "Fireteam, Get Down" and they will respond accordingly
Noticed this debug output in the PCSX2 console window.I'd say one of the game's modules is trying to set the PulseAudio sink to a sample rate of 22050 Hz and bit depth of 16, but can't succeed
lgAudInit version 1.08.002: max streaming data size: 65536
HEADSETO.IRX: Error opening headset output (22050, 0, 16)-> -2147483644!
Also, when I profile with 'operf -g --pid=$(pidof PCSX2)' for a short duration of the game while I'm holding the O button to initiate voice command, I find that the function "PulseAudioDevice::stream_read_cb" is called but "PulseAudioDevice::stream_write_cb" is never called.
I grep'd the stderr and stdout streams while running PCSX2 for either "[USBqemu]" or "headset" and this was the result:
[[USBqemu] [DeviceProxyBase] ctor (msd)
[USBqemu] [DeviceProxyBase] ctor (singstar)
[USBqemu] [DeviceProxyBase] ctor (logitech_usbmic)
[USBqemu] [DeviceProxyBase] ctor (headset)
[USBqemu] [DeviceProxyBase] ctor (pad)
Binding USB: /usr/lib/i386-linux-gnu/pcsx2/libUSBqemu-wheel-0.5.2_d.so
[USBqemu] [USBinit] USBinit
[USBqemu] [LoadConfig] USB load config
[USBqemu] [LoadSetting] Key is empty for 'device_api' on port 0
[USBqemu] [LoadSetting] [headset 1] 'device_api'='pulse'
[USBqemu] [LoadConfig] Checking device 'headset' api: 'pulse'...
[USBqemu] [LoadConfig] API OK
[USBqemu] [USBopen] USBopen
[USBqemu] [LoadSetting] [headset 1] 'device_api'='pulse'
[USBqemu] [LoadSetting] [pulse 1] 'audio_src_0'='alsa_input.usb-046d_HD_Webcam_C525_46671310-00.analog-mono'
[USBqemu] [LoadSetting] [pulse 1] 'buffer_len'=0
[USBqemu] [Init] pa_context_connect OK
[USBqemu] [pa_context_state_cb] pa_context_get_state() 2
[USBqemu] [pa_context_state_cb] pa_context_get_state() 3
[USBqemu] [pa_context_state_cb] pa_context_get_state() 4
[USBqemu] [Init] usec_to_bytes 19200
[USBqemu] [Init] pa_stream_connect_record OK
[USBqemu] [LoadSetting] [pulse 1] 'audio_src_0'='alsa_input.usb-046d_HD_Webcam_C525_46671310-00.analog-mono'
[USBqemu] [LoadSetting] [pulse 1] 'buffer_len'=0
[USBqemu] [Init] pa_context_connect OK
[USBqemu] [pa_context_state_cb] pa_context_get_state() 2
[USBqemu] [pa_context_state_cb] pa_context_get_state() 3
[USBqemu] [pa_context_state_cb] pa_context_get_state() 4
[USBqemu] [Init] usec_to_bytes 19200
[USBqemu] [Init] pa_stream_connect_playback OK
[USBqemu] [headset_handle_control] headset: req 0005 val: 0002 idx: 0000 len: 0
[USBqemu] [headset_handle_control] headset: req 8006 val: 0100 idx: 0000 len: 8
[USBqemu] [headset_handle_control] Get descriptor: 1
[USBqemu] [headset_handle_control] headset: req 8006 val: 0100 idx: 0000 len: 18
[USBqemu] [headset_handle_control] Get descriptor: 1
[USBqemu] [headset_handle_control] headset: req 8006 val: 0200 idx: 0000 len: 4
[USBqemu] [headset_handle_control] Get descriptor: 2
[USBqemu] [headset_handle_control] headset: req 8006 val: 0200 idx: 0000 len: 249
[USBqemu] [headset_handle_control] Get descriptor: 2
[USBqemu] [headset_handle_control] headset: req 0009 val: 0001 idx: 0000 len: 0
loadmodule: fname cdrom0:JPYRUNJPYIRXJPYHEADSETO.IRX args 13 arg priority=22
[USBqemu] [headset_handle_control] headset: req 010B val: 0000 idx: 0001 len: 0
[USBqemu] [headset_handle_control] Set interface: 0
[USBqemu] [headset_handle_control] headset: req 8006 val: 0301 idx: 0409 len: 254
[USBqemu] [headset_handle_control] Get descriptor: 3
[USBqemu] [headset_handle_control] headset: req A181 val: 0100 idx: 0500 len: 1
[USBqemu] [usb_audio_get_control] cs: 01 attr: 81 cn: 255, unit: 0500
[USBqemu] [headset_handle_control] headset: req A181 val: 0201 idx: 0500 len: 2
[USBqemu] [usb_audio_get_control] cs: 02 attr: 81 cn: 0, unit: 0500
HEADSET Output module v2.0 built with liblgaud 1.08 and SCE 2.8.0
[USBqemu] [headset_handle_control] headset: req A182 val: 0201 idx: 0500 len: 2
[USBqemu] [usb_audio_get_control] cs: 02 attr: 82 cn: 0, unit: 0500
[USBqemu] [headset_handle_control] headset: req A183 val: 0201 idx: 0500 len: 2
[USBqemu] [usb_audio_get_control] cs: 02 attr: 83 cn: 0, unit: 0500
HEADSETO.IRX: Error opening headset output (22050, 0, 16)-> -2147483644!
[USBqemu] [USBclose] USBclose
[USBqemu] [USBshutdown] USBshutdown
[USBqemu] [pa_context_state_cb] pa_context_get_state() 6
[USBqemu] [pa_context_state_cb] pa_context_get_state() 6
Mic part shows some promise after setting everything to mono, weird.Probably crackling and dropping samples too :P Still no output to headphone(s). Descriptor might be funky still or the usual with PS2 games, crap is hardcoded.
E:
Result: Action 0 '.S ABLE .S ' (Conf.5327)
result of 3 words
.S ABLE .S (81,68,82)
5327 (type 0 - final)
0
Result: Action 0 '.S ABLE LEAD TO WHISKEY .S ' (Conf.5909)
result of 5 words
.S ABLE LEAD TO WHISKEY .S (81,47,15,27,82)
5909 (type 0 - final)
0
This is AWESOME! Just verified it working in single player campaign here, too. I'd mentioned that people still play "online" by using the XLink virtual LAN service. I modified the dev9ghzdrk networking plugin to work for Linux and XLink. It can be downloaded here (https://github.com/radical-equanimity/pcsx2/tree/linux_dev9ghzdrk/plugins/dev9ghzdrk). For the XLink service to recognize PCSX2 you might need to change the PS2's IP address based on the MAC address of your PC's network adapter (see http://www.teamxlink.co.uk/ps2assign.php). Can be done with the Network Adaptor Start-Up Disc.
Once I've joined a game lobby, I'm offered the option to hold O to activate voice chat. The active speaker's name should appear at the bottom of the lobby screen but it doesn't work when I try. Probably related to the headphone output not working yet, but I'll wait for any progress on that front before trying again
I do know that the headset had mono output since there was only one earpiece
I managed to sniff the USB frames exchanged when I plug in the actual Logitech USB headset that shipped with Socom 2. The Descriptors can be decoded by loading this capture file into Wireshark and looking at frame 38. logitech_usb_headset.pcapng.tar.gz
lsusb -v -d vid:pid
should do the trick though, after modprobe -r usbhid
for whatever reason.
E: but this has better hex dump for copy/paste, heh
I managed to run this without having to remove usbhid module first:
daniel@daniel-desktop:~$ lsusb -vvv -d 046d:0a01
Bus 001 Device 003: ID 046d:0a01 Logitech, Inc. USB Headset
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x046d Logitech, Inc.
idProduct 0x0a01 USB Headset
bcdDevice 10.12
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 318
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 117
bInCollection 2
baInterfaceNr( 0) 1
baInterfaceNr( 1) 2
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 13
wTerminalType 0x0201 Microphone
bAssocTerminal 0
bNrChannels 1
wChannelConfig 0x0001
Left Front (L)
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 6
bSourceID 13
bControlSize 1
bmaControls( 0) 0x03
Mute Control
Volume Control
bmaControls( 1) 0x00
iFeature 0
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 12
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bNrChannels 2
wChannelConfig 0x0003
Left Front (L)
Right Front (R)
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 4 (MIXER_UNIT)
bUnitID 9
bNrInPins 2
baSourceID( 0) 12
baSourceID( 1) 6
bNrChannels 2
wChannelConfig 0x0003
Left Front (L)
Right Front (R)
iChannelNames 0
bmControls 0x00
iMixer 0
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 1
bSourceID 9
bControlSize 1
bmaControls( 0) 0x01
Mute Control
bmaControls( 1) 0x02
Volume Control
bmaControls( 2) 0x02
Volume Control
iFeature 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 14
wTerminalType 0x0301 Speaker
bAssocTerminal 0
bSourceID 1
iTerminal 0
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 11
wTerminalType 0x0201 Microphone
bAssocTerminal 0
bNrChannels 1
wChannelConfig 0x0001
Left Front (L)
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 2
bSourceID 11
bControlSize 1
bmaControls( 0) 0x03
Mute Control
Volume Control
bmaControls( 1) 0x00
iFeature 0
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 4 (MIXER_UNIT)
bUnitID 7
bNrInPins 1
baSourceID( 0) 2
bNrChannels 1
wChannelConfig 0x0001
Left Front (L)
iChannelNames 0
bmControls 0x00
iMixer 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 10
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 7
iTerminal 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 12
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 23
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 2
bBitResolution 16
bSamFreqType 5 Discrete
tSamFreq[ 0] 8000
tSamFreq[ 1] 11025
tSamFreq[ 2] 22050
tSamFreq[ 3] 44100
tSamFreq[ 4] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 9
Transfer Type Isochronous
Synch Type Adaptive
Usage Type Data
wMaxPacketSize 0x00c0 1x 192 bytes
bInterval 1
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 12
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 23
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 5 Discrete
tSamFreq[ 0] 8000
tSamFreq[ 1] 11025
tSamFreq[ 2] 22050
tSamFreq[ 3] 44100
tSamFreq[ 4] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 9
Transfer Type Isochronous
Synch Type Adaptive
Usage Type Data
wMaxPacketSize 0x0060 1x 96 bytes
bInterval 1
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 10
bDelay 0 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 23
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 5 Discrete
tSamFreq[ 0] 8000
tSamFreq[ 1] 11025
tSamFreq[ 2] 22050
tSamFreq[ 3] 44100
tSamFreq[ 4] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 9
Transfer Type Isochronous
Synch Type Adaptive
Usage Type Data
wMaxPacketSize 0x0060 1x 96 bytes
bInterval 1
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 2 Decoded PCM samples
wLockDelay 1 Decoded PCM samples
Ok, you can try now. Pulseaudio code might need some work still, also much buffer copying. The descriptor setup is bizarre (like input to input, wtf?) so I just use one set of feature unit vars for both mic's and mixer's feature unit. Seems to work but some cases might need it separated probably.
It works! At first I thought the mic was broken but actually it was just set to very low volume for some reason. You are my favorite person right now, sir! I spent much of yesterday trying to write PulseAudioDevice::SetBuffer() and PulseAudioDevice::stream_write_cb() but ended up lost in PulseAudio documentation and reading OHCI and Audio class specifications. Cheers!
It doesn't seem to be "sample perfect". There are weird pops and clicks when not accounting emulator slow downs. Prolly need to steal timestretch code from spu plugin too, ha, but adjusting resample ratio when buffer is emptier than the requested nbytes
might to the trick for now. It changes pitch though.
edit: some pops/clicks seem to be already introduced somewhere upstream
It seems as though the voices coming in from other Socom 2 players are a bit low but maybe that is just a scaling factor that needs to be adjusted somewhere in the speaker code. I also don't notice stretches or slowdowns but my 4.6GHz i5-3570k is running at 60 fps consistently with SPU plugin set to Nearest interpolation with disabled effects processing and SDL audio module. Also have EE cyclerate and VU Cycle stealing speedhacks set to highest value of 3.
Edit: SPU synchronization method is set to None instead of TimeStretch and latency is set to 40
Probably SetVolume etc. Can skip that then it's 100% all the time
Was able to build shared object and load into PCSX2 1.3.1
Can select Logitech headset for Port 1 and the second Port 1 dropbox allows me to select PulseAudio backend (awesome!) but pressing Configure does nothing. Is this functionality a WIP? I've already got SOCOM 2 running in PCSX2 over Xlink LAN with a linux build of dev9ghz plugin. Having a plugin to allow me to use Logitech headset on Linux would be fantastic.
A grep of source tree shows import of pulseaudio headers but the shared library doesn't link against pulseaudio- is there something I can do to help get this working? Or is it already working and I'm just doing something wrong--