--- TiMidity++-2.14.0/timidity/alsa_a.c +++ TiMidity++-2.14.0-alsa/timidity/alsa_a.c @@ -42,8 +42,6 @@ /*ALSA header file*/ #if HAVE_ALSA_ASOUNDLIB_H -#define ALSA_PCM_OLD_HW_PARAMS_API -#define ALSA_PCM_OLD_SW_PARAMS_API #include #else #include @@ -112,8 +110,8 @@ static snd_pcm_t* handle = NULL; static int card = 0; static int device = 0; #endif -static int total_bytes = -1; -static int frag_size = 0; +static snd_pcm_uframes_t total_bytes = -1; +static snd_pcm_uframes_t frag_size = 0; static int sample_shift = 0; static int output_counter; @@ -289,8 +287,9 @@ static int open_output(void) { int orig_rate = dpm.rate; int ret_val = 0; - int tmp, frags, r, pfds; + int frags, r, pfds; int rate; + snd_pcm_uframes_t tmp; snd_pcm_hw_params_t *pinfo; snd_pcm_sw_params_t *swpinfo; @@ -370,17 +369,18 @@ static int open_output(void) } /*check rate*/ - r = snd_pcm_hw_params_get_rate_min(pinfo, NULL); - if (r >= 0 && r > dpm.rate) { + int ok = -1; + ok = snd_pcm_hw_params_get_rate_min(pinfo, &r, NULL); + if (ok == 0 && r >= 0 && r > dpm.rate) { dpm.rate = r; ret_val = 1; } - r = snd_pcm_hw_params_get_rate_max(pinfo, NULL); - if (r >= 0 && r < dpm.rate) { + ok = snd_pcm_hw_params_get_rate_max(pinfo, &r, NULL); + if (ok == 0 && r >= 0 && r < dpm.rate) { dpm.rate = r; ret_val = 1; } - if ((rate = snd_pcm_hw_params_set_rate_near(handle, pinfo, dpm.rate, 0)) < 0) { + if (snd_pcm_hw_params_set_rate_near(handle, pinfo, &(dpm.rate), 0) < 0) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "ALSA pcm '%s' can't set rate %d", alsa_device_name(), dpm.rate); @@ -437,7 +437,8 @@ static int open_output(void) ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "Requested buffer size %d, fragment size %d", total_bytes, frag_size); - if ((tmp = snd_pcm_hw_params_set_buffer_size_near(handle, pinfo, total_bytes >> sample_shift)) < 0) { + tmp = total_bytes >> sample_shift; + if (snd_pcm_hw_params_set_buffer_size_near(handle, pinfo, &tmp) < 0) { ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "ALSA pcm '%s' can't set buffer size %d", alsa_device_name(), total_bytes); @@ -445,7 +446,8 @@ static int open_output(void) return -1; } - if ((tmp = snd_pcm_hw_params_set_period_size_near(handle, pinfo, frag_size >> sample_shift, 0)) < 0) { + tmp = frag_size >> sample_shift; + if (snd_pcm_hw_params_set_period_size_near(handle, pinfo, &tmp, 0) < 0) { ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "ALSA pcm '%s' can't set period size %d", alsa_device_name(), frag_size); @@ -463,14 +465,17 @@ static int open_output(void) return -1; } - total_bytes = snd_pcm_hw_params_get_buffer_size(pinfo) << sample_shift; - frag_size = snd_pcm_hw_params_get_period_size(pinfo, NULL) << sample_shift; + snd_pcm_hw_params_get_buffer_size(pinfo, &total_bytes); + total_bytes <<= sample_shift; + snd_pcm_hw_params_get_period_size(pinfo, &frag_size, NULL); + frag_size <<= sample_shift; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "ALSA pcm '%s' set buffer size %d, period size %d bytes", alsa_device_name(), total_bytes, frag_size); - tmp = snd_pcm_hw_params_get_rate(pinfo, NULL); - if (tmp > 0 && tmp != dpm.rate) { - dpm.rate = tmp; + unsigned int tmp2; + ok = snd_pcm_hw_params_get_rate(pinfo, &tmp2, NULL); + if (ok == 0 && tmp2 > 0 && tmp2 != dpm.rate) { + dpm.rate = tmp2; ret_val = 1; } if (orig_rate != dpm.rate) { Binary files TiMidity++-2.14.0/timidity/alsa_a.o and TiMidity++-2.14.0-alsa/timidity/alsa_a.o differ