2
0
mirror of synced 2025-02-22 14:28:14 +00:00

23 Commits

Author SHA1 Message Date
Russ Cox
ce6a79cf6a all: gofmt
Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: I9b4c287e2d25aa108adfa9fe2f972c8fd3d68fe1
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/399597
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-04-14 15:34:00 +00:00
Russ Cox
bdb1ca9a1e all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I30822eb504168b037ed3ec0f7759da1f41251f52
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/294374
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-20 03:30:13 +00:00
Tobias Klauser
ca3c58166e all: use "reports whether" in godoc comments
Go documentation style for boolean funcs is to say:

    // Foo reports whether ...
    func Foo() bool

rather than "returns true if" or "returns whether".

Change-Id: I5d01c45a8867b47462ed142a49ad51bf0a319ce1
Reviewed-on: https://go-review.googlesource.com/c/151957
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-11-30 13:31:20 +00:00
Jean-André Santoni
269a7ef90d exp/audio/al: add windows support
Tested on Win64 with mingw-w64 and http://kcat.strangesoft.net/openal-binaries/openal-soft-1.18.2-bin.zip

Change-Id: Iec1bf3c0898310878133dc6d9ecfb8781b410347
GitHub-Last-Rev: a71e8eb2b9046b499e1a1911e55cc2534aff8e71
GitHub-Pull-Request: golang/mobile#18
Reviewed-on: https://go-review.googlesource.com/114003
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-05-22 19:29:39 +00:00
Elias Naur
64505ab867 exp/audio/al: use the correct native library dir to locate libopenal.so
Use Context.getApplicationInfo().nativeLibraryDir to locate
libopenal.so. That path is always correct, even on newer devices.

Found while testing external NDK use on Windows.

Manually tested; there are no existing OpenAL tests or examples.

Change-Id: Ie204a7d7139566f85c9121126722ad597f9d6b19
Reviewed-on: https://go-review.googlesource.com/35175
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2017-01-13 01:38:11 +00:00
Hana Kim
f58d095fc5 exp/audio: add instruction for installing required package
The error message from cgo will print the line, which now
includes the instruction as a comment.

Change-Id: I208365b5b1e4da0bd6df89882586fe438f7391b4
Reviewed-on: https://go-review.googlesource.com/25384
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-01 16:20:48 +00:00
Burcu Dogan
ed70d674be exp/audio/al: cleanup unnecessary casts
As a follow-up to CL/19472, I am removing the unnecessary casts. It
turned out that the only call sites that will benefit from this change
are the ones added in CL/19472. Sorry for the additional CL.

Change-Id: Ib6bdffefad5b84beb57108a74ebcedc25b7ef7b3
Reviewed-on: https://go-review.googlesource.com/19653
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-02-19 07:12:45 +00:00
Burcu Dogan
77abf9cb27 exp/audio/al: add more generic getters
Updates golang/go#13912.

Change-Id: I0eb017513872c9d44364b8c96e632ce3d08c6e10
Reviewed-on: https://go-review.googlesource.com/19472
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-18 20:47:01 +00:00
Burcu Dogan
022ca03242 exp/audio/al: export generic getters/setters
Updates golang/go#13912.

Change-Id: I2dadbba0c155c1f4b53663031069098d3f3b156a
Reviewed-on: https://go-review.googlesource.com/18541
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-27 23:20:06 +00:00
Burcu Dogan
232ac8377e asset,exp/audio/al: cast context to jobject
Fixes golang/go#13823.

Change-Id: I13fc9234a2fb991312c148e7d779271454cb7b90
Reviewed-on: https://go-review.googlesource.com/18511
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-11 21:23:51 +00:00
Burcu Dogan
3ca3fec8ee exp/audio/al: add Capability type, export distance model capability
Fixes golang/go#11298.

Change-Id: I3f103a2c1a63e96ca8c7367994179fb32d5ec7db
Reviewed-on: https://go-review.googlesource.com/16435
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 21:42:10 +00:00
Burcu Dogan
7c674f7f33 exp/audio/al: use variadic functions everywhere
Change-Id: I827bca98398b2fabd9dfb8970452d8968555487b
Reviewed-on: https://go-review.googlesource.com/16402
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 20:20:45 +00:00
David Crawshaw
eadadb8667 internal/mobileinit: standardize JNIEnv* access
Replace the direct access to JavaVM* and the global android Context
instance with a function responsible for running attached correctly
to the JVM. This saves having to replicate the logic for attaching an
OS thread to the JVM. While here, check for any unhandled Java
exceptions.

This supersedes cl/11812.

