]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Changed data type of alsa-lib handles from 'void *' to the specific type for
authorFrank van de Pol <fvdpol@home.nl>
Wed, 2 Jun 1999 00:40:30 +0000 (00:40 +0000)
committerFrank van de Pol <fvdpol@home.nl>
Wed, 2 Jun 1999 00:40:30 +0000 (00:40 +0000)
the handle in use. This should be more type-safe as the compiler will perform
checking on type now.

15 files changed:
include/control.h
include/mixer.h
include/pcm.h
include/rawmidi.h
include/seq.h
include/timer.h
src/control/cards.c
src/control/control.c
src/mixer/elements.c
src/mixer/mixer.c
src/pcm/pcm.c
src/pcm/pcm_loopback.c
src/rawmidi/rawmidi.c
src/seq/seq.c
src/timer/timer.c

index 5fa336edb39aa335d3fec14164111fb916dcc2a8..313f05975c259ec1f8cbc02837e87dec03e125bc 100644 (file)
@@ -16,6 +16,8 @@ typedef struct snd_ctl_callbacks {
 extern "C" {
 #endif
 
+typedef struct snd_ctl snd_ctl_t;
+
 int snd_card_load(int card);
 int snd_cards(void);
 unsigned int snd_cards_mask(void);
@@ -29,36 +31,36 @@ int snd_defaults_pcm_device(void);
 int snd_defaults_rawmidi_card(void);
 int snd_defaults_rawmidi_device(void);
 
-int snd_ctl_open(void **handle, int card);
-int snd_ctl_close(void *handle);
-int snd_ctl_file_descriptor(void *handle);
-int snd_ctl_hw_info(void *handle, struct snd_ctl_hw_info *info);
-int snd_ctl_switch_list(void *handle, snd_switch_list_t * list);
-int snd_ctl_switch_read(void *handle, snd_switch_t * sw);
-int snd_ctl_switch_write(void *handle, snd_switch_t * sw);
-int snd_ctl_pcm_info(void *handle, int dev, snd_pcm_info_t * info);
-int snd_ctl_pcm_playback_info(void *handle, int dev, snd_pcm_playback_info_t * info);
-int snd_ctl_pcm_record_info(void *handle, int dev, snd_pcm_record_info_t * info);
-int snd_ctl_pcm_playback_switch_list(void *handle, int dev, snd_switch_list_t * list);
-int snd_ctl_pcm_playback_switch_read(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_pcm_playback_switch_write(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_pcm_record_switch_list(void *handle, int dev, snd_switch_list_t * list);
-int snd_ctl_pcm_record_switch_read(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_pcm_record_switch_write(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_mixer_info(void *handle, int dev, snd_mixer_info_t * info);
-int snd_ctl_mixer_switch_list(void *handle, int dev, snd_switch_list_t *list);
-int snd_ctl_mixer_switch_read(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_mixer_switch_write(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_rawmidi_info(void *handle, int dev, snd_rawmidi_info_t * info);
-int snd_ctl_rawmidi_output_info(void *handle, int dev, snd_rawmidi_output_info_t * info);
-int snd_ctl_rawmidi_input_info(void *handle, int dev, snd_rawmidi_input_info_t * info);
-int snd_ctl_rawmidi_output_switch_list(void *handle, int dev, snd_switch_list_t *list);
-int snd_ctl_rawmidi_output_switch_read(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_rawmidi_output_switch_write(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_rawmidi_input_switch_list(void *handle, int dev, snd_switch_list_t *list);
-int snd_ctl_rawmidi_input_switch_read(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_rawmidi_input_switch_write(void *handle, int dev, snd_switch_t * sw);
-int snd_ctl_read(void *handle, snd_ctl_callbacks_t * callbacks);
+int snd_ctl_open(snd_ctl_t **handle, int card);
+int snd_ctl_close(snd_ctl_t *handle);
+int snd_ctl_file_descriptor(snd_ctl_t *handle);
+int snd_ctl_hw_info(snd_ctl_t *handle, struct snd_ctl_hw_info *info);
+int snd_ctl_switch_list(snd_ctl_t *handle, snd_switch_list_t * list);
+int snd_ctl_switch_read(snd_ctl_t *handle, snd_switch_t * sw);
+int snd_ctl_switch_write(snd_ctl_t *handle, snd_switch_t * sw);
+int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info);
+int snd_ctl_pcm_playback_info(snd_ctl_t *handle, int dev, snd_pcm_playback_info_t * info);
+int snd_ctl_pcm_record_info(snd_ctl_t *handle, int dev, snd_pcm_record_info_t * info);
+int snd_ctl_pcm_playback_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t * list);
+int snd_ctl_pcm_playback_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_pcm_playback_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_pcm_record_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t * list);
+int snd_ctl_pcm_record_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_pcm_record_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_mixer_info(snd_ctl_t *handle, int dev, snd_mixer_info_t * info);
+int snd_ctl_mixer_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list);
+int snd_ctl_mixer_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_mixer_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_rawmidi_info(snd_ctl_t *handle, int dev, snd_rawmidi_info_t * info);
+int snd_ctl_rawmidi_output_info(snd_ctl_t *handle, int dev, snd_rawmidi_output_info_t * info);
+int snd_ctl_rawmidi_input_info(snd_ctl_t *handle, int dev, snd_rawmidi_input_info_t * info);
+int snd_ctl_rawmidi_output_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list);
+int snd_ctl_rawmidi_output_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_rawmidi_output_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_rawmidi_input_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list);
+int snd_ctl_rawmidi_input_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_rawmidi_input_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw);
+int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks);
 
 #ifdef __cplusplus
 }
index 4bcf6a7c65cac0d59262b9309e567526cb61353d..feb54aaec3fbbf554cc51b840998fbba93a0555e 100644 (file)
@@ -17,27 +17,29 @@ typedef struct snd_mixer_callbacks {
 extern "C" {
 #endif
 
-int snd_mixer_open(void **handle, int card, int device);
-int snd_mixer_close(void *handle);
-int snd_mixer_file_descriptor(void *handle);
-int snd_mixer_info(void *handle, snd_mixer_info_t * info);
-int snd_mixer_elements(void *handle, snd_mixer_elements_t * elements);
-int snd_mixer_routes(void *handle, snd_mixer_routes_t * routes);
-int snd_mixer_groups(void *handle, snd_mixer_groups_t * groups);
-int snd_mixer_group(void *handle, snd_mixer_group_t * group);
-int snd_mixer_element_info(void *handle, snd_mixer_element_info_t * info);
-int snd_mixer_element_read(void *handle, snd_mixer_element_t * element);
-int snd_mixer_element_write(void *handle, snd_mixer_element_t * element);
-int snd_mixer_read(void *handle, snd_mixer_callbacks_t * callbacks);
+typedef struct snd_mixer snd_mixer_t;
+
+int snd_mixer_open(snd_mixer_t **handle, int card, int device);
+int snd_mixer_close(snd_mixer_t *handle);
+int snd_mixer_file_descriptor(snd_mixer_t *handle);
+int snd_mixer_info(snd_mixer_t *handle, snd_mixer_info_t * info);
+int snd_mixer_elements(snd_mixer_t *handle, snd_mixer_elements_t * elements);
+int snd_mixer_routes(snd_mixer_t *handle, snd_mixer_routes_t * routes);
+int snd_mixer_groups(snd_mixer_t *handle, snd_mixer_groups_t * groups);
+int snd_mixer_group(snd_mixer_t *handle, snd_mixer_group_t * group);
+int snd_mixer_element_info(snd_mixer_t *handle, snd_mixer_element_info_t * info);
+int snd_mixer_element_read(snd_mixer_t *handle, snd_mixer_element_t * element);
+int snd_mixer_element_write(snd_mixer_t *handle, snd_mixer_element_t * element);
+int snd_mixer_read(snd_mixer_t *handle, snd_mixer_callbacks_t * callbacks);
 
 void snd_mixer_set_bit(unsigned int *bitmap, int bit, int val);
 int snd_mixer_get_bit(unsigned int *bitmap, int bit);
 
 int snd_mixer_element_has_info(snd_mixer_eid_t *eid);
-int snd_mixer_element_info_build(void *handle, snd_mixer_element_info_t * info);
+int snd_mixer_element_info_build(snd_mixer_t *handle, snd_mixer_element_info_t * info);
 int snd_mixer_element_info_free(snd_mixer_element_info_t * info);
 int snd_mixer_element_has_control(snd_mixer_eid_t *eid);
-int snd_mixer_element_build(void *handle, snd_mixer_element_t * element);
+int snd_mixer_element_build(snd_mixer_t *handle, snd_mixer_element_t * element);
 int snd_mixer_element_free(snd_mixer_element_t * element);
 
 #ifdef __cplusplus
index a56badc6f55e0b925d5d662c232cfa6f0aecffd1..ae83ca8eed433956b47e7aee798647eea476ff11 100644 (file)
 extern "C" {
 #endif
 
-int snd_pcm_open(void **handle, int card, int device, int mode);
-int snd_pcm_close(void *handle);
-int snd_pcm_file_descriptor(void *handle);
-int snd_pcm_block_mode(void *handle, int enable);
-int snd_pcm_info(void *handle, snd_pcm_info_t * info);
-int snd_pcm_playback_info(void *handle, snd_pcm_playback_info_t * info);
-int snd_pcm_record_info(void *handle, snd_pcm_record_info_t * info);
-int snd_pcm_playback_format(void *handle, snd_pcm_format_t * format);
-int snd_pcm_record_format(void *handle, snd_pcm_format_t * format);
-int snd_pcm_playback_params(void *handle, snd_pcm_playback_params_t * params);
-int snd_pcm_record_params(void *handle, snd_pcm_record_params_t * params);
-int snd_pcm_playback_status(void *handle, snd_pcm_playback_status_t * status);
-int snd_pcm_record_status(void *handle, snd_pcm_record_status_t * status);
-int snd_pcm_drain_playback(void *handle);
-int snd_pcm_flush_playback(void *handle);
-int snd_pcm_flush_record(void *handle);
-int snd_pcm_playback_pause(void *handle, int enable);
-int snd_pcm_playback_time(void *handle, int enable);
-int snd_pcm_record_time(void *handle, int enable);
-ssize_t snd_pcm_write(void *handle, const void *buffer, size_t size);
-ssize_t snd_pcm_read(void *handle, void *buffer, size_t size);
+typedef struct snd_pcm snd_pcm_t;
+typedef struct snd_pcm_loopback snd_pcm_loopback_t;
+
+int snd_pcm_open(snd_pcm_t **handle, int card, int device, int mode);
+int snd_pcm_close(snd_pcm_t *handle);
+int snd_pcm_file_descriptor(snd_pcm_t *handle);
+int snd_pcm_block_mode(snd_pcm_t *handle, int enable);
+int snd_pcm_info(snd_pcm_t *handle, snd_pcm_info_t * info);
+int snd_pcm_playback_info(snd_pcm_t *handle, snd_pcm_playback_info_t * info);
+int snd_pcm_record_info(snd_pcm_t *handle, snd_pcm_record_info_t * info);
+int snd_pcm_playback_format(snd_pcm_t *handle, snd_pcm_format_t * format);
+int snd_pcm_record_format(snd_pcm_t *handle, snd_pcm_format_t * format);
+int snd_pcm_playback_params(snd_pcm_t *handle, snd_pcm_playback_params_t * params);
+int snd_pcm_record_params(snd_pcm_t *handle, snd_pcm_record_params_t * params);
+int snd_pcm_playback_status(snd_pcm_t *handle, snd_pcm_playback_status_t * status);
+int snd_pcm_record_status(snd_pcm_t *handle, snd_pcm_record_status_t * status);
+int snd_pcm_drain_playback(snd_pcm_t *handle);
+int snd_pcm_flush_playback(snd_pcm_t *handle);
+int snd_pcm_flush_record(snd_pcm_t *handle);
+int snd_pcm_playback_pause(snd_pcm_t *handle, int enable);
+int snd_pcm_playback_time(snd_pcm_t *handle, int enable);
+int snd_pcm_record_time(snd_pcm_t *handle, int enable);
+ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size);
+ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size);
 
 #ifdef __cplusplus
 }
@@ -46,13 +49,13 @@ ssize_t snd_pcm_read(void *handle, void *buffer, size_t size);
 extern "C" {
 #endif
 
-int snd_pcm_loopback_open(void **handle, int card, int device, int mode);
-int snd_pcm_loopback_close(void *handle);
-int snd_pcm_loopback_file_descriptor(void *handle);
-int snd_pcm_loopback_block_mode(void *handle, int enable);
-int snd_pcm_loopback_stream_mode(void *handle, int mode);
-int snd_pcm_loopback_format(void *handle, snd_pcm_format_t * format);
-ssize_t snd_pcm_loopback_read(void *handle, void *buffer, size_t size);
+int snd_pcm_loopback_open(snd_pcm_loopback_t **handle, int card, int device, int mode);
+int snd_pcm_loopback_close(snd_pcm_loopback_t *handle);
+int snd_pcm_loopback_file_descriptor(snd_pcm_loopback_t *handle);
+int snd_pcm_loopback_block_mode(snd_pcm_loopback_t *handle, int enable);
+int snd_pcm_loopback_stream_mode(snd_pcm_loopback_t *handle, int mode);
+int snd_pcm_loopback_format(snd_pcm_loopback_t *handle, snd_pcm_format_t * format);
+ssize_t snd_pcm_loopback_read(snd_pcm_loopback_t *handle, void *buffer, size_t size);
 
 #ifdef __cplusplus
 }
index 53278279fba8d0d4e8388f444eb6a92580d9c1e9..74262412b95ad434a17f43b4f06fd0b9aa06db81 100644 (file)
 extern "C" {
 #endif
 
-int snd_rawmidi_open(void **handle, int card, int device, int mode);
-int snd_rawmidi_close(void *handle);
-int snd_rawmidi_file_descriptor(void *handle);
-int snd_rawmidi_block_mode(void *handle, int enable);
-int snd_rawmidi_info(void *handle, snd_rawmidi_info_t * info);
-int snd_rawmidi_output_params(void *handle, snd_rawmidi_output_params_t * params);
-int snd_rawmidi_input_params(void *handle, snd_rawmidi_input_params_t * params);
-int snd_rawmidi_output_status(void *handle, snd_rawmidi_output_status_t * status);
-int snd_rawmidi_input_status(void *handle, snd_rawmidi_input_status_t * status);
-int snd_rawmidi_drain_output(void *handle);
-int snd_rawmidi_flush_output(void *handle);
-int snd_rawmidi_flush_input(void *handle);
-ssize_t snd_rawmidi_write(void *handle, const void *buffer, size_t size);
-ssize_t snd_rawmidi_read(void *handle, void *buffer, size_t size);
+typedef struct snd_rawmidi snd_rawmidi_t;
+
+int snd_rawmidi_open(snd_rawmidi_t **handle, int card, int device, int mode);
+int snd_rawmidi_close(snd_rawmidi_t *handle);
+int snd_rawmidi_file_descriptor(snd_rawmidi_t *handle);
+int snd_rawmidi_block_mode(snd_rawmidi_t *handle, int enable);
+int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info);
+int snd_rawmidi_output_params(snd_rawmidi_t *handle, snd_rawmidi_output_params_t * params);
+int snd_rawmidi_input_params(snd_rawmidi_t *handle, snd_rawmidi_input_params_t * params);
+int snd_rawmidi_output_status(snd_rawmidi_t *handle, snd_rawmidi_output_status_t * status);
+int snd_rawmidi_input_status(snd_rawmidi_t *handle, snd_rawmidi_input_status_t * status);
+int snd_rawmidi_drain_output(snd_rawmidi_t *handle);
+int snd_rawmidi_flush_output(snd_rawmidi_t *handle);
+int snd_rawmidi_flush_input(snd_rawmidi_t *handle);
+ssize_t snd_rawmidi_write(snd_rawmidi_t *handle, const void *buffer, size_t size);
+ssize_t snd_rawmidi_read(snd_rawmidi_t *handle, void *buffer, size_t size);
 
 #ifdef __cplusplus
 }
index 382b7921e5aaad907bf14f949266572edd4e122e..11e0dddf99d99d85a5484bacf076ddb826b99ac7 100644 (file)
 extern "C" {
 #endif
 
-int snd_seq_open(void **handle, int mode);
-int snd_seq_close(void *handle);
-int snd_seq_file_descriptor(void *handle);
-int snd_seq_block_mode(void *handle, int enable);
-int snd_seq_client_id(void *handle);
-int snd_seq_system_info(void *handle, snd_seq_system_info_t *info);
-int snd_seq_get_client_info(void *handle, snd_seq_client_info_t *info);
-int snd_seq_get_any_client_info(void *handle, int client, snd_seq_client_info_t *info);
-int snd_seq_set_client_info(void *handle, snd_seq_client_info_t *info);
-int snd_seq_create_port(void *handle, snd_seq_port_info_t *info);
-int snd_seq_delete_port(void *handle, snd_seq_port_info_t *info);
-int snd_seq_get_port_info(void *handle, int port, snd_seq_port_info_t *info);
-int snd_seq_get_any_port_info(void *handle, int client, int port, snd_seq_port_info_t *info);
-int snd_seq_set_port_info(void *handle, int port, snd_seq_port_info_t *info);
-int snd_seq_subscribe_port(void *handle, snd_seq_port_subscribe_t *sub);
-int snd_seq_unsubscribe_port(void *handle, snd_seq_port_subscribe_t *sub);
-int snd_seq_get_queue_status(void *handle, int q, snd_seq_queue_status_t *status);
-int snd_seq_get_queue_tempo(void *handle, int q, snd_seq_queue_tempo_t *tempo);
-int snd_seq_set_queue_tempo(void *handle, int q, snd_seq_queue_tempo_t *tempo);
-int snd_seq_get_queue_owner(void *handle, int q, snd_seq_queue_owner_t *owner);
-int snd_seq_set_queue_owner(void *handle, int q, snd_seq_queue_owner_t *owner);
-int snd_seq_get_queue_timer(void *handle, int q, snd_seq_queue_timer_t *timer);
-int snd_seq_set_queue_timer(void *handle, int q, snd_seq_queue_timer_t *timer);
-int snd_seq_get_queue_sync(void *handle, int q, snd_seq_queue_sync_t *sync);
-int snd_seq_set_queue_sync(void *handle, int q, snd_seq_queue_sync_t *sync);
-int snd_seq_get_queue_client(void *handle, int q, snd_seq_queue_client_t *queue);
-int snd_seq_set_queue_client(void *handle, int q, snd_seq_queue_client_t *queue);
-int snd_seq_alloc_queue(void *handle);
-int snd_seq_free_queue(void *handle, int q);
+typedef struct snd_seq snd_seq_t;
+
+int snd_seq_open(snd_seq_t **handle, int mode);
+int snd_seq_close(snd_seq_t *handle);
+int snd_seq_file_descriptor(snd_seq_t *handle);
+int snd_seq_block_mode(snd_seq_t *handle, int enable);
+int snd_seq_client_id(snd_seq_t *handle);
+int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);
+int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
+int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
+int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
+int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
+int snd_seq_delete_port(snd_seq_t *handle, snd_seq_port_info_t *info);
+int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
+int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);
+int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
+int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);
+int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
+int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
+int snd_seq_get_queue_owner(snd_seq_t *handle, int q, snd_seq_queue_owner_t *owner);
+int snd_seq_set_queue_owner(snd_seq_t *handle, int q, snd_seq_queue_owner_t *owner);
+int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
+int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
+int snd_seq_get_queue_sync(snd_seq_t *handle, int q, snd_seq_queue_sync_t *sync);
+int snd_seq_set_queue_sync(snd_seq_t *handle, int q, snd_seq_queue_sync_t *sync);
+int snd_seq_get_queue_client(snd_seq_t *handle, int q, snd_seq_queue_client_t *queue);
+int snd_seq_set_queue_client(snd_seq_t *handle, int q, snd_seq_queue_client_t *queue);
+int snd_seq_alloc_queue(snd_seq_t *handle);
+int snd_seq_free_queue(snd_seq_t *handle, int q);
 /* event routines */
 snd_seq_event_t *snd_seq_create_event(void);
 int snd_seq_free_event(snd_seq_event_t *ev);
 int snd_seq_event_length(snd_seq_event_t *ev);
