mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-08-28 11:34:10 -05:00
Fix issue with audio conversion for o3ds
This commit is contained in:
@@ -7,29 +7,39 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
void convertVideoToOutput(int index, VideoOutputData *p_out, CaptureData* capture_data) {
|
||||
bool convertVideoToOutput(int index, VideoOutputData *p_out, CaptureData* capture_data) {
|
||||
CaptureReceived *p_in = &capture_data->capture_buf[index];
|
||||
bool converted = false;
|
||||
#ifdef USE_FTD3
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_FTD3)
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_FTD3) {
|
||||
ftd3_convertVideoToOutput(p_in, p_out, capture_data->status.enabled_3d);
|
||||
converted = true;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_FTD2
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_FTD2)
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_FTD2) {
|
||||
ftd2_convertVideoToOutput(p_in, p_out, capture_data->status.enabled_3d);
|
||||
converted = true;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_DS_3DS_USB
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_USB)
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_USB) {
|
||||
usb_convertVideoToOutput(p_in, p_out, &capture_data->status.device, capture_data->status.enabled_3d);
|
||||
converted = true;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_IS_NITRO_USB
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_IS_NITRO)
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_IS_NITRO) {
|
||||
usb_is_nitro_convertVideoToOutput(p_in, p_out, capture_data->capture_type[index]);
|
||||
converted = true;
|
||||
}
|
||||
#endif
|
||||
return converted;
|
||||
}
|
||||
|
||||
void convertAudioToOutput(int index, std::int16_t *p_out, uint64_t n_samples, const bool is_big_endian, CaptureData* capture_data) {
|
||||
bool convertAudioToOutput(int index, std::int16_t *p_out, uint64_t n_samples, const bool is_big_endian, CaptureData* capture_data) {
|
||||
if(!capture_data->status.device.has_audio)
|
||||
return;
|
||||
return true;
|
||||
CaptureReceived *p_in = &capture_data->capture_buf[index];
|
||||
uint8_t* base_ptr = NULL;
|
||||
#ifdef USE_FTD3
|
||||
@@ -44,7 +54,7 @@ void convertAudioToOutput(int index, std::int16_t *p_out, uint64_t n_samples, co
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_FTD2) {
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_USB
|
||||
#ifdef USE_DS_3DS_USB
|
||||
if(capture_data->status.device.cc_type == CAPTURE_CONN_USB) {
|
||||
if(!capture_data->status.enabled_3d)
|
||||
base_ptr = (uint8_t*)p_in->usb_received_3ds.audio_data;
|
||||
@@ -53,10 +63,11 @@ void convertAudioToOutput(int index, std::int16_t *p_out, uint64_t n_samples, co
|
||||
}
|
||||
#endif
|
||||
if(base_ptr == NULL)
|
||||
return;
|
||||
return false;
|
||||
if(!is_big_endian)
|
||||
memcpy(p_out, base_ptr, n_samples * 2);
|
||||
else
|
||||
for(int i = 0; i < n_samples; i += 2)
|
||||
p_out[i] = (base_ptr[i + 1] << 8) | base_ptr[i];
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user