Fix compile errors/warnings

Fix compile errors/warnings.
omixer is removed since ordinary_mixer isn't supported any more.
This commit is contained in:
Takashi Iwai 2005-11-21 10:48:52 +00:00
parent 8495f42feb
commit 84ebfe7c92
10 changed files with 68 additions and 49 deletions

View file

@ -1,6 +1,6 @@
check_PROGRAMS=control pcm latency seq \ check_PROGRAMS=control pcm latency seq \
playmidi1 timer rawmidi midiloop \ playmidi1 timer rawmidi midiloop \
omixer code oldapi queue_timer code oldapi queue_timer
control_LDADD=../src/libasound.la control_LDADD=../src/libasound.la
pcm_LDADD=../src/libasound.la pcm_LDADD=../src/libasound.la
@ -10,7 +10,6 @@ playmidi1_LDADD=../src/libasound.la
timer_LDADD=../src/libasound.la timer_LDADD=../src/libasound.la
rawmidi_LDADD=../src/libasound.la rawmidi_LDADD=../src/libasound.la
midiloop_LDADD=../src/libasound.la midiloop_LDADD=../src/libasound.la
omixer_LDADD=../src/libasound.la
oldapi_LDADD=../src/libasound.la oldapi_LDADD=../src/libasound.la
queue_timer_LDADD=../src/libasound.la queue_timer_LDADD=../src/libasound.la
code_CFLAGS=-Wall -pipe -g -O2 code_CFLAGS=-Wall -pipe -g -O2

View file

@ -94,10 +94,12 @@ void mix_areas_srv(unsigned int size,
volatile s32 *sum, volatile s32 *sum,
unsigned int src_step, unsigned int sum_step) unsigned int src_step, unsigned int sum_step)
{ {
src_step /= sizeof(*src);
sum_step /= sizeof(*sum);
while (size-- > 0) { while (size-- > 0) {
atomic_add(sum, *src); atomic_add(sum, *src);
((char*)src) += src_step; src += src_step;
((char*)sum) += sum_step; sum += sum_step;
} }
} }
@ -105,6 +107,8 @@ void saturate(unsigned int size,
s16 *dst, const s32 *sum, s16 *dst, const s32 *sum,
unsigned int dst_step, unsigned int sum_step) unsigned int dst_step, unsigned int sum_step)
{ {
dst_step /= sizeof(*dst);
sum_step /= sizeof(*sum);
while (size-- > 0) { while (size-- > 0) {
s32 sample = *sum; s32 sample = *sum;
if (unlikely(sample < -0x8000)) if (unlikely(sample < -0x8000))
@ -113,8 +117,8 @@ void saturate(unsigned int size,
*dst = 0x7fff; *dst = 0x7fff;
else else
*dst = sample; *dst = sample;
((char*)dst) += dst_step; dst += dst_step;
((char*)sum) += sum_step; sum += sum_step;
} }
} }
@ -125,6 +129,9 @@ void mix_areas0(unsigned int size,
unsigned int src_step, unsigned int src_step,
unsigned int sum_step) unsigned int sum_step)
{ {
dst_step /= sizeof(*dst);
src_step /= sizeof(*src);
sum_step /= sizeof(*sum);
while (size-- > 0) { while (size-- > 0) {
s32 sample = *dst + *src; s32 sample = *dst + *src;
if (unlikely(sample < -0x8000)) if (unlikely(sample < -0x8000))
@ -133,9 +140,9 @@ void mix_areas0(unsigned int size,
*dst = 0x7fff; *dst = 0x7fff;
else else
*dst = sample; *dst = sample;
((char *)dst) += dst_step; dst += dst_step;
((char *)src) += src_step; src += src_step;
((char *)sum) += sum_step; sum += sum_step;
} }
} }
@ -151,6 +158,8 @@ void mix_areas2(unsigned int size,
unsigned int dst_step, unsigned int dst_step,
unsigned int src_step) unsigned int src_step)
{ {
dst_step /= sizeof(*dst);
src_step /= sizeof(*src);
while (size-- > 0) { while (size-- > 0) {
s32 sample = *src; s32 sample = *src;
s32 old_sample = *sum; s32 old_sample = *sum;
@ -167,8 +176,8 @@ void mix_areas2(unsigned int size,
*dst = sample; *dst = sample;
} while (unlikely(sample != *sum)); } while (unlikely(sample != *sum));
sum++; sum++;
((char *)dst) += dst_step; dst += dst_step;
((char *)src) += src_step; src += src_step;
} }
} }

View file

