#ifdef CONFIG_AUDIO_FORMAT_PCM
if (pcm->flags & PCM_IN) {
struct ap_buffer_s *apb = (struct ap_buffer_s *)pcm->pBuffers[0];
+ apb->flags = AUDIO_APB_TYPE_INPUT;
if (apb->nmaxbytes - apb->nbytes >= sizeof(struct wav_header_s)) {
struct wav_header_s *wav = (struct wav_header_s *)(&apb->samp[0]);
#else
static int pcm_resume(FAR struct audio_lowerhalf_s *dev)
#endif
-#endif
{
FAR struct pcm_decode_s *priv = (FAR struct pcm_decode_s *)dev;
FAR struct audio_lowerhalf_s *lower;
return lower->ops->resume(lower);
#endif
}
+#endif
/****************************************************************************
* Name: pcm_allocbuffer
DEBUGASSERT(priv->samprate < 65535);
caps.ac_len = sizeof(struct audio_caps_s);
- caps.ac_type = AUDIO_TYPE_OUTPUT;
+ if (apb->flags & AUDIO_APB_TYPE_INPUT) {
+ caps.ac_type = AUDIO_TYPE_INPUT;
+ } else {
+ caps.ac_type = AUDIO_TYPE_OUTPUT;
+ }
caps.ac_channels = priv->nchannels;
caps.ac_controls.hw[0] = (uint16_t) priv->samprate;
}
break; /* Break for inner switch case */
case AUDIO_TYPE_INPUT: {
- audvdbg(" AUDIO_TYPE_OUTPUT:\n");
+ audvdbg(" AUDIO_TYPE_INPUT:\n");
/* Verify that all of the requested values are supported */
ret = -ERANGE;
#define AUDIO_APB_DEQUEUED (1 << 2)
#define AUDIO_APB_FINAL (1 << 3) /* Last buffer in the stream */
+#define AUDIO_APB_TYPE_INPUT (1 << 4)
+#define AUDIO_APB_TYPE_OUTPUT (1 << 5)
/****************************************************************************
* Public Types
****************************************************************************/