]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fix compile errors/warnings
authorTakashi Iwai <tiwai@suse.de>
Mon, 21 Nov 2005 10:48:52 +0000 (10:48 +0000)
committerTakashi Iwai <tiwai@suse.de>
Mon, 21 Nov 2005 10:48:52 +0000 (10:48 +0000)
Fix compile errors/warnings.
omixer is removed since ordinary_mixer isn't supported any more.

test/Makefile.am
test/code.c
test/latency.c
test/midifile.c
test/oldapi.c
test/pcm.c
test/queue_timer.c
test/seq-decoder.c
test/seq-sender.c
test/seq.c

index d6cfb94e5d4acaa1e0275d634a501d5a01d2e78a..8ed1f0f0057fdbcb0f70ab70b52edab94dd6068c 100644 (file)
@@ -1,6 +1,6 @@
 check_PROGRAMS=control pcm latency seq \
               playmidi1 timer rawmidi midiloop \
-              omixer code oldapi queue_timer
+              code oldapi queue_timer
 
 control_LDADD=../src/libasound.la
 pcm_LDADD=../src/libasound.la
@@ -10,7 +10,6 @@ playmidi1_LDADD=../src/libasound.la
 timer_LDADD=../src/libasound.la
 rawmidi_LDADD=../src/libasound.la
 midiloop_LDADD=../src/libasound.la
-omixer_LDADD=../src/libasound.la
 oldapi_LDADD=../src/libasound.la
 queue_timer_LDADD=../src/libasound.la
 code_CFLAGS=-Wall -pipe -g -O2
index 2f460a483a56463591ebf05f2082d03aca8f2e2f..e2032de5ea3d3a2963d27801a05aca4f1d1146e9 100644 (file)
@@ -94,10 +94,12 @@ void mix_areas_srv(unsigned int size,
                   volatile s32 *sum,
                   unsigned int src_step, unsigned int sum_step)
 {
+       src_step /= sizeof(*src);
+       sum_step /= sizeof(*sum);
         while (size-- > 0) {
                 atomic_add(sum, *src);
-                ((char*)src) += src_step;
-                ((char*)sum) += sum_step;
+                src += src_step;
+                sum += sum_step;
         }
 }
 