-int snd_seq_event_output(void *handle, snd_seq_event_t *ev);
-int snd_seq_event_input(void *handle, snd_seq_event_t **ev);
-int snd_seq_flush_output(void *handle);
-int snd_seq_drain_output(void *handle);
-int snd_seq_drain_input(void *handle);
+int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
+int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
+int snd_seq_flush_output(snd_seq_t *handle);
+int snd_seq_drain_output(snd_seq_t *handle);
+int snd_seq_drain_input(snd_seq_t *handle);
 /* misc */
 void snd_seq_set_bit(int nr, void *array);
 int snd_seq_change_bit(int nr, void *array);
index d0c75287c3f07eff5b1934cab31e54c59690f5f6..fd0e9e120b3306369756123d1bf951979c2e76ff 100644 (file)
@@ -9,18 +9,20 @@
 extern "C" {
 #endif
 
-int snd_timer_open(void **handle);
-int snd_timer_close(void *handle);
-int snd_timer_file_descriptor(void *handle);
-int snd_timer_general_info(void *handle, snd_timer_general_info_t * info);
-int snd_timer_select(void *handle, snd_timer_select_t *tselect);
-int snd_timer_info(void *handle, snd_timer_info_t *timer);
-int snd_timer_params(void *handle, snd_timer_params_t *params);
-int snd_timer_status(void *handle, snd_timer_status_t *status);
-int snd_timer_start(void *handle);
-int snd_timer_stop(void *handle);
-int snd_timer_continue(void *handle);
-ssize_t snd_timer_read(void *handle, void *buffer, size_t size);
+typedef struct snd_timer snd_timer_t;
+
+int snd_timer_open(snd_timer_t **handle);
+int snd_timer_close(snd_timer_t *handle);
+int snd_timer_file_descriptor(snd_timer_t *handle);
+int snd_timer_general_info(snd_timer_t *handle, snd_timer_general_info_t * info);
+int snd_timer_select(snd_timer_t *handle, snd_timer_select_t *tselect);
+int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer);
+int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params);
+int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status);
+int snd_timer_start(snd_timer_t *handle);
+int snd_timer_stop(snd_timer_t *handle);
+int snd_timer_continue(snd_timer_t *handle);
+ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size);
 
 #ifdef __cplusplus
 }
