Commit Graph

197 Commits

Author SHA1 Message Date
Hajime Hoshi
fb1ab5e779 audio: Refactoring 2021-08-21 20:10:12 +09:00
Hajime Hoshi
a93897d9d2 audio: Remove Oto (v0) usages
Closes #1665
2021-08-21 19:29:32 +09:00
Hajime Hoshi
92bc5c1908 audio: Add (*Context).NewPlayer and (*Context).NewPlayerFromBytes
Closes #1708
2021-07-22 16:41:04 +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
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
29eade9b4a audio/internal/readdriver: Bug fix: Implement Suspend/Resume for browsers
Closes #1630
2021-05-04 18:49:39 +09:00
Hajime Hoshi
0de024229d audio: Guarantee that (*Player).Current's returning value is increased monotonically
Closes #1501
2021-03-31 23:41:28 +09:00
Hajime Hoshi
f4b770eff6 audio/internal/readerdriver: Add Player.Err 2021-03-28 22:21:07 +09:00
Hajime Hoshi
b46cb324ed audio: Add audio/internal/readerdriver package 2021-03-28 18:34:16 +09:00
Hajime Hoshi
7212cd7999 audio: Bug fix: Race condition on accessing the set of players
Closes #1548
2021-03-24 23:41:18 +09:00
Hajime Hoshi
07c10880f4 audio: Bug fix: Test failures on browsers 2021-03-22 03:50:05 +09:00
Hajime Hoshi
6d442c0a17 audio: Add comments 2021-02-28 23:47:57 +09:00
Hajime Hoshi
ed7d7e8976 audio/internal/go2cpp: Prepare the first buffer data to make the audio smoother 2021-01-16 03:28:47 +09:00
Hajime Hoshi
c742ae60bd audio: Bug fix: Implement renaderPlayer.IsPlayer correctly 2021-01-16 01:02:07 +09:00
Hajime Hoshi
bd3e930eef audio: Add readerPlayerFactory / readerDriver 2021-01-09 00:45:13 +09:00
Hajime Hoshi
bd1c3ff030 audio: Rename writerContext -> writerPlayerFactory 2021-01-07 11:24:40 +09:00
Hajime Hoshi
a6b3f32f3a audio: Refactoring 2021-01-07 02:14:42 +09:00
Hajime Hoshi
e04e709a10 audio: Refactor test files 2021-01-07 01:53:41 +09:00
Hajime Hoshi
bda285b376 audio: Refactoring 2021-01-07 01:33:57 +09:00
Hajime Hoshi
e77beac235 audio: Define playerImpl interface 2021-01-07 00:59:13 +09:00
Hajime Hoshi
7cf32efcd5 audio: Rename playerImpl -> writerContextPlayerImpl 2021-01-07 00:46:50 +09:00
Hajime Hoshi
c42a40a541 audio: Rename context -> writerContext
This is a preparation of a new type of context with io.Readers.
2021-01-07 00:26:28 +09:00
Hajime Hoshi
0bf6eee605 audio: Reduce making a slice at a player's read 2021-01-04 21:51:26 +09:00
Hajime Hoshi
8e46769284 audio: Remove returning values from Play/Pause 2020-10-10 23:45:18 +09:00
Hajime Hoshi
0673b384d8 audio: Update the comment
Updates #859
2020-10-07 23:43:38 +09:00
Hajime Hoshi
f1f7b350de audio, audio/mp3, audio/vorbis, audio/wav: Remove Close functions
Fixes #859
2020-10-07 23:39:58 +09:00
Hajime Hoshi
944a19c6f7 audio: Remove the error returning value from NewContext
Updates #1380
2020-10-05 02:25:13 +09:00
Hajime Hoshi
29b4087ebf audio: Remove the error returning value from NewPlayerFromBytes
Updates #1380
2020-10-05 02:18:27 +09:00
Hajime Hoshi
f4d050161a audio: Remove (*Context).Update
Updates #1127
2020-10-04 15:41:34 +09:00
Hajime Hoshi
a1ac574a60 docs: Use 'Deprecated:' annotation
Fixes #1160
2020-05-19 01:50:55 +09:00
hiroebe
ad00414a2a audio: Remove duplicate check for io.Seeker (#1051) 2020-01-10 19:37:31 +09:00
Hajime Hoshi
5182060899 Revert "audio: Bug fix: Fill empty data even when audio is suspended"
This reverts commit 529dddda53.

Updates #975

Reason: This causes PARTIAL_WAKE_LOCK on Android (AudioDirectOut) (#931)
2019-11-09 15:24:56 +09:00
Hajime Hoshi
529dddda53 audio: Bug fix: Fill empty data even when audio is suspended
When writing is stopped on Oto's players, unexpected delaying
happens.

The ideal solution is to have APIs to suspend and resume Oto's
player, but this is not easy. For a temporary solution, write
zero values on the players when audio is suspended.

Fixes #975
2019-11-07 01:13:00 +09:00
Hajime Hoshi
124389561c audio: Bug fix: The dummy player should have long enough buffer
In the current implementation, the audio context will be ready
when a player's Write is finished. If the buffer is too short,
Write finishes immediately without accessing the low audio layer
and the audio context would be ready without playing anything.

This change changes the dummy buffer to have a long enough buffer
so that Write will be wait for acutual audio playing.

Fixes #970
2019-10-23 02:41:12 +09:00
Hajime Hoshi
b78f678700 audio: Bug fix: (*Context).IsReady never returned true unless there is a player
The audio context is never ready unless there is a player. This is
problematic when a user tries to play audio after the context is
ready. Play a dummy player to avoid the blocking.

Fixes #969
2019-10-22 23:45:13 +09:00
Hajime Hoshi
dbb8a5e873 audio: Block all the players when suspended
This avoid to write 0 bytes when the app is in background. This
should reduce CPU usage.

Updates #931
2019-09-07 02:03:59 +09:00
Hajime Hoshi
bd85d0e08d audio: Add TestPauseBeforeInit
This confirms that Pause before initialization should not launch
another loop.
2019-05-02 21:39:08 +09:00
Hajime Hoshi
7e2a679b17 audio: Context should be reset for each test
As the context remembers the last error, the context should be
re-created for each test.
2019-05-02 21:35:20 +09:00
Hajime Hoshi
396f257629 audio: Fix comments 2019-05-02 04:10:33 +09:00
Hajime Hoshi
876340da17 audio: Bug fix: context.ready should be set true after writing 2019-05-02 03:27:43 +09:00
Hajime Hoshi
2e35d9dc70 audio: Refactoring 2019-05-02 03:21:56 +09:00
Hajime Hoshi
5dd12afd38 audio: Stop the loop when pausing
This change reduces the necessity to fill zero bytes.
2019-05-02 03:16:45 +09:00
Hajime Hoshi
5121b072f1 audio: Change init from a variable to a channel 2019-05-02 02:37:32 +09:00
Hajime Hoshi
bea5b0f685 audio: Add comments 2019-05-02 02:11:35 +09:00
Hajime Hoshi
c112c31e7e audio: Reimplement audio by using multiple oto.Player 2019-04-30 18:20:52 +09:00
Hajime Hoshi
339e76afec audio: Bug fix: Dead lock at seeking
When sending something to channels, a lock should not be used,
or the receiver side might be using the same lock.

Bug: #855
2019-04-30 12:51:22 +09:00
Hajime Hoshi
e19479d243 audio: Add comments about explanation how deadlock happens
This might be related to #855
2019-04-30 01:41:34 +09:00
Hajime Hoshi
5ecc595ce4 audio: Bug fix: Reset playing state at the end of the readLoop 2019-04-29 22:31:10 +09:00
Hajime Hoshi
d2979e288d audio: Bug fix: runningReadLoop must be set to true before starting the goroutine
This can cause deadlock by multiple goroutines if runningReadLoop
is set to true in the goroutine.

Related to #855?
2019-04-29 21:46:26 +09:00