soumya92/barista

View on GitHub
modules/volume/alsa/alsa_capi.go

Summary

Maintainability
B
5 hrs
Test Coverage
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by capi.rb; DO NOT EDIT.

package alsa

// #cgo pkg-config: alsa
// #include <alsa/asoundlib.h>
import "C"
import "unsafe"

type ctyp_snd_mixer_t = C.snd_mixer_t
type ctyp_snd_mixer_elem_t = C.snd_mixer_elem_t
type ctyp_snd_mixer_selem_id_t = C.snd_mixer_selem_id_t
type ctyp_snd_mixer_selem_channel_id_t = C.snd_mixer_selem_channel_id_t
type ctyp_struct_snd_mixer_selem_regopt = C.struct_snd_mixer_selem_regopt
type ctyp_snd_mixer_class_t = C.snd_mixer_class_t

type alsaI interface {
    snd_mixer_attach(arg_mixer *ctyp_snd_mixer_t, arg_name string) int32
    snd_mixer_close(arg_mixer *ctyp_snd_mixer_t) int32
    snd_mixer_detach(arg_mixer *ctyp_snd_mixer_t, arg_name string) int32
    snd_mixer_find_selem(arg_mixer *ctyp_snd_mixer_t, arg_id *ctyp_snd_mixer_selem_id_t) *ctyp_snd_mixer_elem_t
    snd_mixer_free(arg_mixer *ctyp_snd_mixer_t)
    snd_mixer_handle_events(arg_mixer *ctyp_snd_mixer_t) int32
    snd_mixer_load(arg_mixer *ctyp_snd_mixer_t) int32
    snd_mixer_open(arg_mixer **ctyp_snd_mixer_t, arg_mode int32) int32
    snd_mixer_selem_get_playback_switch(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value *int32) int32
    snd_mixer_selem_get_playback_volume(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value *int64) int32
    snd_mixer_selem_get_playback_volume_range(arg_elem *ctyp_snd_mixer_elem_t, arg_min *int64, arg_max *int64) int32
    snd_mixer_selem_id_free(arg_obj *ctyp_snd_mixer_selem_id_t)
    snd_mixer_selem_id_malloc(arg_ptr **ctyp_snd_mixer_selem_id_t) int32
    snd_mixer_selem_id_set_index(arg_obj *ctyp_snd_mixer_selem_id_t, arg_val uint32)
    snd_mixer_selem_id_set_name(arg_obj *ctyp_snd_mixer_selem_id_t, arg_val string)
    snd_mixer_selem_register(arg_mixer *ctyp_snd_mixer_t, arg_options *ctyp_struct_snd_mixer_selem_regopt, arg_classp **ctyp_snd_mixer_class_t) int32
    snd_mixer_selem_set_playback_switch(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value int32) int32
    snd_mixer_selem_set_playback_switch_all(arg_elem *ctyp_snd_mixer_elem_t, arg_value int32) int32
    snd_mixer_selem_set_playback_volume(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value int64) int32
    snd_mixer_selem_set_playback_volume_all(arg_elem *ctyp_snd_mixer_elem_t, arg_value int64) int32
    snd_mixer_wait(arg_mixer *ctyp_snd_mixer_t, arg_timeout int32) int32
}

type alsaImpl struct{}

var alsa alsaI = alsaImpl{}

