summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/pcm-alsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/pcm-alsa.c')
-rw-r--r--firmware/target/hosted/pcm-alsa.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/firmware/target/hosted/pcm-alsa.c b/firmware/target/hosted/pcm-alsa.c
index 939a0cabb5..970abc78cf 100644
--- a/firmware/target/hosted/pcm-alsa.c
+++ b/firmware/target/hosted/pcm-alsa.c
@@ -66,10 +66,10 @@ static const snd_pcm_access_t access_ = SND_PCM_ACCESS_RW_INTERLEAVED; /* access
66#if defined(SONY_NWZ_LINUX) || defined(HAVE_FIIO_LINUX_CODEC) 66#if defined(SONY_NWZ_LINUX) || defined(HAVE_FIIO_LINUX_CODEC)
67/* Sony NWZ must use 32-bit per sample */ 67/* Sony NWZ must use 32-bit per sample */
68static const snd_pcm_format_t format = SND_PCM_FORMAT_S32_LE; /* sample format */ 68static const snd_pcm_format_t format = SND_PCM_FORMAT_S32_LE; /* sample format */
69typedef long sample_t; 69typedef int32_t sample_t;
70#else 70#else
71static const snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ 71static const snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */
72typedef short sample_t; 72typedef int16_t sample_t;
73#endif 73#endif
74static const int channels = 2; /* count of channels */ 74static const int channels = 2; /* count of channels */
75static unsigned int real_sample_rate; 75static unsigned int real_sample_rate;
@@ -260,10 +260,9 @@ error:
260 * and add 48dB to the input volume. We cannot go lower -43dB because several 260 * and add 48dB to the input volume. We cannot go lower -43dB because several
261 * values between -48dB and -43dB would require a fractional multiplier, which is 261 * values between -48dB and -43dB would require a fractional multiplier, which is
262 * stupid to implement for such very low volume. */ 262 * stupid to implement for such very low volume. */
263static int dig_vol_mult_l = 2 ^ 16; /* multiplicative factor to apply to each sample */ 263static int dig_vol_mult_l = 2 << 16; /* multiplicative factor to apply to each sample */
264static int dig_vol_mult_r = 2 ^ 16; /* multiplicative factor to apply to each sample */ 264static int dig_vol_mult_r = 2 << 16; /* multiplicative factor to apply to each sample */
265 265void pcm_set_mixer_volume(int vol_db_l, int vol_db_r)
266void pcm_alsa_set_digital_volume(int vol_db_l, int vol_db_r)
267{ 266{
268 if(vol_db_l > 0 || vol_db_r > 0 || vol_db_l < -43 || vol_db_r < -43) 267 if(vol_db_l > 0 || vol_db_r > 0 || vol_db_l < -43 || vol_db_r < -43)
269 panicf("invalid pcm alsa volume"); 268 panicf("invalid pcm alsa volume");
@@ -336,7 +335,7 @@ static bool copy_frames(bool first)
336 { 335 {
337 /* We have to convert 16-bit to 32-bit, the need to multiply the 336 /* We have to convert 16-bit to 32-bit, the need to multiply the
338 * sample by some value so the sound is not too low */ 337 * sample by some value so the sound is not too low */
339 const short *pcm_ptr = pcm_data; 338 const int16_t *pcm_ptr = pcm_data;
340 sample_t *sample_ptr = &frames[2*(period_size-frames_left)]; 339 sample_t *sample_ptr = &frames[2*(period_size-frames_left)];
341 for (int i = 0; i < nframes; i++) 340 for (int i = 0; i < nframes; i++)
342 { 341 {
@@ -757,11 +756,6 @@ void pcm_play_dma_postinit(void)
757#endif 756#endif
758} 757}
759 758
760void pcm_set_mixer_volume(int volume)
761{
762 (void)volume;
763}
764
765int pcm_alsa_get_rate(void) 759int pcm_alsa_get_rate(void)
766{ 760{
767 return real_sample_rate; 761 return real_sample_rate;