Commit Graph

216 Commits

Author SHA1 Message Date
Hajime Hoshi
12350e2fee Fix build tags for Go 1.17 2021-08-17 12:27:19 +09:00
Hajime Hoshi
226e981ebe audio/internal/readerdriver: Refactoring: Clean the build tags up 2021-08-17 00:43:50 +09:00
Hajime Hoshi
c2a5f4ab94 audio/internal/readerdriver: Add comments about Windows
Updates #1710
2021-07-21 23:23:12 +09:00
Hajime Hoshi
5750c48a3b audio/internal/oboe: Remove 'generate' build tag 2021-07-21 21:33:31 +09:00
Hajime Hoshi
e9d0c84803 audio/internal/oboe: Add //go:build 2021-07-21 21:25:30 +09:00
Hajime Hoshi
17869143c0 audio/internal/readerdriver: Do mixing on Ebiten side
Creating a new AudioQueue is more expensive than expected, and
this caused a little blocking the game when playing a lot of SEs.

Closes #1702
Updates #1680
2021-07-08 23:11:05 +09:00
Hajime Hoshi
371bbfc0f2 audio/internal/readerdriver: Bug fix: Avoid AudioQueueReset
Instead, call AudioQueueStop and discard the current AudioQueue.

Closes #1680
Updates #1650
2021-06-26 01:14:37 +09:00
Hajime Hoshi
ab5f5cbfea audio/internal/readerdriver: Bug fix: Race condition on UNIX/Linux
Updates #1680
2021-06-25 03:17:42 +09:00
Hajime Hoshi
c7ac5a32b5 audio/internal/readerdriver: Stop using the reader driver
Apparently #1680 seems pretty hard to fix. Use the old Oto
implementation until this issue is fixed.

Updates #1680
2021-06-25 01:05:00 +09:00
Hajime Hoshi
47dfba69a5 audio/internal/readerdriver: Bug fix: Race condition on macOS/iOS
Updates #1680
2021-06-25 00:32:27 +09:00
Hajime Hoshi
b54ad73a2b Add go:build comments with go1.17beta1 fmt 2021-06-11 01:11:46 +09:00
Hajime Hoshi
95c494f47e audio/internal/readerdriver: Share one goroutine to read the source to the buffers (iOS/macOS)
This fix improves the latency of the audio.

Closes #1662
2021-06-09 01:52:21 +09:00
Hajime Hoshi
67e5fae9c0 audio/internal/readerdriver: Refactoring 2021-06-09 00:29:01 +09:00
Hajime Hoshi
a627c41217 Remove support of Go 1.13 and Go 1.14
Updates #1258
Updates #1415
Updates #1462
2021-06-07 21:44:22 +09:00
Hajime Hoshi
4276e2964e audio/internal/oboe: Use a bigger buffer for safety
There were sometimes slight noises on a low-end device like Asus
Zenfone (ASUS_X013DB).

Updates #1662
2021-06-07 03:52:30 +09:00
Hajime Hoshi
61682d6d5c audio/internal/oboe: Nil slice should be safe to convert to reflect.SliceHeader 2021-06-07 03:33:09 +09:00
Hajime Hoshi
658192f83d audio/internal/readerdriver: Bug fix: A player must be the EOF state when the buffer is empty 2021-06-07 03:20:48 +09:00
Hajime Hoshi
9f9d53aad3 audio/internal/readerdriver: Bug fix: Possible busy loop when a player reaches EOF 2021-06-07 03:03:22 +09:00
Hajime Hoshi
ea6e2091c5 audio/internal/oboe: Do not call a Go function from onAudioReady
Calling a Go function from C has some overhead. onAudioReady is a
very performance-critical function and should not call Go function.

Updates #1662
2021-06-07 00:01:09 +09:00
Hajime Hoshi
78459953cf audio/internal/readerdriver: Use the common player implementation for Android
Updates #1662
2021-06-06 22:53:56 +09:00
Hajime Hoshi
0aeb409eba audio/internal/readerdriver: Refactoring: Separate the player part (Linux)
Updates #1549
2021-06-06 16:27:03 +09:00
Hajime Hoshi
a74c00074e audio/internal/readerdriver: Refactoring
Updates #1549
2021-06-06 16:17:14 +09:00
Hajime Hoshi
048a30b4e7 audio/internal/readerdriver: Refactoring (Linux)
Updates #1549
2021-06-06 14:19:23 +09:00
Hajime Hoshi
7b320f2aeb audio/internal/readerdriver: Adjust buffer size for low-spec machines (Linux)
Updates #1549
2021-06-05 23:00:52 +09:00
Hajime Hoshi
85b436b5bb audio/internal/readerdriver: Reduce locked scopes (Linux)
Updates #1549
2021-06-05 22:01:55 +09:00
Hajime Hoshi
044a0c69a7 audio/internal/readerdriver: Avoid busy loop (Linux)
Updates #1549
2021-06-05 21:33:43 +09:00
Hajime Hoshi
be7bc5ae4c audio/internal/readerdriver: Remove goroutines to improve latency (Linux)
Updates #1549
2021-06-05 21:09:20 +09:00
Hajime Hoshi
da55ab895a audio/internal/readerdriver: Use PulseAudio for Linux/UNIX
Updates #1549
2021-06-05 19:46:36 +09:00
Hajime Hoshi
3fb469d5a5 audio/internal/readerdriver: Add comments (Windows)
Updates #1549
2021-06-04 23:58:35 +09:00
Hajime Hoshi
08dbb41b35 audio/internal/oboe: Implement self-mixing and re-enable Oboe
Updates #1549
Updates #1656
Closes #1660
2021-06-03 00:54:42 +09:00
Hajime Hoshi
633cfe3a0f audio/internal/readerdriver: Update comments
Updates #1660
2021-06-02 00:35:20 +09:00
Hajime Hoshi
0f5aa315d6 audio/internal/oboe: Bug fix: Player must be protected by a mutex
As Close can be invoked by the finalizer, Player must be concurrent
safe. Especially the member player must be synced.