func (alsaImpl) snd_mixer_attach(arg_mixer *ctyp_snd_mixer_t, arg_name string) int32 {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    tmp_arg_name := C.CString(arg_name)
    defer C.free(unsafe.Pointer(tmp_arg_name))
    result_c := C.snd_mixer_attach(tmp_arg_mixer, tmp_arg_name)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_close(arg_mixer *ctyp_snd_mixer_t) int32 {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    result_c := C.snd_mixer_close(tmp_arg_mixer)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_detach(arg_mixer *ctyp_snd_mixer_t, arg_name string) int32 {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    tmp_arg_name := C.CString(arg_name)
    defer C.free(unsafe.Pointer(tmp_arg_name))
    result_c := C.snd_mixer_detach(tmp_arg_mixer, tmp_arg_name)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_find_selem(arg_mixer *ctyp_snd_mixer_t, arg_id *ctyp_snd_mixer_selem_id_t) *ctyp_snd_mixer_elem_t {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    tmp_arg_id := (*C.snd_mixer_selem_id_t)(arg_id)
    result_c := C.snd_mixer_find_selem(tmp_arg_mixer, tmp_arg_id)
    return (*ctyp_snd_mixer_elem_t)(result_c)
}
func (alsaImpl) snd_mixer_free(arg_mixer *ctyp_snd_mixer_t) {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    C.snd_mixer_free(tmp_arg_mixer)
}
func (alsaImpl) snd_mixer_handle_events(arg_mixer *ctyp_snd_mixer_t) int32 {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    result_c := C.snd_mixer_handle_events(tmp_arg_mixer)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_load(arg_mixer *ctyp_snd_mixer_t) int32 {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    result_c := C.snd_mixer_load(tmp_arg_mixer)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_open(arg_mixer **ctyp_snd_mixer_t, arg_mode int32) int32 {
    tmp_arg_mixer := (**C.snd_mixer_t)(arg_mixer)
    tmp_arg_mode := C.int(arg_mode)
    result_c := C.snd_mixer_open(tmp_arg_mixer, tmp_arg_mode)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_get_playback_switch(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value *int32) int32 {
    tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
    tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
    tmp_arg_value := (*C.int)(arg_value)
    result_c := C.snd_mixer_selem_get_playback_switch(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_get_playback_volume(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value *int64) int32 {
    tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
    tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
    tmp_arg_value := (*C.long)(arg_value)
    result_c := C.snd_mixer_selem_get_playback_volume(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_get_playback_volume_range(arg_elem *ctyp_snd_mixer_elem_t, arg_min *int64, arg_max *int64) int32 {
    tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
    tmp_arg_min := (*C.long)(arg_min)
    tmp_arg_max := (*C.long)(arg_max)
    result_c := C.snd_mixer_selem_get_playback_volume_range(tmp_arg_elem, tmp_arg_min, tmp_arg_max)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_id_free(arg_obj *ctyp_snd_mixer_selem_id_t) {
    tmp_arg_obj := (*C.snd_mixer_selem_id_t)(arg_obj)
    C.snd_mixer_selem_id_free(tmp_arg_obj)
}
func (alsaImpl) snd_mixer_selem_id_malloc(arg_ptr **ctyp_snd_mixer_selem_id_t) int32 {
    tmp_arg_ptr := (**C.snd_mixer_selem_id_t)(arg_ptr)
    result_c := C.snd_mixer_selem_id_malloc(tmp_arg_ptr)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_id_set_index(arg_obj *ctyp_snd_mixer_selem_id_t, arg_val uint32) {
    tmp_arg_obj := (*C.snd_mixer_selem_id_t)(arg_obj)
    tmp_arg_val := C.unsigned(arg_val)
    C.snd_mixer_selem_id_set_index(tmp_arg_obj, tmp_arg_val)
}
func (alsaImpl) snd_mixer_selem_id_set_name(arg_obj *ctyp_snd_mixer_selem_id_t, arg_val string) {
    tmp_arg_obj := (*C.snd_mixer_selem_id_t)(arg_obj)
    tmp_arg_val := C.CString(arg_val)
    defer C.free(unsafe.Pointer(tmp_arg_val))
    C.snd_mixer_selem_id_set_name(tmp_arg_obj, tmp_arg_val)
}
func (alsaImpl) snd_mixer_selem_register(arg_mixer *ctyp_snd_mixer_t, arg_options *ctyp_struct_snd_mixer_selem_regopt, arg_classp **ctyp_snd_mixer_class_t) int32 {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    tmp_arg_options := (*C.struct_snd_mixer_selem_regopt)(arg_options)
    tmp_arg_classp := (**C.snd_mixer_class_t)(arg_classp)
    result_c := C.snd_mixer_selem_register(tmp_arg_mixer, tmp_arg_options, tmp_arg_classp)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_set_playback_switch(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value int32) int32 {
    tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
    tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
    tmp_arg_value := C.int(arg_value)
    result_c := C.snd_mixer_selem_set_playback_switch(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_set_playback_switch_all(arg_elem *ctyp_snd_mixer_elem_t, arg_value int32) int32 {
    tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
    tmp_arg_value := C.int(arg_value)
    result_c := C.snd_mixer_selem_set_playback_switch_all(tmp_arg_elem, tmp_arg_value)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_set_playback_volume(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value int64) int32 {
    tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
    tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
    tmp_arg_value := C.long(arg_value)
    result_c := C.snd_mixer_selem_set_playback_volume(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_selem_set_playback_volume_all(arg_elem *ctyp_snd_mixer_elem_t, arg_value int64) int32 {
    tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
    tmp_arg_value := C.long(arg_value)
    result_c := C.snd_mixer_selem_set_playback_volume_all(tmp_arg_elem, tmp_arg_value)
    return int32(result_c)
}
func (alsaImpl) snd_mixer_wait(arg_mixer *ctyp_snd_mixer_t, arg_timeout int32) int32 {
    tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
    tmp_arg_timeout := C.int(arg_timeout)
    result_c := C.snd_mixer_wait(tmp_arg_mixer, tmp_arg_timeout)
    return int32(result_c)
}