@@ -105,6 +107,8 @@ void saturate(unsigned int size,
               s16 *dst, const s32 *sum,
               unsigned int dst_step, unsigned int sum_step)
 {
+       dst_step /= sizeof(*dst);
+       sum_step /= sizeof(*sum);
         while (size-- > 0) {
                 s32 sample = *sum;
                 if (unlikely(sample < -0x8000))
@@ -113,8 +117,8 @@ void saturate(unsigned int size,
                         *dst = 0x7fff;
                 else
                         *dst = sample;
-                ((char*)dst) += dst_step;
-                ((char*)sum) += sum_step;
+                dst += dst_step;
+                sum += sum_step;
         }
 }
 
@@ -125,6 +129,9 @@ void mix_areas0(unsigned int size,
                unsigned int src_step,
                unsigned int sum_step)
 {
+       dst_step /= sizeof(*dst);
+       src_step /= sizeof(*src);
+       sum_step /= sizeof(*sum);
        while (size-- > 0) {
                s32 sample = *dst + *src;
                if (unlikely(sample < -0x8000))
@@ -133,9 +140,9 @@ void mix_areas0(unsigned int size,
                        *dst = 0x7fff;
                else
                        *dst = sample;
-               ((char *)dst) += dst_step;
-               ((char *)src) += src_step;
-               ((char *)sum) += sum_step;
+               dst += dst_step;
+               src += src_step;
+               sum += sum_step;
        }
 }
 
@@ -151,6 +158,8 @@ void mix_areas2(unsigned int size,
                unsigned int dst_step,
                unsigned int src_step)
 {
+       dst_step /= sizeof(*dst);
+       src_step /= sizeof(*src);
        while (size-- > 0) {
                s32 sample = *src;
                s32 old_sample = *sum;
@@ -167,8 +176,8 @@ void mix_areas2(unsigned int size,
                                *dst = sample;
                } while (unlikely(sample != *sum));
                sum++;
-               ((char *)dst) += dst_step;
-               ((char *)src) += src_step;
+               dst += dst_step;
+               src += src_step;
        }
 }
 
index a135da874088513ce3bb0334c637b37f37f554cb..ab2efb2b1f82c62d6b59e44f8ababb3dd6f1ed30 100644 (file)
@@ -155,9 +155,9 @@ int setparams_set(snd_pcm_t *handle,
        }
        tick_time_ok = 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_tick_time(params, &ttime, NULL);
+               snd_pcm_hw_params_get_tick_time(params, &ttime, NULL);
                if (time < ttime) {
                        printf("Skipping to set minimal sleep: period time < tick time\n");
                } else if (ttime <= 0) {
@@ -476,7 +476,7 @@ void help(void)
 "-e,--effect    apply an effect (bandpass filter sweep)\n"
 );
         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);
                 if (s)
                         printf(" %s", s);
index 1858777b7207efda960b328ffa195c8b9024868a..8d6ba902e90f3de8cc9d13788cb29ec69a84b42f 100644 (file)
@@ -979,7 +979,7 @@ mf_write_midi_event (delta_time, type, chan, data, size)
     WriteVarLen (size);
 
   /* write out the data bytes */
-  for (i = 0; i < size; i++)
+  for (i = 0; i < (int)size; i++)
     eputc (data[i]);
 
   return (size);
@@ -1018,7 +1018,7 @@ mf_write_meta_event (delta_time, type, data, size)
   /* The length of the data bytes to follow */
   WriteVarLen (size);
 
-  for (i = 0; i < size; i++)
+  for (i = 0; i < (int)size; i++)
     {
       if (eputc (data[i]) != data[i])
        return (-1);
index 04fe09ae507df0c5b5b28c6620e8e0ca7e92b804..d4eb6950a7eb781bbaf5db8745f6e79093b9e070 100644 (file)
@@ -33,7 +33,7 @@
 
 typedef void (myfcn)(void *);
 
-int main(int argc, char *argv[])
+int main(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
 {
        myfcn *fcn;
        snd_pcm_hw_params_get_access(NULL);
index 95e27bf4757ff4c6fc6fcbfc75cc58c992518563..17d0034f8d905f7022171dcf4e01161965bb6e94 100644 (file)
 #include <sys/time.h>
 #include <math.h>
 
-char *device = "plughw:0,0";                   /* playback device */
-snd_pcm_format_t format = SND_PCM_FORMAT_S16;  /* sample format */
-unsigned int rate = 44100;                     /* stream rate */
-unsigned int channels = 1;                     /* count of channels */
-unsigned int buffer_time = 500000;             /* ring buffer length in us */
-unsigned int period_time = 100000;             /* period time in us */
-double freq = 440;                             /* sinusoidal wave frequency in Hz */
-int verbose = 0;                               /* verbose flag */
-int resample = 1;                              /* enable alsa-lib resampling */
-
-snd_pcm_sframes_t buffer_size;
-snd_pcm_sframes_t period_size;
-snd_output_t *output = NULL;
+static char *device = "plughw:0,0";                    /* playback device */
+static snd_pcm_format_t format = SND_PCM_FORMAT_S16;   /* sample format */
+static unsigned int rate = 44100;                      /* stream rate */
+static unsigned int channels = 1;                      /* count of channels */
+static unsigned int buffer_time = 500000;              /* ring buffer length in us */
+static unsigned int period_time = 100000;              /* period time in us */
+static double freq = 440;                              /* sinusoidal wave frequency in Hz */
+static int verbose = 0;                                /* verbose flag */
+static int resample = 1;                               /* enable alsa-lib resampling */
+
+static snd_pcm_sframes_t buffer_size;
+static snd_pcm_sframes_t period_size;
+static snd_output_t *output = NULL;
 
 static void generate_sine(const snd_pcm_channel_area_t *areas, 
                          snd_pcm_uframes_t offset,
@@ -61,7 +61,7 @@ static void generate_sine(const snd_pcm_channel_area_t *areas,
                ires = res;
                tmp = (unsigned char *)(&ires);
                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] += steps[chn];
                }
@@ -77,6 +77,7 @@ static int set_hwparams(snd_pcm_t *handle,
                        snd_pcm_access_t access)
 {
        unsigned int rrate;
+       snd_pcm_uframes_t size;
        int err, dir;
 
        /* 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));
                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) {
                printf("Unable to get buffer size for playback: %s\n", snd_strerror(err));
                return err;
        }
+       buffer_size = size;
        /* set the period time */
        err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir);
        if (err < 0) {
                printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(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) {
                printf("Unable to get period size for playback: %s\n", snd_strerror(err));
                return err;
        }
+       period_size = size;
        /* write the parameters to device */
        err = snd_pcm_hw_params(handle, params);
        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,
-                            signed short *samples,
-                            snd_pcm_channel_area_t *areas)
+                            signed short *samples ATTRIBUTE_UNUSED,
+                            snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED)
 {
        struct async_private_data data;
        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,
-                      signed short *samples,
-                      snd_pcm_channel_area_t *areas)
+                      signed short *samples ATTRIBUTE_UNUSED,
+                      snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED)
 {
        double phase = 0;
        const snd_pcm_channel_area_t *my_areas;
@@ -716,7 +719,7 @@ static void help(void)
 "-v,--verbose   show the PCM setup parameters\n"
 "\n");
         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);
                 if (s)
                         printf(" %s", s);
index cca0132556c8bcc1e3b27edf70beb42ee2d26cc8..c4ffb19211d309d5cf11385d954e1f556cd9cc89 100644 (file)
@@ -18,19 +18,22 @@ void normalize(struct timeval *tv)
 }
 
 int
-main(int argc, char **argv)
+main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 {
     snd_seq_t *handle;
     int portid;
-    int npfd;
-    struct pollfd *pfd;
+    /* int npfd;
+       struct pollfd *pfd;
+    */
     int queue;
-    int i;
-    int rval;
+    /* int i;
+       int rval;'
+    */
     struct timeval starttv, prevdiff;
     int countdown = -1;
-    snd_seq_queue_timer_t *timer;
-    snd_timer_id_t *timerid;
+    /* snd_seq_queue_timer_t *timer;
+       snd_timer_id_t *timerid;
+    */
 
     if (snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
        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",
                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,
-               diffdiff.tv_sec, diffdiff.tv_usec);
+               (long)diffdiff.tv_sec, (long)diffdiff.tv_usec);
 
        if (diffdiff.tv_usec >  5000 ||
            diffdiff.tv_usec < -5000) {
index c43c73476e0b195ecbc3189250de33b06b809ff3..3a1ed313422593ac8862a5138d6c5350dd99984e 100644 (file)
@@ -241,7 +241,9 @@ int decode_event(snd_seq_event_t * ev)
        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;
 
index 0dbc46459fed6a721121211f7d1b69beef6f68fb..5d8ac92c0d760477d216fe92bb1dfc15db182940 100644 (file)
@@ -65,7 +65,10 @@ void set_hwparams(snd_pcm_t *phandle)
  *  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;
        
index f18a6fa43a219e9300aed9cb9321584f03a11fb1..34b000fd879f5feee04338b80062e8f393b2b18c 100644 (file)
@@ -49,7 +49,7 @@ void system_info(snd_seq_t *handle)
        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("  Max queues    : %i\n", max_queues);