index cea747eb494632a3012e83c15d5bce7c73756824..94d96767c46e7a0f89bf00a8772fc39eb12cf2a4 100644 (file)
@@ -94,7 +94,7 @@ unsigned int snd_cards_mask(void)
 int snd_card_name(const char *string)
 {
        int card, bitmask;
-       void *handle;
+       snd_ctl_t *handle;
        struct snd_ctl_hw_info info;
 
        if (!string || *string == '\0')
index a399d8ff04ca36a771895ea3a22c73db661a8da8..de61a3f9f53b354d28edee77b84557dda1feaf77 100644 (file)
 #define SND_FILE_CONTROL       "/dev/snd/controlC%i"
 #define SND_CTL_VERSION_MAX    SND_PROTOCOL_VERSION( 1, 0, 0 )
 
-typedef struct {
+struct snd_ctl {
        int card;
        int fd;
-} snd_ctl_t;
+};
 
-int snd_ctl_open(void **handle, int card)
+int snd_ctl_open(snd_ctl_t **handle, int card)
 {
        int fd, ver;
        char filename[32];
@@ -72,12 +72,12 @@ int snd_ctl_open(void **handle, int card)
        return 0;
 }
 
-int snd_ctl_close(void *handle)
+int snd_ctl_close(snd_ctl_t *handle)
 {
        snd_ctl_t *ctl;
        int res;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl)
                return -EINVAL;
        res = close(ctl->fd) < 0 ? -errno : 0;
@@ -85,21 +85,21 @@ int snd_ctl_close(void *handle)
        return res;
 }
 
-int snd_ctl_file_descriptor(void *handle)
+int snd_ctl_file_descriptor(snd_ctl_t *handle)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl)
                return -EINVAL;
        return ctl->fd;
 }
 
-int snd_ctl_hw_info(void *handle, struct snd_ctl_hw_info *info)
+int snd_ctl_hw_info(snd_ctl_t *handle, struct snd_ctl_hw_info *info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_HW_INFO, info) < 0)
@@ -107,11 +107,11 @@ int snd_ctl_hw_info(void *handle, struct snd_ctl_hw_info *info)
        return 0;
 }
 
-int snd_ctl_switch_list(void *handle, snd_switch_list_t *list)
+int snd_ctl_switch_list(snd_ctl_t *handle, snd_switch_list_t *list)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !list)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_SWITCH_LIST, list) < 0)
@@ -119,11 +119,11 @@ int snd_ctl_switch_list(void *handle, snd_switch_list_t *list)
        return 0;
 }
 
-int snd_ctl_switch_read(void *handle, snd_switch_t *sw)
+int snd_ctl_switch_read(snd_ctl_t *handle, snd_switch_t *sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_SWITCH_READ, sw) < 0)
@@ -131,11 +131,11 @@ int snd_ctl_switch_read(void *handle, snd_switch_t *sw)
        return 0;
 }
 
-int snd_ctl_switch_write(void *handle, snd_switch_t *sw)
+int snd_ctl_switch_write(snd_ctl_t *handle, snd_switch_t *sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_SWITCH_WRITE, sw) < 0)
@@ -143,11 +143,11 @@ int snd_ctl_switch_write(void *handle, snd_switch_t *sw)
        return 0;
 }
 
-int snd_ctl_pcm_info(void *handle, int dev, snd_pcm_info_t * info)
+int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -157,11 +157,11 @@ int snd_ctl_pcm_info(void *handle, int dev, snd_pcm_info_t * info)
        return 0;
 }
 
-int snd_ctl_pcm_playback_info(void *handle, int dev, snd_pcm_playback_info_t * info)
+int snd_ctl_pcm_playback_info(snd_ctl_t *handle, int dev, snd_pcm_playback_info_t * info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -171,11 +171,11 @@ int snd_ctl_pcm_playback_info(void *handle, int dev, snd_pcm_playback_info_t * i
        return 0;
 }
 
-int snd_ctl_pcm_record_info(void *handle, int dev, snd_pcm_record_info_t * info)
+int snd_ctl_pcm_record_info(snd_ctl_t *handle, int dev, snd_pcm_record_info_t * info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -185,11 +185,11 @@ int snd_ctl_pcm_record_info(void *handle, int dev, snd_pcm_record_info_t * info)
        return 0;
 }
 
-int snd_ctl_pcm_playback_switch_list(void *handle, int dev, snd_switch_list_t *list)
+int snd_ctl_pcm_playback_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || dev < 0 || !list)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -199,11 +199,11 @@ int snd_ctl_pcm_playback_switch_list(void *handle, int dev, snd_switch_list_t *l
        return 0;
 }
 
-int snd_ctl_pcm_playback_switch_read(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_pcm_playback_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -213,11 +213,11 @@ int snd_ctl_pcm_playback_switch_read(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_pcm_playback_switch_write(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_pcm_playback_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -227,11 +227,11 @@ int snd_ctl_pcm_playback_switch_write(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_pcm_record_switch_list(void *handle, int dev, snd_switch_list_t * list)
+int snd_ctl_pcm_record_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t * list)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !list || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -241,11 +241,11 @@ int snd_ctl_pcm_record_switch_list(void *handle, int dev, snd_switch_list_t * li
        return 0;
 }
 
-int snd_ctl_pcm_record_switch_read(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_pcm_record_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -255,11 +255,11 @@ int snd_ctl_pcm_record_switch_read(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_pcm_record_switch_write(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_pcm_record_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
@@ -269,11 +269,11 @@ int snd_ctl_pcm_record_switch_write(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_mixer_info(void *handle, int dev, snd_mixer_info_t * info)
+int snd_ctl_mixer_info(snd_ctl_t *handle, int dev, snd_mixer_info_t * info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_MIXER_DEVICE, &dev) < 0)
@@ -283,11 +283,11 @@ int snd_ctl_mixer_info(void *handle, int dev, snd_mixer_info_t * info)
        return 0;
 }
 
-int snd_ctl_mixer_switch_list(void *handle, int dev, snd_switch_list_t * list)
+int snd_ctl_mixer_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t * list)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !list || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_MIXER_DEVICE, &dev) < 0)
@@ -297,11 +297,11 @@ int snd_ctl_mixer_switch_list(void *handle, int dev, snd_switch_list_t * list)
        return 0;
 }
 
-int snd_ctl_mixer_switch_read(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_mixer_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_MIXER_DEVICE, &dev) < 0)
@@ -311,11 +311,11 @@ int snd_ctl_mixer_switch_read(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_mixer_switch_write(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_mixer_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_MIXER_DEVICE, &dev) < 0)
@@ -325,11 +325,11 @@ int snd_ctl_mixer_switch_write(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_rawmidi_info(void *handle, int dev, snd_rawmidi_info_t * info)
+int snd_ctl_rawmidi_info(snd_ctl_t *handle, int dev, snd_rawmidi_info_t * info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -339,11 +339,11 @@ int snd_ctl_rawmidi_info(void *handle, int dev, snd_rawmidi_info_t * info)
        return 0;
 }
 
-int snd_ctl_rawmidi_output_info(void *handle, int dev, snd_rawmidi_output_info_t * info)
+int snd_ctl_rawmidi_output_info(snd_ctl_t *handle, int dev, snd_rawmidi_output_info_t * info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -353,11 +353,11 @@ int snd_ctl_rawmidi_output_info(void *handle, int dev, snd_rawmidi_output_info_t
        return 0;
 }
 
-int snd_ctl_rawmidi_input_info(void *handle, int dev, snd_rawmidi_input_info_t * info)
+int snd_ctl_rawmidi_input_info(snd_ctl_t *handle, int dev, snd_rawmidi_input_info_t * info)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !info || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -367,11 +367,11 @@ int snd_ctl_rawmidi_input_info(void *handle, int dev, snd_rawmidi_input_info_t *
        return 0;
 }
 
-int snd_ctl_rawmidi_output_switch_list(void *handle, int dev, snd_switch_list_t *list)
+int snd_ctl_rawmidi_output_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !list || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -381,11 +381,11 @@ int snd_ctl_rawmidi_output_switch_list(void *handle, int dev, snd_switch_list_t
        return 0;
 }
 
-int snd_ctl_rawmidi_output_switch_read(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_rawmidi_output_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -395,11 +395,11 @@ int snd_ctl_rawmidi_output_switch_read(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_rawmidi_output_switch_write(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_rawmidi_output_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -409,11 +409,11 @@ int snd_ctl_rawmidi_output_switch_write(void *handle, int dev, snd_switch_t * sw
        return 0;
 }
 
-int snd_ctl_rawmidi_input_switch_list(void *handle, int dev, snd_switch_list_t *list)
+int snd_ctl_rawmidi_input_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !list || dev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -423,11 +423,11 @@ int snd_ctl_rawmidi_input_switch_list(void *handle, int dev, snd_switch_list_t *
        return 0;
 }
 
-int snd_ctl_rawmidi_input_switch_read(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_rawmidi_input_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -437,11 +437,11 @@ int snd_ctl_rawmidi_input_switch_read(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_ctl_rawmidi_input_switch_write(void *handle, int dev, snd_switch_t * sw)
+int snd_ctl_rawmidi_input_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw)
 {
        snd_ctl_t *ctl;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
@@ -451,13 +451,13 @@ int snd_ctl_rawmidi_input_switch_write(void *handle, int dev, snd_switch_t * sw)
        return 0;
 }
 
-int snd_control_read(void *handle, snd_ctl_callbacks_t * callbacks)
+int snd_control_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks)
 {
        snd_ctl_t *ctl;
        int result, count;
        snd_ctl_read_t r;
 
-       ctl = (snd_ctl_t *) handle;
+       ctl = handle;
        if (!ctl)
                return -EINVAL;
        count = 0;
index e148588560430137357bc98dd70146a8a748468b..d8a97bdc94b47ab31472f5d538905cb5172a085c 100644 (file)
@@ -57,7 +57,7 @@ int snd_mixer_element_has_info(snd_mixer_eid_t *eid)
        return 0;
 }
 
-int snd_mixer_element_info_build(void *handle, snd_mixer_element_info_t *element)
+int snd_mixer_element_info_build(snd_mixer_t *handle, snd_mixer_element_info_t *element)
 {
        int err;
        
@@ -204,7 +204,7 @@ int snd_mixer_element_has_control(snd_mixer_eid_t *eid)
        return 0;
 }
 
-int snd_mixer_element_build(void *handle, snd_mixer_element_t *element)
+int snd_mixer_element_build(snd_mixer_t *handle, snd_mixer_element_t *element)
 {
        int err;
        
index fe72c4318be78f5a53985d03a6bd8edd2e9a7ed0..104df6471c886b5a65c9caf154cbc48f07866a27 100644 (file)
 #define SND_FILE_MIXER         "/dev/snd/mixerC%iD%i"
 #define SND_MIXER_VERSION_MAX  SND_PROTOCOL_VERSION(2, 0, 0)
 
-typedef struct {
+struct snd_mixer {
        int card;
        int device;
        int fd;
-} snd_mixer_t;
+} ;
 
-int snd_mixer_open(void **handle, int card, int device)
+int snd_mixer_open(snd_mixer_t **handle, int card, int device)
 {
        int fd, ver;
        char filename[32];
@@ -73,12 +73,12 @@ int snd_mixer_open(void **handle, int card, int device)
        return 0;
 }
 
-int snd_mixer_close(void *handle)
+int snd_mixer_close(snd_mixer_t *handle)
 {
        snd_mixer_t *mixer;
        int res;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        res = close(mixer->fd) < 0 ? -errno : 0;
@@ -86,21 +86,21 @@ int snd_mixer_close(void *handle)
        return res;
 }
 
-int snd_mixer_file_descriptor(void *handle)
+int snd_mixer_file_descriptor(snd_mixer_t *handle)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        return mixer->fd;
 }
 
-int snd_mixer_info(void *handle, snd_mixer_info_t * info)
+int snd_mixer_info(snd_mixer_t *handle, snd_mixer_info_t * info)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer || !info)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_INFO, info) < 0)
@@ -108,11 +108,11 @@ int snd_mixer_info(void *handle, snd_mixer_info_t * info)
        return 0;
 }
 
-int snd_mixer_elements(void *handle, snd_mixer_elements_t * elements)
+int snd_mixer_elements(snd_mixer_t *handle, snd_mixer_elements_t * elements)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_ELEMENTS, elements) < 0)
@@ -120,11 +120,11 @@ int snd_mixer_elements(void *handle, snd_mixer_elements_t * elements)
        return 0;
 }
 
-int snd_mixer_routes(void *handle, snd_mixer_routes_t * routes)
+int snd_mixer_routes(snd_mixer_t *handle, snd_mixer_routes_t * routes)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_ROUTES, routes) < 0)
@@ -132,11 +132,11 @@ int snd_mixer_routes(void *handle, snd_mixer_routes_t * routes)
        return 0;
 }
 
-int snd_mixer_groups(void *handle, snd_mixer_groups_t * groups)
+int snd_mixer_groups(snd_mixer_t *handle, snd_mixer_groups_t * groups)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_GROUPS, groups) < 0)
@@ -144,11 +144,11 @@ int snd_mixer_groups(void *handle, snd_mixer_groups_t * groups)
        return 0;
 }
 
-int snd_mixer_group(void *handle, snd_mixer_group_t * group)
+int snd_mixer_group(snd_mixer_t *handle, snd_mixer_group_t * group)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_GROUP, group) < 0)
@@ -156,11 +156,11 @@ int snd_mixer_group(void *handle, snd_mixer_group_t * group)
        return 0;
 }
 
