Skip to content

Commit

Permalink
special case for internal mic, disable 48000Hz resampler (it need tes…
Browse files Browse the repository at this point in the history
…ting on SPDIF output)
  • Loading branch information
tsynik committed Jun 20, 2012
1 parent 4f84a3c commit 9f16964
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions libaudio/audio_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,15 @@ static int is_device_usb_cap(void)
struct stat info;
char path[18]="/dev/snd/";
strcat(path, property);
int ret = stat(path, &info);
LOGV("# is_device_usb_cap, dev: %s, ret: %d", property, ret);
return(ret == -1 ? 0 : 1);
// internal MIC case
if (strcmp(property, "pcmC0D0c") == 0) {
LOGV("# internal mic input selected");
return(0);
} else {
int ret = stat(path, &info);
LOGV("# is_device_usb_cap, dev: %s, ret: %d", property, ret);
return(ret == -1 ? 0 : 1);
}
}

/* The enable flag when 0 makes the assumption that enums are disabled by
Expand Down Expand Up @@ -1193,7 +1199,8 @@ static int start_output_stream(struct sun4i_stream_out *out)
ptr = property;
card = property[4] - '0';
port = property[6] - '0';
LOGV("# card: %u, port: %u, type: %s", card, port, &ptr[7]);
// streamtype = &ptr[7]
LOGV("# card: %u, port: %u", card, port);
/* HW Info (failsafe check) */
struct pcm_config config;
struct pcm *pcm;
Expand Down Expand Up @@ -1570,8 +1577,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
out->low_power = low_power;
}

/* only use resampler if required */
if (out->config.rate != DEFAULT_OUT_SAMPLING_RATE) {
/* only use resampler if required (avoid 48000Hz resampling for external DAC) */
if (out->config.rate != DEFAULT_OUT_SAMPLING_RATE && out->config.rate != 48000) {
LOGD("### out->resampler");
out->resampler->resample_from_input(out->resampler,
(int16_t *)buffer,
&in_frames,
Expand Down

0 comments on commit 9f16964

Please sign in to comment.