mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-28 05:40:23 -04:00
Fix compile errors/warnings
Fix compile errors/warnings. omixer is removed since ordinary_mixer isn't supported any more.
This commit is contained in:
parent
8495f42feb
commit
84ebfe7c92
10 changed files with 68 additions and 49 deletions
|
|
@ -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
|
||||
|
|
|
|||
27
test/code.c
27
test/code.c
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ 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);
|
||||
if (time < ttime) {
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
43
test/pcm.c
43
test/pcm.c
|
|
@ -12,19 +12,19 @@
|
|||
#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 */
|
||||
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 */
|
||||
|
||||
snd_pcm_sframes_t buffer_size;
|
||||
snd_pcm_sframes_t period_size;
|
||||
snd_output_t *output = NULL;
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
/* 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_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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue