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
Hajime Hoshi
c9fcf57fbd
audio/internal/readerdriver: Refactoring (Android)
2021-05-27 01:00:41 +09:00
Hajime Hoshi
c4f85bea2b
audio/internal/readerplayer: Bug fix: Delay on audio on Android
...
Updates #1650
2021-05-27 00:52:45 +09:00
Hajime Hoshi
88d2663bc5
audio/internal/readerdriver: Mark EOF at the first reading
2021-05-26 13:03:47 +09:00
Hajime Hoshi
46ed239632
audio/internal/readdriver: Bug fix: Potential busy loop on Android
...
This is basically the same fix as 91d3d6b4e7
but for Android.
Updates #1650
2021-05-26 12:46:48 +09:00
Hajime Hoshi
8692ba5f06
audio/internal/readerdriver: Refactoring (js)
2021-05-26 03:45:12 +09:00
Hajime Hoshi
91d3d6b4e7
audio/internal/readerdriver: Bug fix: Avoid busy loop when EOF is reached
...
This is a part of reverting 81015a3c19
.
On Drawin, the loop became busy when the source reached EOF. This
change fixes this issue by making the loop wait when the EOF is
reached and until the state is reset.
Updates #1650
2021-05-26 03:37:50 +09:00
Hajime Hoshi
800a929e84
audio/internal/readerdriver: Add comments
...
Updates #1549
2021-05-23 00:38:18 +09:00
Hajime Hoshi
5bd1a883d1
audio/internal/readerdriver: Implmeent a reader driver for Windows
...
Updates #1549
2021-05-23 00:14:59 +09:00
Hajime Hoshi
e43dcc2265
audio/internal/readerdriver: Bug fix: An error was overwritten
2021-05-18 21:08:26 +09:00
Hajime Hoshi
ae14caee93
audio/internal/readerdriver: Refactoring (darwin)
2021-05-17 23:18:55 +09:00
Hajime Hoshi
58f6eb0dea
audio/internal/readerdriver: Refactoring
2021-05-17 04:04:04 +09:00
Hajime Hoshi
66999989e1
audio/internal/readerdriver: Bug fix: Need to lock the callback logic
2021-05-17 04:03:04 +09:00
Hajime Hoshi
089883aba0
audio/internal/readerdriver: Refactoring
2021-05-17 03:51:24 +09:00
Hajime Hoshi
d1138bc615
audio/internal/readerdriver: Make Play async on Android
...
Updates #1549
2021-05-16 20:13:39 +09:00
Hajime Hoshi
cf6edae5b3
audio/internal/readerdriver: Bug fix: Protect playImpl by the mutex on Darwin
2021-05-16 20:07:51 +09:00
Hajime Hoshi
58c1ed0e23
audio/internal/oboe: Bug fix: Opening a stream might fail when too many streams are opened
...
openStream might fail when too many streams are opened in a short time.
In this case, sleep 1[ms] and retry to open the stream.
Updates #1549
Closes #1645
2021-05-16 19:43:47 +09:00
Hajime Hoshi
1dd48388b4
audio/internal/readerdriver: Disable the reader driver for Android temporarily
...
Updates #1549
Updates #1645
2021-05-16 15:54:02 +09:00
Hajime Hoshi
bb4a3ce89b
audio/internal/oboe: Add prefixes to the C functions
2021-05-16 03:03:34 +09:00
Hajime Hoshi
fc8b3d70fe
audio/internal/oboe: clang-format
2021-05-16 03:01:43 +09:00
Hajime Hoshi
2edb286ec4
audio/internal/oboe: Bug fix: Use-after-free of a player
...
In theory, a closed player was used unexpectedly by these steps:
1. Suspend is called by switching the application
2. Player_Close is called
3. Resume is called by reactivating the application
The set of GetPlayersToResume() had a closed player and the trying to
play it caused the use-after-free problem.
This changes fixes the issue by removing the player from the set of
GetPlayerToResume() when closing it. iOS version already has the logic
to remove the player appropriately.
Updates #1645
Closes #1646
2021-05-16 02:21:00 +09:00
Hajime Hoshi
5f773a3277
audio/internal/readerdriver: Refactoring
2021-05-16 02:08:33 +09:00
Hajime Hoshi
49172a235b
audio/internal/readerdriver: Bug fix: AudioQueueFlush was not needed
...
Rather, AudioQueueFlush after AudioQueueReset might cause an error.
Closes #1644
2021-05-15 22:47:09 +09:00
Hajime Hoshi
81015a3c19
audio/internal/readerdriver: Refactoring: EOF doesn't matter to determine when to stop the waiting
2021-05-15 22:39:54 +09:00
Hajime Hoshi
4fcfdb39d4
audio: Bug fix: Compile error for tests
2021-05-10 04:03:58 +09:00
Hajime Hoshi
9b965a6308
audio/internal/go2cpp: Simplify reading the source
2021-05-10 04:00:58 +09:00
Hajime Hoshi
9585c1e09a
audio/internal/go2cpp: Refactoring
2021-05-10 03:35:21 +09:00
Hajime Hoshi
52c609459c
audio/internal/readerdriver: Change the returning type of UnplayedBufferSize int64 -> int
2021-05-10 03:22:19 +09:00
Hajime Hoshi
7a6bdc8388
audio/internal/readerdriver: Bug fix: Deadlock at Close (js)
2021-05-10 01:10:42 +09:00
Hajime Hoshi
2c8d3826fa
audio/internal/readerdriver: Create a dedicated loop to read the source (js)
...
Closes #1637
2021-05-10 00:47:07 +09:00
Hajime Hoshi
df40217427
audio/internal/readerdriver: Skip operation on error (js)
2021-05-09 23:09:15 +09:00
Hajime Hoshi
737ccf18fb
audio/internal/readerdriver: Make Play async internally on macOS and iOS
...
Updates #1638
2021-05-09 22:03:48 +09:00
Hajime Hoshi
a285a84df0
audio/internal/readerdriver: Use AudioQueuePrime
2021-05-09 21:31:55 +09:00
Hajime Hoshi
6644e43025
audio/internal/readerdriver: Bug fix: AudioQueueStop might invoke the callback and then caused deadlock
2021-05-09 21:07:39 +09:00
Hajime Hoshi
015475ad2c
audio/interal/readerdriver: Misspelling
2021-05-09 19:55:12 +09:00
Hajime Hoshi
d9972822e2
audio/internal/readerdriver: unqueuedBufs should be reset when the player is reused later
2021-05-09 19:54:34 +09:00
Hajime Hoshi
f04230da08
audio/internal/readerdriver: Bug fix: The player became closed unexpectedly
2021-05-09 19:35:36 +09:00
Hajime Hoshi
87956560f3
audio/internal/readerdriver: Implement for iOS
...
Updates #1549
2021-05-09 19:04:59 +09:00
Hajime Hoshi
c85ef4e40b
audio/internal/readerdriver: Bug fix: Deadlock at resuming
2021-05-09 18:30:46 +09:00
Hajime Hoshi
fa13b81d38
audio/internal/readerdriver: Prepare AudioQueues first
...
Updates #1638
2021-05-09 17:24:00 +09:00
Hajime Hoshi
99e2d79ec8
audio/internal/readerdriver: clang-format -i
2021-05-09 17:04:15 +09:00
Hajime Hoshi
ac2753f411
audio/internal/readerdriver: Reuse AudioQueue whenever possible
...
AudioQueueStart is expensive when the AudioQueue was newly created.
To mitigate the cost, cache and reuse AudioQueue instances.
Closes #1638
2021-05-09 16:30:24 +09:00
Hajime Hoshi
9caead5a38
audio/internal/readerdriver: Refactoring: Remove player.id
2021-05-09 15:53:33 +09:00
Hajime Hoshi
383bceddd5
audio/internal/readerdriver: Refactoring
2021-05-09 14:41:23 +09:00
Hajime Hoshi
f9b8238cd6
audio/internal/readerdriver: Disable operations when an error is recorded
2021-05-09 05:58:55 +09:00
Hajime Hoshi
7eeaef7ff8
audio/internal/readerdriver: Refactoring
2021-05-09 05:46:55 +09:00
Hajime Hoshi
22567d20b6
audio/internal/readerdriver: Implement {,Set}Volume for macOS
2021-05-09 05:36:03 +09:00
Hajime Hoshi
9df1092507
audio/internal/readerdriver: Bug fix: AudioQueue{Pause,Reset,Flush} cannot be called before AudioQueueStart
2021-05-09 05:28:42 +09:00
Hajime Hoshi
bc22ab53b2
audio/internal/readerdriver: Add comments
2021-05-09 05:01:51 +09:00
Hajime Hoshi
eb3301d30c
audio/internal/readerdriver: Implement a reader-style driver for macOS
...
Updates #1549
2021-05-09 04:56:31 +09:00
Hajime Hoshi
fcdd4e16d4
audio/internal/readerdriver: Fill the buffer whenever starting to play
2021-05-09 03:51:45 +09:00
Hajime Hoshi
ae9e89b814
audio/internal/oboe: Bug fix: Not all players should not be suspended
2021-05-09 03:07:17 +09:00
Hajime Hoshi
7487222740
audio/internal/readerdriver: Remove Context's Close
2021-05-07 16:50:19 +09:00
Hajime Hoshi
410d0f52e5
audio/internal/readerdriver: Bug fix: createBuffer failed when the buffer size is 0
...
When the decoded audio size is exactly multiples of an internal
buffer size, the buffer's size becomes exactly zero when being
appended. In this case, createBuffer fails and the application
crashes.
This change fixes this issue by skipping to append a buffer in such
cases.
Closes #1635
2021-05-07 02:35:57 +09:00
Hajime Hoshi
aa9f669ec3
audio/internal/readerplayer: Move the buffer for resuming to the driver side
...
Closes #1633
2021-05-05 21:54:21 +09:00
Hajime Hoshi
4e0e5c6bbc
audio/internal/oboe: Bug fix: Always use OpenSL
...
AAudio doesn't care about plugging in/out headsets. There is a
workaround [1], but this is not easy to apply. Instead, alwasy use
OpenSL.
[1] https://github.com/google/oboe/blob/master/docs/notes/disconnect.md
Closes #1634
2021-05-05 18:09:44 +09:00
Hajime Hoshi
1fecaa0a90
audio/internal/readdriver: Bug fix: Wait for a while after finishing to write
...
Closes #1632
2021-05-05 17:05:23 +09:00
Hajime Hoshi
ded3cd1433
audio/internal/readerdriver: Refactoring: Remove player.state
2021-05-05 15:32:53 +09:00
Hajime Hoshi
f556590582
android/internal/readerdriver: Bug fix: Infinite recursive at closeImpl
2021-05-05 03:58:47 +09:00
Hajime Hoshi
c954dfa8fb
audio/internal/readerderiver: Bug fix: Reduce noises on Android
...
Closes #1632
2021-05-05 02:14:59 +09:00
Hajime Hoshi
83c9015468
audio/internal/oboe: Bug fix: Guard the players by a mutex
...
Closes #1631
2021-05-05 00:51:53 +09:00
Hajime Hoshi
ad86c297fb
audio/internal/readdriver: Implement a driver for Android with Oboe
...
Closes #1626
2021-05-04 23:51:36 +09:00
Hajime Hoshi
804881fa94
audio/internal/readerdriver: Enable to return error at Suspend/Resume
2021-05-04 23:18:16 +09:00
Hajime Hoshi
58843b68f9
internal/hooks: Enable to return error at suspend/resume audio
2021-05-04 23:09:01 +09:00
Hajime Hoshi
bcf8ef85b6
audio: Bug fix: Compile error on the tests
...
Updates #1630
2021-05-04 22:10:49 +09:00
Hajime Hoshi
29eade9b4a
audio/internal/readdriver: Bug fix: Implement Suspend/Resume for browsers
...
Closes #1630
2021-05-04 18:49:39 +09:00
Hajime Hoshi
11e76d3fc8
audio/vorbis: Catch the Seek error
2021-05-03 23:11:14 +09:00
Hajime Hoshi
fc5970768d
audio/internal/go2cpp: Bug fix: Potential deadlock at Play
...
Closes #1629
2021-05-03 17:54:25 +09:00
Hajime Hoshi
7adf6aac27
audio/internal/readerdriver: Simplify type names
2021-05-01 16:25:40 +09:00