Commit Graph

112 Commits

Author SHA1 Message Date
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
Hajime Hoshi
7f9afd4e14 audio: Unify buffer size 1/15[s] experimentally
This would mitigate glitches on Windows (#451)
2017-12-17 00:41:35 +09:00
Hajime Hoshi
6956e15b08 audio: Fix comments 2017-12-02 16:26:20 +09:00
Hajime Hoshi
3db965d547 audio: Fix doc 2017-12-01 01:38:47 +09:00
Hajime Hoshi
0379e3c591 audio: Deprecate Update 2017-12-01 00:26:28 +09:00
Hajime Hoshi
2624ed6824 audio: Refactoring 2017-10-14 19:45:32 +09:00
Hajime Hoshi
626b772b25 doc: Improve comments 2017-10-01 17:24:30 +09:00
Hajime Hoshi
fe2380f1ab audio: Add comments 2017-09-26 00:38:50 +09:00
Hajime Hoshi
a225f666ac audio: Bug fix: Race condition on 'pos' member (#413) 2017-08-17 11:48:29 +09:00
Hajime Hoshi
8c3a020693 audio: Bug fix: Race condition when seeking (#413) 2017-08-17 11:44:30 +09:00
Hajime Hoshi
3216d50460 audio: Refactoring 2017-08-17 11:15:04 +09:00