@ -155,9 +155,9 @@ int setparams_set(snd_pcm_t *handle,
} }
tick_time_ok = 0; tick_time_ok = 0;
if (tick_time > 0) { if (tick_time > 0) {
int time, ttime; unsigned int time, ttime;
snd_pcm_hw_params_get_period_time(params, &time, NULL); snd_pcm_hw_params_get_period_time(params, &time, NULL);
snd_pcm_hw_params_get_tick_time(params, &ttime, NULL); snd_pcm_hw_params_get_tick_time(params, &ttime, NULL);
if (time < ttime) { if (time < ttime) {
printf("Skipping to set minimal sleep: period time < tick time\n"); printf("Skipping to set minimal sleep: period time < tick time\n");
} else if (ttime <= 0) { } else if (ttime <= 0) {
@ -476,7 +476,7 @@ void help(void)
"-e,--effect apply an effect (bandpass filter sweep)\n" "-e,--effect apply an effect (bandpass filter sweep)\n"
); );
printf("Recognized sample formats are:"); printf("Recognized sample formats are:");
for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) { for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
const char *s = snd_pcm_format_name(k); const char *s = snd_pcm_format_name(k);
if (s) if (s)
printf(" %s", s); printf(" %s", s);

View file

@ -979,7 +979,7 @@ mf_write_midi_event (delta_time, type, chan, data, size)
WriteVarLen (size); WriteVarLen (size);
/* write out the data bytes */ /* write out the data bytes */
for (i = 0; i < size; i++) for (i = 0; i < (int)size; i++)
eputc (data[i]); eputc (data[i]);
return (size); return (size);
@ -1018,7 +1018,7 @@ mf_write_meta_event (delta_time, type, data, size)
/* The length of the data bytes to follow */ /* The length of the data bytes to follow */
WriteVarLen (size); WriteVarLen (size);
for (i = 0; i < size; i++) for (i = 0; i < (int)size; i++)
{ {
if (eputc (data[i]) != data[i]) if (eputc (data[i]) != data[i])
return (-1); return (-1);

View file

@ -33,7 +33,7 @@
typedef void (myfcn)(void *); typedef void (myfcn)(void *);
int main(int argc, char *argv[]) int main(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
{ {
myfcn *fcn; myfcn *fcn;
snd_pcm_hw_params_get_access(NULL); snd_pcm_hw_params_get_access(NULL);

View file

@ -12,19 +12,19 @@
#include <sys/time.h> #include <sys/time.h>
#include <math.h> #include <math.h>
char *device = "plughw:0,0"; /* playback device */ static char *device = "plughw:0,0"; /* playback device */
snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */
unsigned int rate = 44100; /* stream rate */ static unsigned int rate = 44100; /* stream rate */
unsigned int channels = 1; /* count of channels */ static unsigned int channels = 1; /* count of channels */
unsigned int buffer_time = 500000; /* ring buffer length in us */ static unsigned int buffer_time = 500000; /* ring buffer length in us */
unsigned int period_time = 100000; /* period time in us */ static unsigned int period_time = 100000; /* period time in us */
double freq = 440; /* sinusoidal wave frequency in Hz */ static double freq = 440; /* sinusoidal wave frequency in Hz */
int verbose = 0; /* verbose flag */ static int verbose = 0; /* verbose flag */
int resample = 1; /* enable alsa-lib resampling */ static int resample = 1; /* enable alsa-lib resampling */
snd_pcm_sframes_t buffer_size; static snd_pcm_sframes_t buffer_size;
snd_pcm_sframes_t period_size; static snd_pcm_sframes_t period_size;
snd_output_t *output = NULL; static snd_output_t *output = NULL;
static void generate_sine(const snd_pcm_channel_area_t *areas, static void generate_sine(const snd_pcm_channel_area_t *areas,
snd_pcm_uframes_t offset, snd_pcm_uframes_t offset,
@ -61,7 +61,7 @@ static void generate_sine(const snd_pcm_channel_area_t *areas,
ires = res; ires = res;
tmp = (unsigned char *)(&ires); tmp = (unsigned char *)(&ires);
for (chn = 0; chn < channels; chn++) { for (chn = 0; chn < channels; chn++) {
for (byte = 0; byte < bps; byte++) for (byte = 0; byte < (unsigned int)bps; byte++)
*(samples[chn] + byte) = tmp[byte]; *(samples[chn] + byte) = tmp[byte];
samples[chn] += steps[chn]; samples[chn] += steps[chn];
} }
@ -77,6 +77,7 @@ static int set_hwparams(snd_pcm_t *handle,
snd_pcm_access_t access) snd_pcm_access_t access)
{ {
unsigned int rrate; unsigned int rrate;
snd_pcm_uframes_t size;
int err, dir; int err, dir;
/* choose all parameters */ /* choose all parameters */
@ -126,22 +127,24 @@ static int set_hwparams(snd_pcm_t *handle,
printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err)); printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err));
return err; return err;
} }
err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size); err = snd_pcm_hw_params_get_buffer_size(params, &size);
if (err < 0) { if (err < 0) {
printf("Unable to get buffer size for playback: %s\n", snd_strerror(err)); printf("Unable to get buffer size for playback: %s\n", snd_strerror(err));
return err; return err;
} }
buffer_size = size;
/* set the period time */ /* set the period time */
err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir);
if (err < 0) { if (err < 0) {
printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err)); printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err));
return err; return err;
} }
err = snd_pcm_hw_params_get_period_size(params, &period_size, &dir); err = snd_pcm_hw_params_get_period_size(params, &size, &dir);
if (err < 0) { if (err < 0) {
printf("Unable to get period size for playback: %s\n", snd_strerror(err)); printf("Unable to get period size for playback: %s\n", snd_strerror(err));
return err; return err;
} }
period_size = size;
/* write the parameters to device */ /* write the parameters to device */
err = snd_pcm_hw_params(handle, params); err = snd_pcm_hw_params(handle, params);
if (err < 0) { if (err < 0) {
@ -504,8 +507,8 @@ static void async_direct_callback(snd_async_handler_t *ahandler)
} }
static int async_direct_loop(snd_pcm_t *handle, static int async_direct_loop(snd_pcm_t *handle,
signed short *samples, signed short *samples ATTRIBUTE_UNUSED,
snd_pcm_channel_area_t *areas) snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED)
{ {
struct async_private_data data; struct async_private_data data;
snd_async_handler_t *ahandler; snd_async_handler_t *ahandler;
@ -562,8 +565,8 @@ static int async_direct_loop(snd_pcm_t *handle,
*/ */
static int direct_loop(snd_pcm_t *handle, static int direct_loop(snd_pcm_t *handle,
signed short *samples, signed short *samples ATTRIBUTE_UNUSED,
snd_pcm_channel_area_t *areas) snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED)
{ {
double phase = 0; double phase = 0;
const snd_pcm_channel_area_t *my_areas; const snd_pcm_channel_area_t *my_areas;
@ -716,7 +719,7 @@ static void help(void)
"-v,--verbose show the PCM setup parameters\n" "-v,--verbose show the PCM setup parameters\n"
"\n"); "\n");
printf("Recognized sample formats are:"); printf("Recognized sample formats are:");
for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) { for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
const char *s = snd_pcm_format_name(k); const char *s = snd_pcm_format_name(k);
if (s) if (s)
printf(" %s", s); printf(" %s", s);

View file

@ -18,19 +18,22 @@ void normalize(struct timeval *tv)
} }
int int
main(int argc, char **argv) main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
{ {
snd_seq_t *handle; snd_seq_t *handle;
int portid; int portid;
int npfd; /* int npfd;
struct pollfd *pfd; struct pollfd *pfd;
*/
int queue; int queue;
int i; /* int i;
int rval; int rval;'
*/
struct timeval starttv, prevdiff; struct timeval starttv, prevdiff;
int countdown = -1; int countdown = -1;
snd_seq_queue_timer_t *timer; /* snd_seq_queue_timer_t *timer;
snd_timer_id_t *timerid; snd_timer_id_t *timerid;
*/
if (snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) { if (snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
fprintf(stderr, "failed to open ALSA sequencer interface\n"); fprintf(stderr, "failed to open ALSA sequencer interface\n");
@ -98,9 +101,9 @@ main(int argc, char **argv)
fprintf(stderr, " real time: %12ld sec %8ld usec\nqueue time: %12ld sec %8ld usec\n diff: %12ld sec %8ld usec\n diffdiff: %12ld sec %8ld usec\n", fprintf(stderr, " real time: %12ld sec %8ld usec\nqueue time: %12ld sec %8ld usec\n diff: %12ld sec %8ld usec\n diffdiff: %12ld sec %8ld usec\n",
tv.tv_sec, tv.tv_usec, tv.tv_sec, tv.tv_usec,
rtime->tv_sec, rtime->tv_nsec / 1000, (long)rtime->tv_sec, (long)rtime->tv_nsec / 1000,
diff.tv_sec, diff.tv_usec, diff.tv_sec, diff.tv_usec,
diffdiff.tv_sec, diffdiff.tv_usec); (long)diffdiff.tv_sec, (long)diffdiff.tv_usec);
if (diffdiff.tv_usec > 5000 || if (diffdiff.tv_usec > 5000 ||
diffdiff.tv_usec < -5000) { diffdiff.tv_usec < -5000) {

View file

@ -241,7 +241,9 @@ int decode_event(snd_seq_event_t * ev)
return 0; return 0;
} }
void event_decoder_start_timer(snd_seq_t *handle, int queue, int client, int port) void event_decoder_start_timer(snd_seq_t *handle, int queue,
int client ATTRIBUTE_UNUSED,
int port ATTRIBUTE_UNUSED)
{ {
int err; int err;

View file

@ -65,7 +65,10 @@ void set_hwparams(snd_pcm_t *phandle)
* Simple event sender * Simple event sender
*/ */
void event_sender_start_timer(snd_seq_t *handle, int client, int queue, snd_pcm_t *phandle) void event_sender_start_timer(snd_seq_t *handle,
int client ATTRIBUTE_UNUSED,
int queue,
snd_pcm_t *phandle ATTRIBUTE_UNUSED)
{ {
int err; int err;

View file

@ -49,7 +49,7 @@ void system_info(snd_seq_t *handle)
max_queues = snd_seq_system_info_get_ports(sysinfo); max_queues = snd_seq_system_info_get_ports(sysinfo);
} }
void show_system_info(snd_seq_t *handle) void show_system_info(snd_seq_t *handle ATTRIBUTE_UNUSED)
{ {
printf("System info\n"); printf("System info\n");
printf(" Max queues : %i\n", max_queues); printf(" Max queues : %i\n", max_queues);