-int snd_mixer_element_info(void *handle, snd_mixer_element_info_t * info)
+int snd_mixer_element_info(snd_mixer_t *handle, snd_mixer_element_info_t * info)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_ELEMENT_INFO, info) < 0)
@@ -169,11 +169,11 @@ int snd_mixer_element_info(void *handle, snd_mixer_element_info_t * info)
 }
 
 
-int snd_mixer_element_read(void *handle, snd_mixer_element_t * element)
+int snd_mixer_element_read(snd_mixer_t *handle, snd_mixer_element_t * element)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_ELEMENT_READ, element) < 0)
@@ -181,11 +181,11 @@ int snd_mixer_element_read(void *handle, snd_mixer_element_t * element)
        return 0;
 }
 
-int snd_mixer_element_write(void *handle, snd_mixer_element_t * element)
+int snd_mixer_element_write(snd_mixer_t *handle, snd_mixer_element_t * element)
 {
        snd_mixer_t *mixer;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        if (ioctl(mixer->fd, SND_MIXER_IOCTL_ELEMENT_WRITE, element) < 0)
@@ -193,13 +193,13 @@ int snd_mixer_element_write(void *handle, snd_mixer_element_t * element)
        return 0;
 }
 
-int snd_mixer_read(void *handle, snd_mixer_callbacks_t * callbacks)
+int snd_mixer_read(snd_mixer_t *handle, snd_mixer_callbacks_t * callbacks)
 {
        snd_mixer_t *mixer;
        int result, count;
        snd_mixer_read_t r;
 
-       mixer = (snd_mixer_t *) handle;
+       mixer = handle;
        if (!mixer)
                return -EINVAL;
        count = 0;
index e37523ba5c6ea8ead116f7baf7f9e09e1e3907be..9b1ff42f2f34124cb236c9a46ee6c3a4d293390b 100644 (file)
@@ -18,7 +18,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
-
+  
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #define SND_FILE_PCM           "/dev/snd/pcmC%iD%i"
 #define SND_PCM_VERSION_MAX    SND_PROTOCOL_VERSION( 1, 0, 1 )
 
-typedef struct {
+struct snd_pcm {
        int card;
        int device;
        int fd;
-} snd_pcm_t;
+};
 
-int snd_pcm_open(void **handle, int card, int device, int mode)
+int snd_pcm_open(snd_pcm_t **handle, int card, int device, int mode)
 {
        int fd, ver;
        char filename[32];
@@ -73,12 +73,12 @@ int snd_pcm_open(void **handle, int card, int device, int mode)
        return 0;
 }
 
-int snd_pcm_close(void *handle)
+int snd_pcm_close(snd_pcm_t *handle)
 {
        snd_pcm_t *pcm;
        int res;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        res = close(pcm->fd) < 0 ? -errno : 0;
@@ -86,22 +86,22 @@ int snd_pcm_close(void *handle)
        return res;
 }
 
-int snd_pcm_file_descriptor(void *handle)
+int snd_pcm_file_descriptor(snd_pcm_t *handle)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        return pcm->fd;
 }
 
-int snd_pcm_block_mode(void *handle, int enable)
+int snd_pcm_block_mode(snd_pcm_t *handle, int enable)
 {
        snd_pcm_t *pcm;
        long flags;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        if ((flags = fcntl(pcm->fd, F_GETFL)) < 0)
@@ -115,11 +115,11 @@ int snd_pcm_block_mode(void *handle, int enable)
        return 0;
 }
 
-int snd_pcm_info(void *handle, snd_pcm_info_t * info)
+int snd_pcm_info(snd_pcm_t *handle, snd_pcm_info_t * info)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !info)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_INFO, info) < 0)
@@ -127,11 +127,11 @@ int snd_pcm_info(void *handle, snd_pcm_info_t * info)
        return 0;
 }
 
-int snd_pcm_playback_info(void *handle, snd_pcm_playback_info_t * info)
+int snd_pcm_playback_info(snd_pcm_t *handle, snd_pcm_playback_info_t * info)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !info)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_PLAYBACK_INFO, info) < 0)
@@ -139,11 +139,11 @@ int snd_pcm_playback_info(void *handle, snd_pcm_playback_info_t * info)
        return 0;
 }
 
-int snd_pcm_record_info(void *handle, snd_pcm_record_info_t * info)
+int snd_pcm_record_info(snd_pcm_t *handle, snd_pcm_record_info_t * info)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !info)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_RECORD_INFO, info) < 0)
@@ -151,11 +151,11 @@ int snd_pcm_record_info(void *handle, snd_pcm_record_info_t * info)
        return 0;
 }
 
-int snd_pcm_playback_format(void *handle, snd_pcm_format_t * format)
+int snd_pcm_playback_format(snd_pcm_t *handle, snd_pcm_format_t * format)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !format)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_PLAYBACK_FORMAT, format) < 0)
@@ -163,11 +163,11 @@ int snd_pcm_playback_format(void *handle, snd_pcm_format_t * format)
        return 0;
 }
 
-int snd_pcm_record_format(void *handle, snd_pcm_format_t * format)
+int snd_pcm_record_format(snd_pcm_t *handle, snd_pcm_format_t * format)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !format)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_RECORD_FORMAT, format) < 0)
@@ -175,11 +175,11 @@ int snd_pcm_record_format(void *handle, snd_pcm_format_t * format)
        return 0;
 }
 
-int snd_pcm_playback_params(void *handle, snd_pcm_playback_params_t * params)
+int snd_pcm_playback_params(snd_pcm_t *handle, snd_pcm_playback_params_t * params)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !params)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_PLAYBACK_PARAMS, params) < 0)
@@ -187,11 +187,11 @@ int snd_pcm_playback_params(void *handle, snd_pcm_playback_params_t * params)
        return 0;
 }
 
-int snd_pcm_record_params(void *handle, snd_pcm_record_params_t * params)
+int snd_pcm_record_params(snd_pcm_t *handle, snd_pcm_record_params_t * params)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !params)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_RECORD_PARAMS, params) < 0)
@@ -199,11 +199,11 @@ int snd_pcm_record_params(void *handle, snd_pcm_record_params_t * params)
        return 0;
 }
 
-int snd_pcm_playback_status(void *handle, snd_pcm_playback_status_t * status)
+int snd_pcm_playback_status(snd_pcm_t *handle, snd_pcm_playback_status_t * status)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !status)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_PLAYBACK_STATUS, status) < 0)
@@ -211,11 +211,11 @@ int snd_pcm_playback_status(void *handle, snd_pcm_playback_status_t * status)
        return 0;
 }
 
-int snd_pcm_record_status(void *handle, snd_pcm_record_status_t * status)
+int snd_pcm_record_status(snd_pcm_t *handle, snd_pcm_record_status_t * status)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || !status)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_RECORD_STATUS, status) < 0)
@@ -223,11 +223,11 @@ int snd_pcm_record_status(void *handle, snd_pcm_record_status_t * status)
        return 0;
 }
 
-int snd_pcm_drain_playback(void *handle)
+int snd_pcm_drain_playback(snd_pcm_t *handle)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_DRAIN_PLAYBACK) < 0)
@@ -235,11 +235,11 @@ int snd_pcm_drain_playback(void *handle)
        return 0;
 }
 
-int snd_pcm_flush_playback(void *handle)
+int snd_pcm_flush_playback(snd_pcm_t *handle)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_FLUSH_PLAYBACK) < 0)
@@ -247,11 +247,11 @@ int snd_pcm_flush_playback(void *handle)
        return 0;
 }
 
-int snd_pcm_flush_record(void *handle)
+int snd_pcm_flush_record(snd_pcm_t *handle)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_FLUSH_RECORD) < 0)
@@ -259,11 +259,11 @@ int snd_pcm_flush_record(void *handle)
        return 0;
 }
 
-int snd_pcm_playback_pause(void *handle, int enable)
+int snd_pcm_playback_pause(snd_pcm_t *handle, int enable)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_PLAYBACK_PAUSE, &enable) < 0)
@@ -271,11 +271,11 @@ int snd_pcm_playback_pause(void *handle, int enable)
        return 0;
 }
 
-int snd_pcm_playback_time(void *handle, int enable)
+int snd_pcm_playback_time(snd_pcm_t *handle, int enable)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_PLAYBACK_TIME, &enable) < 0)
@@ -283,11 +283,11 @@ int snd_pcm_playback_time(void *handle, int enable)
        return 0;
 }
 
-int snd_pcm_record_time(void *handle, int enable)
+int snd_pcm_record_time(snd_pcm_t *handle, int enable)
 {
        snd_pcm_t *pcm;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm)
                return -EINVAL;
        if (ioctl(pcm->fd, SND_PCM_IOCTL_RECORD_TIME, &enable) < 0)
@@ -295,12 +295,12 @@ int snd_pcm_record_time(void *handle, int enable)
        return 0;
 }
 
-ssize_t snd_pcm_write(void *handle, const void *buffer, size_t size)
+ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size)
 {
        snd_pcm_t *pcm;
        ssize_t result;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || (!buffer && size > 0) || size < 0)
                return -EINVAL;
        result = write(pcm->fd, buffer, size);
