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
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
29eade9b4a
audio/internal/readdriver: Bug fix: Implement Suspend/Resume for browsers
...
Closes #1630
2021-05-04 18:49:39 +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
Hajime Hoshi
1acf5bc260
audio/internal/readerdriver: Bug fix: Compile error
2021-04-29 18:37:10 +09:00
Hajime Hoshi
760072e3a9
audio/internal/readerdriver: Use a channel instead of a callback function
2021-04-29 18:21:06 +09:00
Hajime Hoshi
08c3025560
audio/internal/readerdriver: Refactoring
2021-04-20 03:20:29 +09:00
Hajime Hoshi
24dc20e80e
audio/internal/readerdriver: Bug fix: Need to align the buffer size
2021-04-20 02:39:33 +09:00
Hajime Hoshi
e650e71d8c
audio/internal/readerdriver: Bug fix: ReadFull could get stuck
...
If the source io.Reader's implementation is not good (e.g., Read
returns 0 if the buffer size is not multiples of 4), io.ReadFull
gets stuck forever. Instead, use reguler Read with a decent amount
of bytes buffer.
Closes #1599
2021-04-20 01:29:15 +09:00
Hajime Hoshi
146678596b
audio/internal/readerdriver: Bug fix: Invoke onReady for go2cpp
...
Updates #1599
2021-04-19 23:59:31 +09:00
Hajime Hoshi
ea9d64f5b8
audio: Bug fix: Need to call setReady from the reader player side
...
Updates #1599
2021-04-19 23:56:08 +09:00
Hajime Hoshi
83dc3966e7
audio/internal/go2cpp: Bug fix: Set the volume whenever the player state is
2021-03-31 21:08:32 +09:00
Hajime Hoshi
f0d7e16eb2
audio/internal/readerdriver: Refactoring
2021-03-28 23:27:47 +09:00
Hajime Hoshi
f4efdd6355
audio/internal/go2cpp: Protect the functions by the lock correctly
2021-03-28 22:40:36 +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
1083233d5f
audio/internal/go2cpp: Replace isWritable with unplayedBufferSize instead
...
This is the more accurate way not to overflow the underlying buffer.
2021-03-23 23:46:57 +09:00
Hajime Hoshi
9e73b0d287
audio: Rename UnwrittenBufferSize -> UnplayedBufferSize
2021-03-01 01:27:42 +09:00
Hajime Hoshi
dbdfce5fed
audio: Add readerDriverPlayer.UnwrittenBufferSize to get the exact position
2021-02-28 01:42:48 +09:00
Hajime Hoshi
29099cf660
audio: Bug fix: Continue to play the audio after seeking on go2cpp
2021-02-21 23:54:43 +09:00
Hajime Hoshi
68411e9591
audio/internal/go2cpp: Avoid unnecessary allocations
2021-01-25 03:09:13 +09:00
Hajime Hoshi
c8ba51d26e
audio/internal/convert: Avoid unnecessary allocations
2021-01-25 03:04:53 +09:00
Hajime Hoshi
2432530b51
Revert "audio/internal/go2cpp: Fix C++ side and remove the preparation"
...
This reverts commit 65f974588c
.
Reason: Didn't improve the performance on some devices
2021-01-17 04:48:11 +09:00
Hajime Hoshi
65f974588c
audio/internal/go2cpp: Fix C++ side and remove the preparation
2021-01-17 03:47:45 +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
ad218eae2d
audio/internal/convert: Reduce allocations of float32 slices
2021-01-15 00:37:21 +09:00
Hajime Hoshi
612676cb19
audio/internal/go2cpp: Remove the buffer size argument
2021-01-13 22:30:52 +09:00
Hajime Hoshi
aeaa443bf2
audio/internal/go2cpp: Bug fix: Writing data must be concurrent-safe
2021-01-13 10:26:30 +09:00
Hajime Hoshi
2f8172f819
audio/internal/go2cpp: Recreate the underlying audio player when resetting
2021-01-12 20:42:45 +09:00
Hajime Hoshi
a66097df19
audio/internal/go2cpp: Remove unnecessary set
2021-01-12 11:38:30 +09:00
Hajime Hoshi
2dc37d30de
audio/internal/go2cpp: Add a comment
2021-01-12 01:07:36 +09:00
Hajime Hoshi
a7dd00596a
audio/internal/go2cpp: Add signaling at Pause
2021-01-12 00:43:16 +09:00
Hajime Hoshi
c009070840
audio/internal/go2cpp: Add readerDriverPlayer.Reset
2021-01-11 23:54:43 +09:00
Hajime Hoshi
3abb7a3604
audio/internal/go2cpp: Increase the temporary buffer size
2021-01-11 21:56:47 +09:00
Hajime Hoshi
8e6c3a570e
audio/internal/go2cpp: Bug fix: Pass the correct size
2021-01-11 18:07:25 +09:00
Hajime Hoshi
9cc5bd80f9
audio/internal/go2cpp: Better waiting condition
2021-01-11 15:37:40 +09:00
Hajime Hoshi
dc8217dfeb
audio/internal/go2cpp: Bug fix: Wrong state
2021-01-11 15:25:53 +09:00
Hajime Hoshi
52942751f0
audio: Move go2cpp -> internal/go2cpp
2021-01-09 18:21:32 +09:00
Hajime Hoshi
3fb304e5a8
audio/internal/convert: Refactoring
2021-01-04 21:42:00 +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
bf515bb594
Update version to v2.0.0-alpha
2020-10-04 04:30:40 +09:00
Hajime Hoshi
cba109ebee
audio/mp3: Bug fix: Accept non-io.Closer at Resampling
2019-04-01 00:04:57 +09:00
Hajime Hoshi
f16f6cf4b9
audio/internal/convert: Add Float32Reader and NewReaderFromFloat32Reader
2019-01-15 11:46:31 +09:00
Hajime Hoshi
5c55df87d7
audio: Deprecate Size() and add Length() ( #466 )
2018-01-09 01:25:38 +09:00
Hajime Hoshi
ef282f7f4f
audio/internal/convert: Remove unused functions
2018-01-09 00:26:54 +09:00
Hajime Hoshi
e83810fc57
audio/internal/convert: Add resampling_test.go
...
Fixes #369
2018-01-08 23:44:44 +09:00
Hajime Hoshi
11a1e6ec39
audio/internal/convert: Adjust window size again (confirmed this worked well on iPhone 6)
2018-01-06 01:49:55 +09:00
Hajime Hoshi
5b2dbf6036
audio/internal/convert: Adjust resamplingBufferSize again
2018-01-06 01:46:54 +09:00
Hajime Hoshi
ab70f6fc58
audio/internal/convert: Much faster sine/cosine functions
2018-01-06 00:15:07 +09:00
Hajime Hoshi
005d18ceff
audio/internal/convert: Use int64 (now it is fast enough on browsers?)
2018-01-05 20:03:17 +09:00
Hajime Hoshi
c020101afc
audio/internal/convert: Use cosine table
2018-01-05 19:40:12 +09:00
Hajime Hoshi
2884fb7070
audio/internal/convert: Fix algorithm
2018-01-05 18:21:14 +09:00
Hajime Hoshi
de1a22d9f3
audio/internal/convert: Bug fix: remove unneeded import
2017-12-31 00:15:36 +09:00
Hajime Hoshi
03942292f5
audio/internal/convert: Change the window smaller for performance
...
On iOS, resapling performance was not good.
2017-12-31 00:14:52 +09:00
Hajime Hoshi
e2a026138a
audio/internal/convert: Use float64 for positions
2017-12-27 18:55:17 +09:00
Hajime Hoshi
6d6504085c
audio/internal/convert: Rename members
2017-12-27 18:05:55 +09:00
Hajime Hoshi
b4e3e9375c
audio: Use samller window for resampling on browsers
2017-09-29 02:05:14 +09:00
Hajime Hoshi
db902dbbee
audio: Bug fix: stream size must be multiple of 4 ( #384 )
2017-07-12 00:51:36 +09:00
Hajime Hoshi
1828830b4a
audio/internal/convert/resampling: Better boundary check
2017-07-12 00:40:15 +09:00
Hajime Hoshi
d78a534a0b
audio/internal/convert: Bug fix: invalid size comparison
2017-07-09 15:29:56 +09:00
Hajime Hoshi
e3176f6693
audio/internal/convert: Optimization for seeking
2017-06-26 02:18:11 +09:00
Hajime Hoshi
9130c490c2
audio: Remove convert.Seeker: mp3.Decoded is now io.Seeker
2017-06-25 23:33:23 +09:00
Hajime Hoshi
09ce575774
audio/mp3: Add sample rate conversion
2017-06-18 22:51:11 +09:00
Hajime Hoshi
766072cdbb
audio: Make 'oto' package and use that ( #351 )
2017-05-04 21:09:02 +09:00
Hajime Hoshi
7e4e762d96
audio: Reuse jmethodID objects
2017-04-08 01:41:07 +09:00
Hajime Hoshi
b5a422700a
audio: Reuse jclass objects
2017-04-08 01:35:48 +09:00
Hajime Hoshi
a6c5b98f0f
audio: Release AudioTrack class ( #336 )
2017-04-07 11:36:24 +09:00
Hajime Hoshi
713a537637
audio: Delete local refs explicitly in JNI ( #336 )
2017-04-06 02:12:20 +09:00
Hajime Hoshi
5da58fc949
audio: Fix comment
2017-02-18 15:48:31 +09:00
Hajime Hoshi
8bfcea8f42
audio: Fix compile error on macOS ( #324 )
2017-02-18 15:42:35 +09:00
Hajime Hoshi
bd1a486b3a
Bug fix: gopherjs build failed on Windows
2017-02-09 02:37:40 +09:00
Hajime Hoshi
0ef1e61d55
mobile: Fix iOS tag usages ( #310 )
2017-01-26 01:32:33 +09:00
Hajime Hoshi
8c2064c8b7
audio: Apply delaying when initializing
2017-01-22 19:43:03 +09:00
Hajime Hoshi
7201015d02
audio: Bug fix: Noise on Safari because of performance issue ( #307 )
2017-01-22 19:19:24 +09:00
Hajime Hoshi
6ee4b46dbe
audio: Improve delay on browsers ( #299 )
2017-01-17 01:14:09 +09:00
Hajime Hoshi
abd0958566
audio: Better conversion from 8bit to 16bit
2017-01-16 23:08:01 +09:00
Hajime Hoshi
ed8d87dd87
audio: Convert 8bit monoral to 16bit stereo ( #282 )
2017-01-16 00:03:18 +09:00
Hajime Hoshi
5bdcd8825c
Rename audio/internal/resampling -> audio/internal/convert
2017-01-15 22:37:59 +09:00
Hajime Hoshi
71cecea9c9
audio: Auto resampling ( #301 )
2017-01-15 17:49:57 +09:00
Hajime Hoshi
d80b213184
audio: Bug fix: Touch is required by Chrome 55+ on Android
2016-12-17 00:14:33 +09:00
Hajime Hoshi
741ce9c7b8
audio: Bug fix: Handle touch event for iOS ( #296 )
2016-11-30 03:25:24 +09:00
Hajime Hoshi
443c58104b
audio: Remove logger on Android
2016-11-16 10:25:04 +09:00
Hajime Hoshi
1f8cd41326
windows: Add comments
2016-09-11 22:34:39 +09:00
Hajime Hoshi
acb66fffe8
audio: Use timshannon's OpenAL lib
2016-09-10 15:11:11 +09:00
Hajime Hoshi
9de581f832
audio: Check returning values of write (android)
2016-07-01 22:05:11 +09:00
Hajime Hoshi
0b8fe25350
opengl: Implement GlslHighpSupported for iOS
2016-06-17 04:13:46 +09:00
Hajime Hoshi
dfe4db67be
Fix for iOS
2016-06-17 02:08:25 +09:00
Hajime Hoshi
a95edaceba
audio: Remove unneeded padding
2016-05-31 22:32:10 +09:00
Hajime Hoshi
3ce8122557
audio: Replace APIs with low level APIs
2016-05-31 22:29:25 +09:00
Hajime Hoshi
84bf1ddf5c
audio: Bug fix: Avoid blocking when sending buffer
2016-05-31 10:17:22 +09:00
Hajime Hoshi
ebac6cbb81
audio: Refactoring for mobiles (reduce calls)
2016-05-29 18:34:52 +09:00
Hajime Hoshi
a329f7939d
audio: Remove confusing comments
2016-05-29 13:19:17 +09:00
Hajime Hoshi
2dd1e9c567
audio: Remove unneeded args
2016-05-28 19:01:26 +09:00
Hajime Hoshi
6a74ea5b30
Introduce internal/jni
2016-05-28 19:01:26 +09:00
Hajime Hoshi
4254e7b70e
audio: Add comment to explain why we don't free memory
2016-05-27 19:43:03 +09:00
Hajime Hoshi
ca2f85f3d1
audio: Refactoring: Add loop
2016-05-26 03:15:51 +09:00
Hajime Hoshi
d6dee0815e
audio: Bug fix: Avoid deadlock
2016-05-26 03:13:56 +09:00
Hajime Hoshi
644dfcd0fd
audio: Create an independent goroutine for enqueuing
2016-05-26 02:50:54 +09:00
Hajime Hoshi
12d62621e9
audio: Bug fix: Play sound correctly on Android
2016-05-26 01:46:26 +09:00
Hajime Hoshi
b65aeb7ac3
audio/internal/driver: Add driver_android.go (WIP)
2016-05-25 03:40:04 +09:00
Hajime Hoshi
64afa87def
audio: Add driver_mobile.go
2016-05-24 01:24:40 +09:00
Hajime Hoshi
f7211f3391
audio: Refactoring: No need to hold a buffer source
2016-04-23 02:33:13 +09:00
Hajime Hoshi
9a7e5683a1
audio: Remove redundant code in JS
2016-04-21 02:54:18 +09:00
Hajime Hoshi
5d5f27bcbf
audio: Bug fix: Reduce noise by using long buffers ( #205 )
2016-04-21 02:48:43 +09:00
Hajime Hoshi
b0178e8425
audio: Move exp/audio -> audio ( #206 )
2016-04-19 01:26:37 +09:00