aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordvdli <70133153+dvdli@users.noreply.github.com>2021-03-15 15:15:32 +0800
committerGitHub <noreply@github.com>2021-03-15 15:15:32 +0800
commitc288f6e40e1b7fec05e91009dc6b7ff682aeb53d (patch)
treed696685895605c6752e4363dd00c21b205d22194 /src
parentd7364cd3aebd62f8527c986afa7132b1f5271ed5 (diff)
parenta36d521c328b16b53360a016aa543491d0aad05e (diff)
Merge pull request #202 from dvdli/tinyalsa-float-dev
floating-point PCM support
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pcm.c b/src/pcm.c
index 10e477b..63ca65f 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:
@@ -1404,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;