From b1b3582772dae244e6e3569ca6c0cc5780ffb8f3 Mon Sep 17 00:00:00 2001 From: dvdli Date: Mon, 22 Feb 2021 17:24:30 +0800 Subject: support float config and float wave file playback --- src/pcm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/pcm.c b/src/pcm.c index 10e477b..3d50ea7 100644 --- a/src/pcm.c +++ b/src/pcm.c @@ -282,6 +282,11 @@ static unsigned int pcm_format_to_alsa(enum pcm_format format) return SNDRV_PCM_FORMAT_S32_LE; case PCM_FORMAT_S32_BE: return SNDRV_PCM_FORMAT_S32_BE; + + case PCM_FORMAT_FLOAT_LE: + return SNDRV_PCM_FORMAT_FLOAT_LE; + case PCM_FORMAT_FLOAT_BE: + return SNDRV_PCM_FORMAT_FLOAT_BE; }; } @@ -556,6 +561,8 @@ unsigned int pcm_format_to_bits(enum pcm_format format) case PCM_FORMAT_S32_BE: case PCM_FORMAT_S24_LE: case PCM_FORMAT_S24_BE: + case PCM_FORMAT_FLOAT_LE: + case PCM_FORMAT_FLOAT_BE: return 32; case PCM_FORMAT_S24_3LE: case PCM_FORMAT_S24_3BE: -- cgit v1.2.3 From a36d521c328b16b53360a016aa543491d0aad05e Mon Sep 17 00:00:00 2001 From: dvdli Date: Thu, 11 Mar 2021 18:01:56 +0800 Subject: add floating-point PCM supoort to tinyplay This change also fixes overwriting the appl_ptr and avail_min when calling the pcm_state function. --- src/pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pcm.c b/src/pcm.c index 3d50ea7..63ca65f 100644 --- a/src/pcm.c +++ b/src/pcm.c @@ -1411,7 +1411,8 @@ again: int pcm_state(struct pcm *pcm) { - int err = pcm_sync_ptr(pcm, 0); + // Update the state only. Do not sync HW sync. + int err = pcm_sync_ptr(pcm, SNDRV_PCM_SYNC_PTR_APPL | SNDRV_PCM_SYNC_PTR_AVAIL_MIN); if (err < 0) return err; -- cgit v1.2.3