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
Hajime Hoshi
89f6eba925
Revert "audio: Bug fix: Make ensureReadLoop exactly atomic"
...
This reverts commit 835497edd3
.
Reason: This causes a dead lock at examples/piano with many notes.
This might be related to #855
2019-04-29 14:57:55 +09:00
Hajime Hoshi
fe3e8e376a
audio: Move seeking from the loop to Seek function
...
Seek should work in both cases the loop runs and not. This change
is a preparation.
2019-04-29 02:27:15 +09:00
Hajime Hoshi
c4c6acacf9
audio: Remove (*mux).hasPlayer
2019-04-29 01:01:29 +09:00
Hajime Hoshi
835497edd3
audio: Bug fix: Make ensureReadLoop exactly atomic
2019-04-29 00:05:54 +09:00
Hajime Hoshi
b1607de99d
audio: Refactoring
2019-04-28 23:58:06 +09:00
Hajime Hoshi
14b6e95217
audio: Use a boolean value to inidicate inited state intead of channels
...
This is a preparation to use oto.Players for Players. By using a
boolean value, suspending state can be detected from multiple
oto.Players.
2019-04-28 19:53:28 +09:00
Hajime Hoshi
fe55e55b7e
audio: Refactoring
2019-04-28 19:53:28 +09:00
Hajime Hoshi
1327e2239c
audio: Use a boolean value to indicate suspending state instead of channels
...
This is a preparation to use oto.Players for Players. By using a
boolean value, suspending state can be detected from multiple
oto.Players.
2019-04-28 19:53:28 +09:00
Hajime Hoshi
31758bf3ab
audio: Remove comment
2019-04-28 19:49:37 +09:00
Hajime Hoshi
2bea7d4e1a
audio: Error on duplicated source
...
Fixes #853
2019-04-28 19:39:46 +09:00
Hajime Hoshi
70a225fd7e
audio: Use dummy hooks from tests
2019-04-28 19:35:59 +09:00
Hajime Hoshi
81549a3523
audio: Bug fix: Remove redundant Unlock
2019-04-28 02:44:32 +09:00
Hajime Hoshi
9fc2ae158c
audio: Bug fix: Close always returned error
2019-04-28 02:22:11 +09:00
Hajime Hoshi
e4f0a0aa04
audio: Bug fix: Remove depenency on finalizer
...
This change fixes playerImpl leak by removing dependency on
finalizer usages. Now readLoop can (or should) be called multiple
times even after closing. Only when (*Player).Close is called
explicitly, the read loop cannot be started again.
Fixes #852
2019-04-28 02:03:55 +09:00
Hajime Hoshi
4f831de008
audio: Remove (*playerImpl).sync and use mutex instead
...
This is a preparation to work syncing wihtout the read-loop.
2019-04-28 01:37:52 +09:00
Hajime Hoshi
acc4ef4e11
audio: Add comments
2019-04-01 01:59:10 +09:00
Hajime Hoshi
ed855d6c6c
audio: Refactoring: remove the unused returning value
2019-03-02 04:42:19 +09:00
Hajime Hoshi
a3eddeb50f
Improve panic messages
2019-02-06 23:43:03 -10:00
Hajime Hoshi
a4123a479e
audio: Initialize the context first
...
This is necessary to create an audio's Player before the loop if
we want to create *oto.Player for each *audio.Player.
2019-01-30 00:45:36 +09:00
Hajime Hoshi
13b0d82b6d
audio: Use oto.NewContext
2019-01-30 00:36:47 +09:00
Hajime Hoshi
6d714a16cf
audio: Remove unneeded 'break'
2019-01-10 02:34:58 +09:00
Hajime Hoshi
a6b3f761f8
audio: Refactoring: Remove dependency on clock package
2019-01-10 00:59:38 +09:00
Hajime Hoshi
14404334e7
audio: Rename players to mux
2019-01-09 22:10:52 +09:00
Hajime Hoshi
1760070130
audio: Add comments about GC ( #746 )
2018-12-18 23:07:19 +09:00
Hajime Hoshi
b9eba54115
audio: Use a dummy driver for testing
...
Fixes #750
This also fixes an out-of-index bug when all players are skipped.
2018-12-17 23:06:59 +09:00
Hajime Hoshi
b0cb216f5f
audio: Close audio after its playing finishes
...
Fixes #746
This is a temporal fix and we will need further re-designing of
audio package.
2018-12-17 04:02:32 +09:00
Hajime Hoshi
08a369b8fd
audio: Bug fix: GC audio players correctly
...
Fixes #746
2018-12-15 22:33:45 +09:00
Hajime Hoshi
d14202ef7b
audio: Add Context.IsReady
...
Fixes #717
2018-10-16 00:02:19 +09:00
Hajime Hoshi
2969de5b1f
audio: Refactoring: Redefine bytesPerSample
2018-07-24 01:54:01 +09:00
Hajime Hoshi
d752408da3
Fix comments not to use the term 'this function'
2018-07-15 01:04:46 +09:00
Hajime Hoshi
273093b237
audio: Skip the player in the state of starting, seeking or EOF
...
This is basically reland of
2fee7a6fe5
.
Before this change, if a player's buffer was not enough for
reading, 0 value were used and this caused noises. The reading
size should be aligned with all the players.
However, there are some cases that the player should be skippped.
For example, just after a player just starts playing or seeking,
the buffer is empty. In this case, other players should not wait
for the player since decoding might take some time. Another case
is that the player reached EOF.
This change aligns the read buffer sizes but use zero values only
when the player just starts or seeks, or reaches EOF.
2018-06-09 22:00:11 +09:00
Hajime Hoshi
facf184548
Revert "audio: Consider the state of the player's starting and seeking"
...
This reverts commit 2fee7a6fe5
.
Reason: This causes freezing on browsers
2018-06-09 19:28:20 +09:00
Hajime Hoshi
b62e07b9bd
audio: Remove println
2018-06-09 19:05:07 +09:00
Hajime Hoshi
2fee7a6fe5
audio: Consider the state of the player's starting and seeking
...
Before this change, if a player's buffer was not enough for
reading, 0 value were used and this caused noises. The reading
size should be aligned with all the players.
Just after a player just starts playing or seeking, the buffer is
empty but other players should not wait for the player read since
decoding might take some time.
To summerize, this change aligns the read buffer sizes but use
zero values only when the player just starts or seeks.
2018-06-09 19:01:57 +09:00
Hajime Hoshi
91958d24ef
audio: Use bigger buffers for mobiles
2018-06-09 18:14:18 +09:00
Hajime Hoshi
faaf391619
audio: Give up syncing audio timer and game timer ( #617 )
...
Syncing was already incomplete (e.g. decoding takes more than one
frame and delays can happen in this case). Giving up syncing audio
timer and game timer should not affect the game experience so much.
Instead, clock implementation will be much simpler.
2018-05-27 00:30:12 +09:00
Hajime Hoshi
5976e4bbbc
audio: More intellegent suspending/resuming ( #617 )
...
Before this change, the audio is suspended when the game stops for
1/12[s]. However, as game often stops for more than 1/12[s]
especially on mobiles, this implemntation caused some audio
glitches.
This change fixes this problem by re-implementing suspending/
resumeing audio by detecting the window is active/focused or not.
2018-05-26 23:31:04 +09:00
Hajime Hoshi
df048d9bf6
audio: Don't use nosync GopherJS
...
nosync package is good in terms of performance, but this assumes
that duplicated lock never happens. As audio package runs multiple
goroutines, theoretically duplicated lock can happen, and it looks
like this is an actual case (#603 ).
This change replaces nosync usages with regular sync usages.
Probably I'll deprecate nosync usages via internal/sync package
everywhere in Ebiten.
This might fix #603 .
2018-05-09 12:14:20 +09:00
Hajime Hoshi
632a97974d
audio: Fix wrong English word
2018-03-22 00:36:48 +09:00
Hajime Hoshi
18113f259a
audio: NewPlayer now accepts io.ReadCloser
...
Fixes #414
2018-03-22 00:33:17 +09:00
Hajime Hoshi
1b0e71765f
internal/hooks: Rename Update -> BeforeUpdate
2018-03-15 02:50:10 +09:00
Hajime Hoshi
063153e41d
ebitenutil: Speed up to avoid copying by image.Rect
2018-03-11 21:39:22 +09:00
Hajime Hoshi
61950817fa
audio: Bug fix: importing audio without NewContext causes error
2018-03-04 22:18:14 +09:00
Hajime Hoshi
647d8f0094
audio: Use time.NewTimer and Stop instead of time.After
...
Fixes #532
2018-03-04 19:23:38 +09:00
Hajime Hoshi
392ee92aeb
Add internal/hooks to replace internal/audiobinding
2018-02-04 17:33:17 +09:00
Hajime Hoshi
2322c5600b
audio: Revert the buffer size
...
This basically reverts df62b16270
.
2018-01-29 11:57:52 +09:00
Hajime Hoshi
d5d5ebb0b3
clock: Make ProceedAudioTimer take a number of frames
2018-01-07 18:32:19 +09:00
Hajime Hoshi
d12a3d4073
clock: Refactoring
2018-01-07 17:10:56 +09:00
Hajime Hoshi
0b3495b81f
audio: Use mock sync on browsers
2018-01-07 15:26:18 +09:00
Hajime Hoshi
df62b16270
audio: Use bigger buffer size for mobile phones
2017-12-31 01:28:08 +09:00
Hajime Hoshi
97ec367e23
audio: Use :=
2017-12-30 21:18:34 +09:00
Hajime Hoshi
65c0bf55fc
audio: Fix buffer size for the latest Oto
2017-12-28 20:37:36 +09:00
Hajime Hoshi
623caad3ec
audio: Bug fix: appropriate buffer size on browsers
2017-12-25 01:54:55 +09:00
Hajime Hoshi
60eef4618d
audio: Revert size (due to noise on browsers)
2017-12-25 00:16:47 +09:00
Hajime Hoshi
4a06198160
audio: Smaller buffers (experimental)
2017-12-24 22:16:45 +09:00
Hajime Hoshi
5679103d71
audio: Use io.CopyN
2017-12-24 21:21:15 +09:00
Hajime Hoshi
e14257d76d
audio: A little better buffer size for Android Chrome
2017-12-24 04:01:41 +09:00
Hajime Hoshi
ae6bdf23f2
audio: Recalculate audio buffer size
2017-12-24 03:54:42 +09:00
Hajime Hoshi
18c6890d96
audio: More often reading (decoding) audio source to reduce noise
2017-12-24 00:58:14 +09:00
Hajime Hoshi
7ce87a6c82
audio: Simplify read/write logic
2017-12-24 00:51:17 +09:00
Hajime Hoshi
00d8d61795
audio: Adjust buffer size
2017-12-23 23:15:44 +09:00
Hajime Hoshi
f3997cf5ae
audio: Fix comments
2017-12-23 21:14:08 +09:00
Hajime Hoshi
a540d6b2bb
audio: Adjust buffer size
2017-12-23 19:59:52 +09:00
Hajime Hoshi
19ca74e86b
audio: Remove player's mutex
2017-12-23 19:01:28 +09:00
Hajime Hoshi
637ed0d965
audio: Refactoring
2017-12-23 18:39:14 +09:00
Hajime Hoshi
04739a7249
audio: Bug fix: Seek might cause dead lock after Close
2017-12-23 18:31:20 +09:00
Hajime Hoshi
db77658935
audio: Reduce locks by using channels
2017-12-23 17:55:48 +09:00
Hajime Hoshi
ba3de063ac
audio: Refactoring
2017-12-23 17:05:14 +09:00
Hajime Hoshi
3dcb486a5c
audio: Refactoring
2017-12-23 05:02:15 +09:00
Hajime Hoshi
7cc6154de6
audio: Reduce noise ( #443 )
2017-12-23 04:25:48 +09:00
Hajime Hoshi
3addbfce8a
audio: Simplify error handling
2017-12-23 04:12:12 +09:00
Hajime Hoshi
a21571fb57
audio: Refactoring
2017-12-23 04:01:18 +09:00
Hajime Hoshi
a5f8c1b1f8
audio: Async reading sources ( #443 )
2017-12-23 03:24:54 +09:00
Hajime Hoshi
7b76b7822f
audio: Fix comments
2017-12-17 01:24:45 +09:00
Hajime Hoshi
7cd89bc44b
audio: Adjust buffer size for Android Chrome
2017-12-17 01:20:10 +09:00