forked from gen2brain/malgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmini_al.go
34 lines (28 loc) · 988 Bytes
/
mini_al.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Package mal - Mini audio library (mini_al cgo bindings).
package malgo
/*
#cgo CFLAGS: -std=gnu99
#cgo mal_debug CFLAGS: -DMAL_DEBUG_OUTPUT=1
#cgo linux LDFLAGS: -ldl -lpthread -lm
#cgo openbsd LDFLAGS: -ldl -lpthread -lm
#cgo netbsd LDFLAGS: -ldl -lpthread -lm
#cgo freebsd LDFLAGS: -ldl -lpthread -lm
#cgo android LDFLAGS: -lOpenSLES
#cgo !noasm,!arm,!arm64 CFLAGS: -msse2
#cgo !noasm,arm,arm64 CFLAGS: -mfpu=neon -mfloat-abi=hard
#cgo noasm CFLAGS: -DMAL_NO_SSE2 -DMAL_NO_AVX -DMAL_NO_AVX512 -DMAL_NO_NEON
#include "malgo.h"
*/
import "C"
import "unsafe"
// SampleSizeInBytes retrieves the size of a sample in bytes for the given format.
func SampleSizeInBytes(format FormatType) int {
cformat := (C.mal_format)(format)
ret := C.mal_get_bytes_per_sample(cformat)
return int(ret)
}
const (
rawContextConfigSize = unsafe.Sizeof(C.mal_context_config{})
rawDeviceInfoSize = unsafe.Sizeof(C.mal_device_info{})
rawDeviceConfigSize = unsafe.Sizeof(C.mal_device_config{})
)