Change-Id: Ic9291fe64083d2bd983c4f8e309941b9c47d60c2
Reviewed-on: https://go-review.googlesource.com/14162
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-14 17:30:52 +00:00
Hyang-Ah (Hana) Kim
136fa9bbbb bind/java: reenable asset access.
This is done by moving app.Context to internal/mobileinit,
introducing mobileinit.SetCurrentContext and,
making bind/java depend on it.

TODO: check gomobile bind's proguard rule - context lookup
was implemented through reflection on android.app.AppGlobals class.

Change-Id: Ieb6ad503eeef8c2c1c5836a21c667938c5a701a2
Reviewed-on: https://go-review.googlesource.com/12279
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-16 21:15:37 +00:00
Burcu Dogan
adcf40b30c exp/audio/al: avoid creation of multiple contexts
This CL reverts the changes made in golang/go#11299.

Allowing creation of multiple contexts break the case of multiple
third party packages depending on the al bindings. These packages
need to make sure that there is a valid current context or initiate
and make a context current. Packages racing to create and make a
context current is what we would like to avoid.

Therefore, al bindings will support only a single context that is
initiated during OpenDevice.

Fixes golang/go#11385.

Change-Id: I662f70e49d12833a545005cf0724cc21f67bea09
Reviewed-on: https://go-review.googlesource.com/12001
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-11 16:23:18 +00:00
Burcu Dogan
383ad68fc0 exp/audio: APIs should not use Context pointer type
This CL is a followup of CL/11315 where it is suggested to remove
Context pointer types from the signatures.

Change-Id: Ice68bfabad0e345f7d93102257a99402be8760b5
Reviewed-on: https://go-review.googlesource.com/11560
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-30 06:09:10 +00:00
Nigel Tao
d06bbc53e4 exp/audio/al: use the standard log library, if al_init fails.
This means that there's only one adb log prefix that Go app developers
need to watch: GoLog.

Change-Id: I562566b92a7bba19f7c7a9cc71315bea02844db1
Reviewed-on: https://go-review.googlesource.com/11609
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-30 06:08:38 +00:00
Nigel Tao
d1d3d8a5a0 exp/audio/al: delete a debugging log message.
This was accidentally introduced in
https://go-review.googlesource.com/#/c/11351/

Change-Id: Icc9bc9ccb97e48d376e0da440b72631e605a0a15
Reviewed-on: https://go-review.googlesource.com/11608
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 04:33:40 +00:00
Nigel Tao
b6ec031d27 exp/audio/al: call log.Fatalf for a dlsym failure.
Change-Id: I197e101f2b93c2aa9dc69cb697afa68a69142783
Reviewed-on: https://go-review.googlesource.com/11537
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-29 01:50:48 +00:00
Nigel Tao
42f0d17876 app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.

Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.

As side-effects:
  - In package app/debug, DrawFPS now takes an explicit Config.
  - In package app, some callbacks now take an explicit Config.
  - In package exp/sprite, Render now takes an explicit Config.
  - In package event, there are new events (Config, Draw, Lifecycle),
    and an event filter mechanism to replace multiple app Callbacks.
  - In package geom, the deprecated Width, Height and PixelsPerPt global
    variables were removed in favor of an event.Config that is
    explicitly passed around (and does not require mutex-locking).
    Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
  - In package gl, the Do, Start and Stop functions are removed, as well
    as the need to call Start in its own goroutine. There is no longer a
    separate GL thread. Instead, package app explicitly performs any GL
    work (gl.DoWork) when some is available (gl.WorkAvailable).
  - In package gl/glutil, Image.Draw now takes an explicit Config.

Callbacks are no longer executed on 'the UI thread'.

Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.

Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-26 07:43:17 +00:00
Burcu Dogan
0a8a8b8cb6 exp/audio/al,cmd/gomobile: fix the broken build
Change-Id: Ia2da7d987f253c11a62843f54051c9d18c1612b5
Reviewed-on: https://go-review.googlesource.com/11521
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-26 07:40:05 +00:00
Burcu Dogan
25dc511cde exp/audio: allow multiple instances of al.Context
Fixes golang/go#11299.

Change-Id: Ie59981a0515abcf015c7b22d05d2cdbb8be35f56
Reviewed-on: https://go-review.googlesource.com/11315
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-26 06:57:01 +00:00
Burcu Dogan
1d641b5393 audio: move to exp/audio
Change-Id: I8640b1a38a292972db6dd00506e38c89470b2c15
Reviewed-on: https://go-review.googlesource.com/11311
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-21 18:18:56 +00:00