+}
+
+PUBLIC unsigned int _alsa_get_volume (unsigned int num) {
+
+ if (!dev_ctx || !dev_ctx[num])
+ return;
+
+ snd_mixer_selem_get_playback_volume (dev_ctx[num]->mixer_elm, SND_MIXER_SCHN_FRONT_LEFT, &dev_ctx[num]->vol);
+
+ return (unsigned int)(dev_ctx[num]->vol*100)/dev_ctx[num]->vol_max;
+}
+
+PUBLIC unsigned int _alsa_set_volume (unsigned int num, unsigned int vol) {
+
+ if (!dev_ctx || !dev_ctx[num] || vol > 100)
+ return;
+
+ snd_mixer_selem_set_playback_volume_all (dev_ctx[num]->mixer_elm, (vol*dev_ctx[num]->vol_max)/100);
+}
+
+PUBLIC unsigned char _alsa_get_mute (unsigned int num) {
+
+ int mute = 0;
+
+ if (!dev_ctx || !dev_ctx[num])
+ return;
+
+ if (snd_mixer_selem_has_playback_switch (dev_ctx[num]->mixer_elm)) {
+ snd_mixer_selem_get_playback_switch (dev_ctx[num]->mixer_elm, SND_MIXER_SCHN_FRONT_LEFT, &mute);
+ snd_mixer_selem_get_playback_switch (dev_ctx[num]->mixer_elm, SND_MIXER_SCHN_FRONT_RIGHT, &mute);
+
+ }
+
+ return (unsigned char)mute;
+}
+
+PUBLIC void _alsa_set_mute (unsigned int num, unsigned char mute) {
+
+ if (!dev_ctx || !dev_ctx[num] || 1 < mute < 0)
+ return;
+
+ if (snd_mixer_selem_has_playback_switch (dev_ctx[num]->mixer_elm))
+ snd_mixer_selem_set_playback_switch_all (dev_ctx[num]->mixer_elm, mute);
+}
+
+PUBLIC void _alsa_set_rate (unsigned int num, unsigned int rate) {
+
+ if (!dev_ctx || !dev_ctx[num])
+ return;
+
+ snd_pcm_hw_params_set_rate_near (dev_ctx[num]->dev, dev_ctx[num]->params, &rate, 0);
+}
+
+PUBLIC void _alsa_set_channels (unsigned int num, unsigned int channels) {
+
+ if (!dev_ctx || !dev_ctx[num])
+ return;
+
+ snd_pcm_hw_params_set_channels (dev_ctx[num]->dev, dev_ctx[num]->params, channels);
+}