Updates #1549
Updates #1656
2021-06-01 03:01:35 +09:00
Hajime Hoshi
b0a8ecefeb android/internal/oboe: Update Oboe to 1.6.0 2021-05-30 05:07:16 +09:00
Hajime Hoshi
cfb6c2c3ad audio/internal/readerdriver: Disable Android readerdriver
Disable Android reade rdriver, which uses OpenSL. AAudio should be
used as OpenSL causes an issue especially on Android 8.

Updates #1656
2021-05-30 01:45:23 +09:00
Hajime Hoshi
c46981a719 audio/internal/readerdriver: Refactoring (Windows) 2021-05-29 03:43:05 +09:00
Hajime Hoshi
98bfe5a692 audio/internal/readerdriver: Reimplement Windows driver with multiple waveOutOpen
This improves the result of examples/piano significantly.

The issue of mutexes (#1652) is also resolved by this new
implementation.

Closes #1652
Closes #1653
2021-05-28 23:54:36 +09:00
Hajime Hoshi
3e113e69e8 audio/internal/readerdriver: Revert 2 commits
This reverts commit 43789c72a9.
This reverts commit 100b42513e.

Updates #1652
Updates #1653

Reason: This causes noises on examples/piano when a lot of notes played at the same time
2021-05-28 22:19:57 +09:00
Hajime Hoshi
43789c72a9 audio/internal/readerdriver: Bug fix: some of waveOut* functions should be protected by mutex (Windows)
Updates #1652
2021-05-28 21:10:39 +09:00
Hajime Hoshi
100b42513e audio/internal/readerdriver: Reduce the mutex usages (Windows)
Closes #1652
2021-05-28 21:00:16 +09:00
Hajime Hoshi
c2148dcc01 Revert "tmp"
This reverts commit 9619276326.

Reason: Wrong commit
2021-05-28 19:49:59 +09:00
Hajime Hoshi
9619276326 tmp 2021-05-28 19:38:03 +09:00
Hajime Hoshi
dc2f5e296e audio/internal/readerdriver: Reduce mutext on Windows
The granularity of context switches on Windows is pretty big and
mutexes might not be efficent.
2021-05-28 19:25:59 +09:00
Hajime Hoshi
646f48ef09 audio/internal/readerdriver: Change the timing of updating the player state (Windows) 2021-05-28 17:10:28 +09:00
Hajime Hoshi
c54e5371ad audio/internal/readerdriver: Refactoring (Windows) 2021-05-28 16:45:55 +09:00
Hajime Hoshi
541156f255 audio/internal/readerdriver: Wait the loop when there is no player (Windows) 2021-05-28 16:16:56 +09:00
Hajime Hoshi
6a8abac194 audio/interna/readerdriver: Bug fix: Potential issue when all the players were gone
When all the players were gone, the waveOut is closed once. From
this state, playing an audio again might take long.

This change fixes the issue by not closing the waveOut even when
all the players are gone.

This change also changes the returning value of read when the
player doesn't play.
2021-05-28 16:09:43 +09:00
Hajime Hoshi
c3b8fa1c45 audio/internal/readerdriver: Handle errors correctly (Windows) 2021-05-28 14:09:05 +09:00
Hajime Hoshi
6c3c3533fb audio/internal/readerplayer: Bug fix: Potential deadlock when waveOutWrite failed (Windows) 2021-05-28 05:17:32 +09:00
Hajime Hoshi
f334eee1e4 audio/internal/readerdriver: Refactoring: unify add and play (Windows) 2021-05-28 04:40:50 +09:00
Hajime Hoshi
72d8d77173 audio/internal/readerdriver: Bug fix: AudioQueuePause/Reset might take long time
This issue has existed since ae14caee93.
This change fixes the issue by skipping the C function calls when
possible.

Updates #1650
2021-05-28 02:51:14 +09:00