@@ -309,12 +309,12 @@ ssize_t snd_pcm_write(void *handle, const void *buffer, size_t size)
        return result;
 }
 
-ssize_t snd_pcm_read(void *handle, void *buffer, size_t size)
+ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size)
 {
        snd_pcm_t *pcm;
        ssize_t result;
 
-       pcm = (snd_pcm_t *) handle;
+       pcm = handle;
        if (!pcm || (!buffer && size > 0) || size < 0)
                return -EINVAL;
        result = read(pcm->fd, buffer, size);
index 71cb796d7b506240d9f13ab7cac72a59200c33bd..d6516eab989d5ec056f0419ad97a7962265e03c4 100644 (file)
@@ -18,7 +18,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
-
+  
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #define SND_FILE_PCM_LB                "/proc/asound/%i/pcm%i%s"
 #define SND_PCM_LB_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 )
 
-typedef struct {
+struct snd_pcm_loopback {
        int card;
        int device;
        int fd;
-} snd_pcm_loopback_t;
+} ;
 
-int snd_pcm_loopback_open(void **handle, int card, int device, int mode)
+int snd_pcm_loopback_open(snd_pcm_loopback_t **handle, int card, int device, int mode)
 {
        int fd, ver;
        char filename[32];
@@ -74,12 +74,12 @@ int snd_pcm_loopback_open(void **handle, int card, int device, int mode)
        return 0;
 }
 
-int snd_pcm_loopback_close(void *handle)
+int snd_pcm_loopback_close(snd_pcm_loopback_t *handle)
 {
        snd_pcm_loopback_t *lb;
        int res;
 
-       lb = (snd_pcm_loopback_t *) handle;
+       lb = handle;
        if (!lb)
                return -EINVAL;
        res = close(lb->fd) < 0 ? -errno : 0;
@@ -87,22 +87,22 @@ int snd_pcm_loopback_close(void *handle)
        return res;
 }
 
-int snd_pcm_loopback_file_descriptor(void *handle)
+int snd_pcm_loopback_file_descriptor(snd_pcm_loopback_t *handle)
 {
        snd_pcm_loopback_t *lb;
 
-       lb = (snd_pcm_loopback_t *) handle;
+       lb = handle;
        if (!lb)
                return -EINVAL;
        return lb->fd;
 }
 
-int snd_pcm_loopback_block_mode(void *handle, int enable)
+int snd_pcm_loopback_block_mode(snd_pcm_loopback_t *handle, int enable)
 {
        snd_pcm_loopback_t *lb;
        long flags;
 
-       lb = (snd_pcm_loopback_t *) handle;
+       lb = handle;
        if (!lb)
                return -EINVAL;
        if ((flags = fcntl(lb->fd, F_GETFL)) < 0)
@@ -116,12 +116,12 @@ int snd_pcm_loopback_block_mode(void *handle, int enable)
        return 0;
 }
 
-int snd_pcm_loopback_stream_mode(void *handle, int mode)
+int snd_pcm_loopback_stream_mode(snd_pcm_loopback_t *handle, int mode)
 {
        snd_pcm_loopback_t *lb;
        long lmode = mode;
 
-       lb = (snd_pcm_loopback_t *) handle;
+       lb = handle;
        if (!lb)
                return -EINVAL;
        if (ioctl(lb->fd, SND_PCM_LB_IOCTL_STREAM_MODE, &lmode) < 0)
@@ -129,11 +129,11 @@ int snd_pcm_loopback_stream_mode(void *handle, int mode)
        return 0;
 }
 
-int snd_pcm_loopback_format(void *handle, snd_pcm_format_t * format)
+int snd_pcm_loopback_format(snd_pcm_loopback_t *handle, snd_pcm_format_t * format)
 {
        snd_pcm_loopback_t *lb;
 
-       lb = (snd_pcm_loopback_t *) handle;
+       lb = handle;
        if (!lb)
                return -EINVAL;
        if (ioctl(lb->fd, SND_PCM_LB_IOCTL_FORMAT, format) < 0)
@@ -141,12 +141,12 @@ int snd_pcm_loopback_format(void *handle, snd_pcm_format_t * format)
        return 0;
 }
 
-ssize_t snd_pcm_loopback_read(void *handle, void *buffer, size_t size)
+ssize_t snd_pcm_loopback_read(snd_pcm_loopback_t *handle, void *buffer, size_t size)
 {
        snd_pcm_loopback_t *lb;
        ssize_t result;
 
-       lb = (snd_pcm_loopback_t *) handle;
+       lb = handle;
        if (!lb)
                return -EINVAL;
        result = read(lb->fd, buffer, size);
index 632774575aef2a8d5719a16abb60532543282224..4905f183718279fee5b5c1742ad00c38a3ef9906 100644 (file)
 #define SND_FILE_RAWMIDI       "/dev/snd/midiC%iD%i"
 #define SND_RAWMIDI_VERSION_MAX        SND_PROTOCOL_VERSION( 1, 0, 0 )
 
-typedef struct {
+struct snd_rawmidi {
        int card;
        int device;
        int fd;
-} snd_rawmidi_t;
+};
 
-int snd_rawmidi_open(void **handle, int card, int device, int mode)
+int snd_rawmidi_open(snd_rawmidi_t **handle, int card, int device, int mode)
 {
        int fd, ver;
        char filename[32];
@@ -73,12 +73,12 @@ int snd_rawmidi_open(void **handle, int card, int device, int mode)
        return 0;
 }
 
-int snd_rawmidi_close(void *handle)
+int snd_rawmidi_close(snd_rawmidi_t *handle)
 {
        snd_rawmidi_t *rmidi;
        int res;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi)
                return -EINVAL;
        res = close(rmidi->fd) < 0 ? -errno : 0;
@@ -86,22 +86,22 @@ int snd_rawmidi_close(void *handle)
        return res;
 }
 
-int snd_rawmidi_file_descriptor(void *handle)
+int snd_rawmidi_file_descriptor(snd_rawmidi_t *handle)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi)
                return -EINVAL;
        return rmidi->fd;
 }
 
-int snd_rawmidi_block_mode(void *handle, int enable)
+int snd_rawmidi_block_mode(snd_rawmidi_t *handle, int enable)
 {
        snd_rawmidi_t *rmidi;
        long flags;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi)
                return -EINVAL;
        if ((flags = fcntl(rmidi->fd, F_GETFL)) < 0)
@@ -115,11 +115,11 @@ int snd_rawmidi_block_mode(void *handle, int enable)
        return 0;
 }
 
-int snd_rawmidi_info(void *handle, snd_rawmidi_info_t * info)
+int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi || !info)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_INFO, info) < 0)
@@ -127,11 +127,11 @@ int snd_rawmidi_info(void *handle, snd_rawmidi_info_t * info)
        return 0;
 }
 
-int snd_rawmidi_output_params(void *handle, snd_rawmidi_output_params_t * params)
+int snd_rawmidi_output_params(snd_rawmidi_t *handle, snd_rawmidi_output_params_t * params)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi || !params)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_OUTPUT_PARAMS, params) < 0)
@@ -139,11 +139,11 @@ int snd_rawmidi_output_params(void *handle, snd_rawmidi_output_params_t * params
        return 0;
 }
 
-int snd_rawmidi_input_params(void *handle, snd_rawmidi_input_params_t * params)
+int snd_rawmidi_input_params(snd_rawmidi_t *handle, snd_rawmidi_input_params_t * params)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi || !params)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_INPUT_PARAMS, params) < 0)
@@ -151,11 +151,11 @@ int snd_rawmidi_input_params(void *handle, snd_rawmidi_input_params_t * params)
        return 0;
 }
 
-int snd_rawmidi_output_status(void *handle, snd_rawmidi_output_status_t * status)
+int snd_rawmidi_output_status(snd_rawmidi_t *handle, snd_rawmidi_output_status_t * status)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi || !status)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_OUTPUT_STATUS, status) < 0)
@@ -163,11 +163,11 @@ int snd_rawmidi_output_status(void *handle, snd_rawmidi_output_status_t * status
        return 0;
 }
 
-int snd_rawmidi_input_status(void *handle, snd_rawmidi_input_status_t * status)
+int snd_rawmidi_input_status(snd_rawmidi_t *handle, snd_rawmidi_input_status_t * status)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi || !status)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_INPUT_STATUS, status) < 0)
@@ -175,11 +175,11 @@ int snd_rawmidi_input_status(void *handle, snd_rawmidi_input_status_t * status)
        return 0;
 }
 
-int snd_rawmidi_drain_output(void *handle)
+int snd_rawmidi_drain_output(snd_rawmidi_t *handle)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_DRAIN_OUTPUT) < 0)
@@ -187,11 +187,11 @@ int snd_rawmidi_drain_output(void *handle)
        return 0;
 }
 
-int snd_rawmidi_flush_output(void *handle)
+int snd_rawmidi_flush_output(snd_rawmidi_t *handle)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_FLUSH_OUTPUT) < 0)
@@ -199,11 +199,11 @@ int snd_rawmidi_flush_output(void *handle)
        return 0;
 }
 
