Commit Graph

734 Commits

Author SHA1 Message Date
divVerent
21207f827c
do not require installing file2byteslice to update go generate'd files. (#2221)
The tool is already referenced in go.mod, so it is trivial to just go run it -
that way, go generate can use it without the user explicitly installing it first.
2022-07-29 20:43:23 +09:00
Hajime Hoshi
20082b3879 audio: add more explanations to Resample 2022-07-23 18:35:53 +09:00
Vseslav Kochenov
00b530bfcc
audio: add Resample (#2212)
Closes #2055
2022-07-23 18:32:22 +09:00
Hajime Hoshi
017ad69e93 audio: add comments 2022-07-23 18:17:05 +09:00
Hajime Hoshi
921aeb4ea7 audio: rename channelNum -> channelCount 2022-07-13 02:08:38 +09:00
Hajime Hoshi
c77e5884aa audio: change the naming convention: Num -> Count 2022-07-13 01:46:20 +09:00
Hajime Hoshi
428b1263d9 add ebitenginecbackend build tag besides ebitencbackend
Updates #2111
Updates #2190
2022-07-09 15:23:52 +09:00
Hajime Hoshi
8cb023e3c8 audio: refactoring: remove Reset from Player 2022-07-01 02:33:39 +09:00
Hajime Hoshi
7232b1a8a9 audio: bug fix: test failures 2022-07-01 02:31:29 +09:00
Hajime Hoshi
a516a5b092 update Oto (for refactoring) 2022-07-01 02:28:20 +09:00
Hajime Hoshi
858f3926ee audio/internal/cbackend: add comments 2022-07-01 02:26:09 +09:00
Hajime Hoshi
12d274eb0a update Oto for a player's Seek
Updates hajimehoshi/oto#172
2022-07-01 02:21:19 +09:00
Hajime Hoshi
abc8697ea3 audio: fix a wrong comment 2022-07-01 02:06:30 +09:00
Hajime Hoshi
75e84f6eda audio/mp3, audio/vorbis, audio/wav: add DecodeWithoutResampling
Updates #2055
2022-07-01 01:46:37 +09:00
Hajime Hoshi
d6e257084d audio: bug fix: potential busy reading after the source reaches EOF
Closes #2167
Updates hajimehoshi/oto#171
2022-06-27 22:54:33 +09:00
Hajime Hoshi
22c609dd1e audio: rename Ebiten -> Ebitengine 2022-05-26 00:27:27 +09:00
Hajime Hoshi
3f0b3f9686 audio/internal/cbackend: refactoring: remove unnecessary mutex locks 2022-04-12 21:04:10 +09:00
Hajime Hoshi
7a33837ed7 audio: change the type of SetBufferSize to time.Duration
Updates #2026
2022-03-25 20:47:01 +09:00
Hajime Hoshi
0e8c423e51 Revert "audio: add (*Player).UnplayedBufferSize (#2021)"
This reverts commit 7744013b05.

Reason: This is no longer needed and SetBufferSize is enough.

Updates #2020
Updates #2026
2022-03-25 20:28:32 +09:00
Hajime Hoshi
08783542eb audio: add Player.SetBufferSize
This change also adds examples/realtimepcm.

Closes #2026
2022-03-25 19:27:25 +09:00
Hajime Hoshi
d74a627f41 audio/internal/cbackend: adjust the defalut buffer size to Oto's 2022-03-25 03:47:21 +09:00
Hajime Hoshi
e2de758160 audio/internal/cbackend: update comments 2022-03-25 03:46:57 +09:00
Hajime Hoshi
7744013b05
audio: add (*Player).UnplayedBufferSize (#2021)
Closes #2020
2022-03-22 16:55:56 +09:00
Hajime Hoshi
e4fba8b047 bug fix: compile error with Go 1.16 and older 2022-03-08 00:08:53 +09:00
Hajime Hoshi
6a1c17b06f audio/internal/cbackend: bug fix: use CompareAndSwap 2022-03-07 23:45:42 +09:00
Hajime Hoshi
1cb7633ff6 internal/ui: bug fix: atomic.Value.Store cannot be called when a differnet type value is already stored 2022-02-27 17:41:19 +09:00
Hajime Hoshi
011e5061df internal/cbackend: simplify the audio API 2021-12-23 22:20:04 +09:00
Hajime Hoshi
e6131894a7 internal/cbackend: add AudioBufferSizeInSeconds 2021-12-23 02:55:54 +09:00
Hajime Hoshi
1799ed0b28 add a build tag 'ebitencbackend' and internal/cbackend
This enables to create a C archive with Ebiten without an actual driver
implementation. This enables Ebiten work on a platform Go doesn't support.
See also Hitsumabushi project: github.com/hajimehoshi/hitsumabushi.

The backend C API is not stable and might change later. Then, the build
tag 'ebitencbackend' is not documented on purpose.

Closes #1900
2021-12-22 21:12:48 +09:00
Hajime Hoshi
336ed49bdc audio: bug fix: compile error on tests 2021-12-17 16:04:39 +09:00
Hajime Hoshi
eaaa601261 audio: refactoring: rename types 2021-12-17 16:02:12 +09:00
Hajime Hoshi
55add3e323 audio: reduce dependency on the package oto
Updates #1900
2021-12-17 15:51:07 +09:00
Hajime Hoshi
1eb5d4a188 audio: Add comments
Updates #1888
2021-11-30 21:56:47 +09:00
Hajime Hoshi
2d231c8454 audio: Add comment at NewInfiniteLoopWithIntro about the noises
Updates #1888
2021-11-30 00:29:11 +09:00
Hajime Hoshi
c91a6fb81f audio: Blend the loop start and after-the-loop part to reduce noises at InfiniteLoop
Closes #1888
2021-11-30 00:00:50 +09:00
Hajime Hoshi
90f59aad7c audio: Refactoring: Use the underlying source's Seek in Read (reland) 2021-11-29 20:56:39 +09:00
Hajime Hoshi
b81736793d Revert "audio: Refactoring: Use the underlying source's Seek in Read"
This reverts commit 15ba3ed4d1.

Reason: Test failure
2021-11-29 19:36:28 +09:00
Hajime Hoshi
15ba3ed4d1 audio: Refactoring: Use the underlying source's Seek in Read 2021-11-29 17:21:40 +09:00
Hajime Hoshi
88a27151ef audio: Fix documentation
ReadSeekCloser no longer exists.

Closes #1869
2021-11-10 01:27:35 +09:00
Hajime Hoshi
a3eb8933e5 audio/internal/convert: Simplify f32Reader implementation 2021-10-31 19:49:40 +09:00
Hajime Hoshi
630df60894 audio/internal/convert: Reuse a buffer cache 2021-10-31 19:40:58 +09:00
Hajime Hoshi
611cbad5d7 audio/internal/convert: Use byte instead of uint8 2021-10-31 19:34:52 +09:00
Hajime Hoshi
5b768679a3 audio: Bug fix: Compile error 2021-10-22 15:35:05 +09:00
Hajime Hoshi
d9967c53e5 audio: Treat Oto context's error 2021-10-22 15:29:00 +09:00
Hajime Hoshi
69087cdc40 audio: Use (*Context).NewPlayer 2021-10-07 22:34:59 +09:00
r3vit
57c45a13e4
Remove dot imports from tests - Remove dot imports (#1837)
Closes #1824
2021-10-02 19:58:48 +09:00
Hajime Hoshi
7422a3353a audi/internal/conver: Fix ring-buffer-like slice usages 2021-09-12 17:06:36 +09:00
Hajime Hoshi
21e0768937 audio/internal/reader: Move the driver part to Oto v2
Closes #1779
2021-08-22 02:10:39 +09:00
Hajime Hoshi
7a5254f48f audio: Refactoring 2021-08-22 00:36:28 +09:00
Hajime Hoshi
88da1bb23f audio: Bug fix: Compile failure on JS/Wasm 2021-08-22 00:29:05 +09:00
Hajime Hoshi
fe4f96e261 audio/internal/readerdriver: Refactoring for documentations
Updates #1779
2021-08-22 00:10:31 +09:00
Hajime Hoshi
fb1ab5e779 audio: Refactoring 2021-08-21 20:10:12 +09:00
Hajime Hoshi
5474a52392 audio: Bug fix: The tests failed
Updates #1665
2021-08-21 19:49:34 +09:00
Hajime Hoshi
a93897d9d2 audio: Remove Oto (v0) usages
Closes #1665
2021-08-21 19:29:32 +09:00
Hajime Hoshi
9f1113b733 audio/internal/readerdriver: Remove goroutines for Windows
Also this change changed the buffers to use smaller but more
headers to improve latency.

Updates #1768
2021-08-19 02:19:06 +09:00
Hajime Hoshi
ded679c071 audio/internal/readerdriver: Experimental increase of buffers
Also, this change reduces goroutine uses for efficiency.

Updates #1768
2021-08-19 00:03:12 +09:00
Hajime Hoshi
045b14ba21 audio/internal/readerdriver: Reimplement Windows audio with the common players
Updates #1710
Updates #1768
2021-08-18 22:49:07 +09:00
Hajime Hoshi
c87e0df8a4 audio/internal/readerdriver: Make the implementation thread safe (Unix)
Closes #1771
2021-08-18 21:53:45 +09:00
Hajime Hoshi
9f0e95f6a2 audio/internal/readerdriver: Clean the build tags up 2021-08-18 02:37:15 +09:00
Hajime Hoshi
13e84f0224 audio/internal/readerdriver: Use ALSA instead of PulseAudio
Updates #1633
Closes #1761
Updates #1766
2021-08-18 02:03:12 +09:00
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
92bc5c1908 audio: Add (*Context).NewPlayer and (*Context).NewPlayerFromBytes
Closes #1708
2021-07-22 16:41:04 +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
502455f5b2 audio: Bug fix: Deadlock in ensurePlayer
Updates #1709
2021-07-10 19:52:15 +09:00
Hajime Hoshi
1e3df9f391 audio: Bug fix: readerdriver.NewContext might be called multiple times
Updates #1709
2021-07-10 19:50:48 +09:00
Hajime Hoshi
4b7064ac58 audio: Bug fix: Do not create players every call of IsReady
Close #1709
2021-07-10 19:21:32 +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