Fix compile errors/warnings.
omixer is removed since ordinary_mixer isn't supported any more.
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
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
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;
}
}
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))
*dst = 0x7fff;
else
*dst = sample;
- ((char*)dst) += dst_step;
- ((char*)sum) += sum_step;
+ dst += dst_step;
+ sum += sum_step;
}
}
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))
*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;
}
}
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;
*dst = sample;
} while (unlikely(sample != *sum));
sum++;
- ((char *)dst) += dst_step;
- ((char *)src) += src_step;
+ dst += dst_step;
+ src += src_step;
}
}
}
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) {
"-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);
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);
/* 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);
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);
#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,
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];
}
snd_pcm_access_t access)
{
unsigned int rrate;
+ snd_pcm_uframes_t size;
int err, dir;
/* choose all parameters */
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) {
}
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;
*/
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;
"-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);
}
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");
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) {
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;
* 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;
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);