-int snd_rawmidi_flush_input(void *handle)
+int snd_rawmidi_flush_input(snd_rawmidi_t *handle)
 {
        snd_rawmidi_t *rmidi;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi)
                return -EINVAL;
        if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_FLUSH_INPUT) < 0)
@@ -211,12 +211,12 @@ int snd_rawmidi_flush_input(void *handle)
        return 0;
 }
 
-ssize_t snd_rawmidi_write(void *handle, const void *buffer, size_t size)
+ssize_t snd_rawmidi_write(snd_rawmidi_t *handle, const void *buffer, size_t size)
 {
        snd_rawmidi_t *rmidi;
        ssize_t result;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi || (!buffer && size > 0) || size < 0)
                return -EINVAL;
        result = write(rmidi->fd, buffer, size);
@@ -225,12 +225,12 @@ ssize_t snd_rawmidi_write(void *handle, const void *buffer, size_t size)
        return result;
 }
 
-ssize_t snd_rawmidi_read(void *handle, void *buffer, size_t size)
+ssize_t snd_rawmidi_read(snd_rawmidi_t *handle, void *buffer, size_t size)
 {
        snd_rawmidi_t *rmidi;
        ssize_t result;
 
-       rmidi = (snd_rawmidi_t *) handle;
+       rmidi = handle;
        if (!rmidi || (!buffer && size > 0) || size < 0)
                return -EINVAL;
        result = read(rmidi->fd, buffer, size);
index 12d05321b88cfa116ad94fde5db5b5cab9b5d71b..1de2c72b15a47f0c4cfeb32660ba0f5a7c2003d9 100644 (file)
@@ -38,7 +38,7 @@ typedef struct snd_stru_seq_cell {
        struct snd_stru_seq_cell *next;
 } snd_seq_cell_t;
 
-typedef struct {
+struct snd_seq {
        int client;             /* client number */
        int fd;
        /* buffers */
@@ -51,9 +51,9 @@ typedef struct {
        int cells;
        snd_seq_cell_t *head;
        snd_seq_cell_t *tail;
-} snd_seq_t;
+};
 
-int snd_seq_open(void **handle, int mode)
+int snd_seq_open(snd_seq_t **handle, int mode)
 {
        int fd, ver, client, flg;
        char filename[32];
@@ -108,12 +108,12 @@ int snd_seq_open(void **handle, int mode)
        return 0;
 }
 
-int snd_seq_close(void *handle)
+int snd_seq_close(snd_seq_t *handle)
 {
        snd_seq_t *seq;
        int res;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        res = close(seq->fd) < 0 ? -errno : 0;
@@ -121,22 +121,22 @@ int snd_seq_close(void *handle)
        return res;
 }
 
-int snd_seq_file_descriptor(void *handle)
+int snd_seq_file_descriptor(snd_seq_t *handle)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        return seq->fd;
 }
 
-int snd_seq_block_mode(void *handle, int enable)
+int snd_seq_block_mode(snd_seq_t *handle, int enable)
 {
        snd_seq_t *seq;
        long flags;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        if ((flags = fcntl(seq->fd, F_GETFL)) < 0)
@@ -150,21 +150,21 @@ int snd_seq_block_mode(void *handle, int enable)
        return 0;
 }
 
-int snd_seq_client_id(void *handle)
+int snd_seq_client_id(snd_seq_t *handle)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        return seq->client;
 }
 
-int snd_seq_system_info(void *handle, snd_seq_system_info_t * info)
+int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info)
                return -EINVAL;
        if (ioctl(seq->fd, SND_SEQ_IOCTL_SYSTEM_INFO, info) < 0)
@@ -172,21 +172,21 @@ int snd_seq_system_info(void *handle, snd_seq_system_info_t * info)
        return 0;
 }
 
-int snd_seq_get_client_info(void *handle, snd_seq_client_info_t * info)
+int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info)
                return -EINVAL;
        return snd_seq_get_any_client_info(handle, seq->client, info);
 }
 
-int snd_seq_get_any_client_info(void *handle, int client, snd_seq_client_info_t * info)
+int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info || client < 0)
                return -EINVAL;
        bzero(info, sizeof(snd_seq_client_info_t));
@@ -196,11 +196,11 @@ int snd_seq_get_any_client_info(void *handle, int client, snd_seq_client_info_t
        return 0;
 }
 
-int snd_seq_set_client_info(void *handle, snd_seq_client_info_t * info)
+int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info)
                return -EINVAL;
        info->client = seq->client;
@@ -210,11 +210,11 @@ int snd_seq_set_client_info(void *handle, snd_seq_client_info_t * info)
        return 0;
 }
 
-int snd_seq_create_port(void *handle, snd_seq_port_info_t * port)
+int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t * port)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !port)
                return -EINVAL;
        port->client = seq->client;
@@ -223,11 +223,11 @@ int snd_seq_create_port(void *handle, snd_seq_port_info_t * port)
        return 0;
 }
 
-int snd_seq_delete_port(void *handle, snd_seq_port_info_t * port)
+int snd_seq_delete_port(snd_seq_t *handle, snd_seq_port_info_t * port)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !port)
                return -EINVAL;
        port->client = seq->client;
@@ -236,21 +236,21 @@ int snd_seq_delete_port(void *handle, snd_seq_port_info_t * port)
        return 0;
 }
 
-int snd_seq_get_port_info(void *handle, int port, snd_seq_port_info_t * info)
+int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info || port < 0)
                return -EINVAL;
        return snd_seq_get_any_port_info(handle, seq->client, port, info);
 }
 
-int snd_seq_get_any_port_info(void *handle, int client, int port, snd_seq_port_info_t * info)
+int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info || client < 0 || port < 0)
                return -EINVAL;
        bzero(info, sizeof(snd_seq_port_info_t));
@@ -261,11 +261,11 @@ int snd_seq_get_any_port_info(void *handle, int client, int port, snd_seq_port_i
        return 0;
 }
 
-int snd_seq_set_port_info(void *handle, int port, snd_seq_port_info_t * info)
+int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info || port < 0)
                return -EINVAL;
        info->port = port;
@@ -274,11 +274,11 @@ int snd_seq_set_port_info(void *handle, int port, snd_seq_port_info_t * info)
        return 0;
 }
 
-int snd_seq_subscribe_port(void *handle, snd_seq_port_subscribe_t * sub)
+int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t * sub)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !sub)
                return -EINVAL;
        if (ioctl(seq->fd, SND_SEQ_IOCTL_SUBSCRIBE_PORT, sub) < 0)
@@ -286,11 +286,11 @@ int snd_seq_subscribe_port(void *handle, snd_seq_port_subscribe_t * sub)
        return 0;
 }
 
-int snd_seq_unsubscribe_port(void *handle, snd_seq_port_subscribe_t * sub)
+int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t * sub)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !sub)
                return -EINVAL;
        if (ioctl(seq->fd, SND_SEQ_IOCTL_UNSUBSCRIBE_PORT, sub) < 0)
@@ -298,11 +298,11 @@ int snd_seq_unsubscribe_port(void *handle, snd_seq_port_subscribe_t * sub)
        return 0;
 }
 
-int snd_seq_get_queue_status(void *handle, int q, snd_seq_queue_status_t * status)
+int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t * status)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !status)
                return -EINVAL;
        bzero(status, sizeof(snd_seq_queue_status_t));
@@ -312,11 +312,11 @@ int snd_seq_get_queue_status(void *handle, int q, snd_seq_queue_status_t * statu
        return 0;
 }
 
-int snd_seq_get_queue_tempo(void *handle, int q, snd_seq_queue_tempo_t * tempo)
+int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t * tempo)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !tempo)
                return -EINVAL;
        bzero(tempo, sizeof(snd_seq_queue_tempo_t));
@@ -326,11 +326,11 @@ int snd_seq_get_queue_tempo(void *handle, int q, snd_seq_queue_tempo_t * tempo)
        return 0;
 }
 
-int snd_seq_set_queue_tempo(void *handle, int q, snd_seq_queue_tempo_t * tempo)
+int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t * tempo)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !tempo)
                return -EINVAL;
        tempo->queue = q;
@@ -339,11 +339,11 @@ int snd_seq_set_queue_tempo(void *handle, int q, snd_seq_queue_tempo_t * tempo)
        return 0;
 }
 
-int snd_seq_get_queue_owner(void *handle, int q, snd_seq_queue_owner_t * owner)
+int snd_seq_get_queue_owner(snd_seq_t *handle, int q, snd_seq_queue_owner_t * owner)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !owner)
                return -EINVAL;
        bzero(owner, sizeof(snd_seq_queue_owner_t));
@@ -353,11 +353,11 @@ int snd_seq_get_queue_owner(void *handle, int q, snd_seq_queue_owner_t * owner)
        return 0;
 }
 
-int snd_seq_set_queue_owner(void *handle, int q, snd_seq_queue_owner_t * owner)
+int snd_seq_set_queue_owner(snd_seq_t *handle, int q, snd_seq_queue_owner_t * owner)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !owner)
                return -EINVAL;
        owner->queue = q;
@@ -366,11 +366,11 @@ int snd_seq_set_queue_owner(void *handle, int q, snd_seq_queue_owner_t * owner)
        return 0;
 }
 
