From 333098d850b97f70bfc82c19519677bae031af17 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Mon, 2 Mar 2015 11:09:14 +1100 Subject: [PATCH] audio: build on linux, not just darwin. Change-Id: Ie10c29012bf6769591a1ad1c1e9ee322d780608e Reviewed-on: https://go-review.googlesource.com/6392 Reviewed-by: David Crawshaw --- audio/al/al.go | 18 ++++++++++++++---- audio/al/const.go | 4 ++-- audio/alc/alc.go | 14 +++++++++++++- audio/audio.go | 2 +- audio/audio_test.go | 2 +- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/audio/al/al.go b/audio/al/al.go index 1eb5a74..2f1292e 100644 --- a/audio/al/al.go +++ b/audio/al/al.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin +// +build darwin linux,!android // Package al provides OpenAL Soft bindings for Go. // @@ -11,20 +11,30 @@ package al /* -// TODO(jbd,crawshaw): Add android, linux and windows support. +// TODO(jbd,crawshaw): Add android and windows support. -#cgo darwin CFLAGS: -DGOOS_darwin -#cgo darwin LDFLAGS: -framework OpenAL +#cgo darwin CFLAGS: -DGOOS_darwin +#cgo linux CFLAGS: -DGOOS_linux +#cgo darwin LDFLAGS: -framework OpenAL +#cgo linux LDFLAGS: -lopenal #ifdef GOOS_darwin #include #include #endif +#ifdef GOOS_linux +#include +#endif */ import "C" import "unsafe" +/* +On Ubuntu 14.04 'Trusty', you may have to install these libraries: +sudo apt-get install libopenal-dev +*/ + // Enable enables a capability. func Enable(capability int32) { C.alEnable(C.ALenum(capability)) diff --git a/audio/al/const.go b/audio/al/const.go index db4450d..02fe1e2 100644 --- a/audio/al/const.go +++ b/audio/al/const.go @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package al +// +build darwin linux,!android -// +build darwin +package al // Error returns one of these error codes. const ( diff --git a/audio/alc/alc.go b/audio/alc/alc.go index 65b3258..f1aa94a 100644 --- a/audio/alc/alc.go +++ b/audio/alc/alc.go @@ -2,23 +2,35 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin +// +build darwin linux,!android // Package alc provides OpenAL's ALC (Audio Library Context) bindings for Go. package alc /* #cgo darwin CFLAGS: -DGOOS_darwin +#cgo linux CFLAGS: -DGOOS_linux #cgo darwin LDFLAGS: -framework OpenAL +#cgo linux LDFLAGS: -lopenal #ifdef GOOS_darwin #include #include #endif + +#ifdef GOOS_linux +#include +#include +#endif */ import "C" import "unsafe" +/* +On Ubuntu 14.04 'Trusty', you may have to install these libraries: +sudo apt-get install libopenal-dev +*/ + // Error returns one of these values. const ( InvalidDevice = 0xA001 diff --git a/audio/audio.go b/audio/audio.go index 1a58044..239aea5 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin +// +build darwin linux,!android // Package audio provides a basic audio player. package audio diff --git a/audio/audio_test.go b/audio/audio_test.go index fd04217..1d96e3c 100644 --- a/audio/audio_test.go +++ b/audio/audio_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin +// +build darwin linux,!android package audio