-int snd_seq_get_queue_timer(void *handle, int q, snd_seq_queue_timer_t * timer)
+int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t * timer)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !timer)
                return -EINVAL;
        bzero(timer, sizeof(snd_seq_queue_timer_t));
@@ -380,11 +380,11 @@ int snd_seq_get_queue_timer(void *handle, int q, snd_seq_queue_timer_t * timer)
        return 0;
 }
 
-int snd_seq_set_queue_timer(void *handle, int q, snd_seq_queue_timer_t * timer)
+int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t * timer)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !timer)
                return -EINVAL;
        timer->queue = q;
@@ -393,11 +393,11 @@ int snd_seq_set_queue_timer(void *handle, int q, snd_seq_queue_timer_t * timer)
        return 0;
 }
 
-int snd_seq_get_queue_sync(void *handle, int q, snd_seq_queue_sync_t * sync)
+int snd_seq_get_queue_sync(snd_seq_t *handle, int q, snd_seq_queue_sync_t * sync)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !sync)
                return -EINVAL;
        bzero(sync, sizeof(snd_seq_queue_sync_t));
@@ -407,11 +407,11 @@ int snd_seq_get_queue_sync(void *handle, int q, snd_seq_queue_sync_t * sync)
        return 0;
 }
 
-int snd_seq_set_queue_sync(void *handle, int q, snd_seq_queue_sync_t * sync)
+int snd_seq_set_queue_sync(snd_seq_t *handle, int q, snd_seq_queue_sync_t * sync)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !sync)
                return -EINVAL;
        sync->queue = q;
@@ -420,11 +420,11 @@ int snd_seq_set_queue_sync(void *handle, int q, snd_seq_queue_sync_t * sync)
        return 0;
 }
 
-int snd_seq_get_queue_client(void *handle, int q, snd_seq_queue_client_t * info)
+int snd_seq_get_queue_client(snd_seq_t *handle, int q, snd_seq_queue_client_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info)
                return -EINVAL;
        bzero(info, sizeof(snd_seq_queue_client_t));
@@ -435,11 +435,11 @@ int snd_seq_get_queue_client(void *handle, int q, snd_seq_queue_client_t * info)
        return 0;
 }
 
-int snd_seq_set_queue_client(void *handle, int q, snd_seq_queue_client_t * info)
+int snd_seq_set_queue_client(snd_seq_t *handle, int q, snd_seq_queue_client_t * info)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !info)
                return -EINVAL;
        info->queue = q;
@@ -449,14 +449,14 @@ int snd_seq_set_queue_client(void *handle, int q, snd_seq_queue_client_t * info)
        return 0;
 }
 
-int snd_seq_alloc_queue(void *handle)
+int snd_seq_alloc_queue(snd_seq_t *handle)
 {
        int i, err;
        snd_seq_system_info_t sysinfo;
        snd_seq_queue_owner_t owner;
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL; 
        if ((err = snd_seq_system_info(handle, &sysinfo))<0)
@@ -475,13 +475,13 @@ int snd_seq_alloc_queue(void *handle)
        return -EBUSY;
 }
 
-int snd_seq_free_queue(void *handle, int q)
+int snd_seq_free_queue(snd_seq_t *handle, int q)
 {
        int err;
        snd_seq_t *seq;
        snd_seq_queue_owner_t owner;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL; 
        if ((err = snd_seq_get_queue_owner(handle, q, &owner))<0)
@@ -537,12 +537,12 @@ int snd_seq_event_length(snd_seq_event_t *ev)
        return len;
 }
 
-int snd_seq_event_output(void *handle, snd_seq_event_t *ev)
+int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev)
 {
        int len;
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq || !ev)
                return -EINVAL;
        len = snd_seq_event_length(ev);
@@ -659,7 +659,7 @@ static int snd_seq_decode_event(char **buf, int *len, snd_seq_event_t *ev)
  *  Current implementation uses FIFO cache.
  */
 
-int snd_seq_event_input(void *handle, snd_seq_event_t **ev)
+int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev)
 {
        snd_seq_t *seq;
        snd_seq_cell_t *cell;
@@ -667,7 +667,7 @@ int snd_seq_event_input(void *handle, snd_seq_event_t **ev)
        int count;
 
        *ev = NULL;
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        if (snd_seq_input_cell_available(seq)) {
@@ -705,12 +705,12 @@ int snd_seq_event_input(void *handle, snd_seq_event_t **ev)
        return seq->cells;
 }
 
-int snd_seq_flush_output(void *handle)
+int snd_seq_flush_output(snd_seq_t *handle)
 {
        snd_seq_t *seq;
        int result;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        if (seq->obufused <= 0)
@@ -726,22 +726,22 @@ int snd_seq_flush_output(void *handle)
        return seq->obufused;
 }
 
-int snd_seq_drain_output(void *handle)
+int snd_seq_drain_output(snd_seq_t *handle)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        seq->obufused = 0;
        return 0;
 }
 
-int snd_seq_drain_input(void *handle)
+int snd_seq_drain_input(snd_seq_t *handle)
 {
        snd_seq_t *seq;
 
-       seq = (snd_seq_t *) handle;
+       seq = handle;
        if (!seq)
                return -EINVAL;
        while (snd_seq_input_cell_available(seq))
index f0b7f71dcfe341f6ff9a6b73df764e38bc35134b..fed8528007113500a70ebf3233e9b78f06c3c4fa 100644 (file)
 #define SND_FILE_TIMER         "/dev/snd/timer"
 #define SND_TIMER_VERSION_MAX  SND_PROTOCOL_VERSION( 1, 0, 0 )
 
-typedef struct {
+struct snd_timer {
        int fd;
-} snd_timer_t;
+};
 
-int snd_timer_open(void **handle)
+int snd_timer_open(snd_timer_t **handle)
 {
        int fd, ver;
        snd_timer_t *tmr;
@@ -65,12 +65,12 @@ int snd_timer_open(void **handle)
        return 0;
 }
 
-int snd_timer_close(void *handle)
+int snd_timer_close(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
        int res;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr)
                return -EINVAL;
        res = close(tmr->fd) < 0 ? -errno : 0;
@@ -78,21 +78,21 @@ int snd_timer_close(void *handle)
        return res;
 }
 
-int snd_timer_file_descriptor(void *handle)
+int snd_timer_file_descriptor(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr)
                return -EINVAL;
        return tmr->fd;
 }
 
-int snd_timer_general_info(void *handle, snd_timer_general_info_t * info)
+int snd_timer_general_info(snd_timer_t *handle, snd_timer_general_info_t * info)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr || !info)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_GINFO, info) < 0)
@@ -100,11 +100,11 @@ int snd_timer_general_info(void *handle, snd_timer_general_info_t * info)
        return 0;
 }
 
-int snd_timer_select(void *handle, snd_timer_select_t * tselect)
+int snd_timer_select(snd_timer_t *handle, snd_timer_select_t * tselect)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr || !tselect)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_SELECT, tselect) < 0)
@@ -112,11 +112,11 @@ int snd_timer_select(void *handle, snd_timer_select_t * tselect)
        return 0;
 }
 
-int snd_timer_info(void *handle, snd_timer_info_t * info)
+int snd_timer_info(snd_timer_t *handle, snd_timer_info_t * info)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr || !info)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_INFO, info) < 0)
@@ -124,11 +124,11 @@ int snd_timer_info(void *handle, snd_timer_info_t * info)
        return 0;
 }
 
-int snd_timer_params(void *handle, snd_timer_params_t * params)
+int snd_timer_params(snd_timer_t *handle, snd_timer_params_t * params)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr || !params)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_PARAMS, params) < 0)
@@ -136,11 +136,11 @@ int snd_timer_params(void *handle, snd_timer_params_t * params)
        return 0;
 }
 
-int snd_timer_status(void *handle, snd_timer_status_t * status)
+int snd_timer_status(snd_timer_t *handle, snd_timer_status_t * status)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr || !status)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_STATUS, status) < 0)
@@ -148,11 +148,11 @@ int snd_timer_status(void *handle, snd_timer_status_t * status)
        return 0;
 }
 
-int snd_timer_start(void *handle)
+int snd_timer_start(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_START) < 0)
@@ -160,11 +160,11 @@ int snd_timer_start(void *handle)
        return 0;
 }
 
-int snd_timer_stop(void *handle)
+int snd_timer_stop(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_STOP) < 0)
@@ -172,11 +172,11 @@ int snd_timer_stop(void *handle)
        return 0;
 }
 
-int snd_timer_continue(void *handle)
+int snd_timer_continue(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr)
                return -EINVAL;
        if (ioctl(tmr->fd, SND_TIMER_IOCTL_CONTINUE) < 0)
@@ -184,12 +184,12 @@ int snd_timer_continue(void *handle)
        return 0;
 }
 
-ssize_t snd_timer_read(void *handle, void *buffer, size_t size)
+ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size)
 {
        snd_timer_t *tmr;
        ssize_t result;
 
-       tmr = (snd_timer_t *) handle;
+       tmr = handle;
        if (!tmr || (!buffer && size > 0) || size < 0)
                return -EINVAL;
        result = read(tmr->fd, buffer, size);