Commit Graph

5390 Commits

Author SHA1 Message Date
David Wendt 116fb1f323 avm2: Impl `Sound.play`
This does not (yet) implement the third `SoundTransform` parameter on `play`.
2021-09-03 16:47:02 -06:00
David Wendt 8a58956f1f avm2: Add `flash.media.SoundChannel` class & associated object storage 2021-09-03 16:47:02 -06:00
David Wendt 3c3228f3c9 tests: Add tests for `SimpleButton.soundTransform` and `SoundMixer.soundTransform` 2021-09-03 16:47:02 -06:00
David Wendt 46de9ee46e avm2: `soundTransform` isn't a movieclip property, so don't ask for one. 2021-09-03 16:47:02 -06:00
David Wendt 1bde07089d avm2: Alias `SimpleButton.soundTransform` to the class property of `SoundMixer.soundTransform` 2021-09-03 16:47:02 -06:00
David Wendt 0f625e7864 avm2: Impl `SoundMixer.soundTransform` class property 2021-09-03 16:47:02 -06:00
David Wendt 8e1122104d avm2: Correct `SoundTransform` class definition to match docs 2021-09-03 16:47:02 -06:00
David Wendt 2f6e695483 avm2: Impl `Sprite.soundTransform` 2021-09-03 16:47:02 -06:00
David Wendt 66117450f5 tests: Add more coverage of `rightToLeft` as it disables `pan` 2021-09-03 16:47:02 -06:00
David Wendt 3b9f0f271d avm2: `SoundTransform.pan` returns 0 if the transform sends sound to different channels 2021-09-03 16:47:02 -06:00
David Wendt 2b7a0bf898 avm2: `SoundTransform` stores it's values as square roots 2021-09-03 16:47:02 -06:00
David Wendt 9926237074 tests: Add a test for AS3 `SoundTransform` properties 2021-09-03 16:47:02 -06:00
David Wendt bd3cec0d20 avm2: Impl `flash.media.SoundTransform` 2021-09-03 16:47:02 -06:00
David Wendt 3b6eea2a1d core: Report sound duration as `f64` and round down in AS1 2021-09-03 16:47:02 -06:00
David Wendt e4c6e29b8a core: `NullAudioBackend` should not report latency seek data as part of the size of a sound. 2021-09-03 16:47:02 -06:00
David Wendt d7f2f782c4 avm2: Impl `Sound.length`
This also adds duration tracking for `NullAudioBackend`.
2021-09-03 16:47:02 -06:00
David Wendt e25fb732ea avm2: Stub `Sound.isBuffering`, `Sound.isURLInaccessible`, and `Sound.url` 2021-09-03 16:47:02 -06:00
David Wendt b184273352 tests: Add some basic tests for the `Sound` class 2021-09-03 16:47:02 -06:00
David Wendt 89b411593f avm2: Impl `Sound.bytesTotal` 2021-09-03 16:47:02 -06:00
David Wendt d5fb807387 avm2: Allow calling `Function.apply` without a second argument 2021-09-03 16:47:02 -06:00
David Wendt 7b31cd9a4d avm2: Allow instantiating a SWF sound by constructing it's symbol class 2021-09-03 16:47:02 -06:00
David Wendt 37eb746989 core: Don't warn when associating sounds to AS3 classes 2021-09-03 16:47:02 -06:00
David Wendt 0c591f3370 avm2: Stub implementation of `Sound` and accompanying object type 2021-09-03 16:47:02 -06:00
relrelb fff739d5c9 desktop: Cleanup `CpalAudioBackend` 2021-09-03 22:48:35 +03:00
relrelb 66e2a2166e desktop: Revert cpal initialization on a separate thread
It was initialized on a separate thread since 6178dd9ef1,
as a workaround for Windows.

But now thanks to https://github.com/RustAudio/cpal/pull/597, this
is no longer needed, and cpal can be initialized on the same thread
as before.
2021-09-03 22:48:35 +03:00
David Wendt 70556e5830 avm2: Forbid `applytype` opcodes with more than one argument type. 2021-09-02 17:57:58 -06:00
David Wendt e2bf0a9857 avm2: Prohibit naming types with more than one parameter, as they don't exist. 2021-09-02 17:57:58 -06:00
David Wendt 141b992a73 avm2: Storing past the end of a vector only works for the immediate one-off-the-end index 2021-09-02 17:57:58 -06:00
David Wendt 8cd2b4fd5e avm2: Fill vector holes with the default value at creation time instead of storing them. 2021-09-02 17:57:58 -06:00
David Wendt 3b48216762 avm2: Don't store more than one object parameter, because there are no classes with multiple paramters. 2021-09-02 17:57:58 -06:00
David Wendt 5c740ef1e1 chore: Grammar 2021-09-02 17:57:58 -06:00
David Wendt d1b9df61f3 avm2: Move `Vector`'s properties to the AS3 namespace and add prototype properties in the public one 2021-09-02 17:57:58 -06:00
David Wendt cc15809f49 avm2: Add the ability to have a separate class initializer for each specialization of `Vector` 2021-09-02 17:57:58 -06:00
David Wendt e087a27e56 avm2: `Vector.sort` actually *does* calculate an indexed sort array, but then discards it.
Normally we could skip sorting, but values in the vector may have side effects when coerced. So we need to make sure coercions run, at least.
2021-09-02 17:57:58 -06:00
David Wendt 280fbbde45 avm2: Pick nits in `Vector`'s `instance_init` 2021-09-02 17:57:58 -06:00
David Wendt 2095c1831a avm2: Replace some if expressions with easier-to-read equivalents 2021-09-02 17:57:58 -06:00
David Wendt 464605d015 avm2: Pre-allocate all the things 2021-09-02 17:57:58 -06:00
David Wendt 535f4fba58 swf: Pre-allocate the parameters when parsing a `TypeName` 2021-09-02 17:57:58 -06:00
David Wendt bf4492c454 avm2: Add the legacy Vector types that old movies can use.
This one was rather tough to test, as I actually can't generate ABCs in Animate CC that reference these classes. I instead had to modify a compiled SWF to open the package-internal namespace that these pre-specialized classes exist in.
2021-09-02 17:57:58 -06:00
David Wendt dcf6d87363 avm2: Accept `null` as a valid type in `applytype`.
In AVM2, the `*` (any) type is represented as `null`.

This requires also changing the parameters on classes and objects to be nullable, too.

We do *not* represent `null` as a particular value on the underyling vector storage object, however. We instead change it to `Object`, as that's the root of all other types.

This may require revision if non-`Object`-extending types appear in the future.
2021-09-02 17:57:58 -06:00
David Wendt ee30f21e8e avm2: Remove unnecessary `mut` 2021-09-02 17:57:58 -06:00
David Wendt b452b653bf tests: Add a test for `Vector`'s instance initializer. 2021-09-02 17:57:58 -06:00
David Wendt aaddcc598f avm2: Impl `Vector.toLocaleString` and test `toString` 2021-09-02 17:57:58 -06:00
David Wendt d1e49db3cc avm2: Stub `Number.toLocaleString`
This exists but is undocumented, and I accidentally wrote a Vector test that needs it.
2021-09-02 17:57:58 -06:00
David Wendt dbc6f38c34 avm2: Impl `Vector.splice` 2021-09-02 17:57:58 -06:00
David Wendt 81d0775776 avm2: Impl `Vector.sort` 2021-09-02 17:57:58 -06:00
David Wendt 9fcd846a4d avm2: Fix ineffective Vector typechecks 2021-09-02 17:57:58 -06:00
David Wendt 44a9f13047 avm2: Impl `Vector.slice` 2021-09-02 17:57:58 -06:00
David Wendt 077fd87842 avm2: Impl `Vector.reverse` 2021-09-02 17:57:58 -06:00
David Wendt aa2d729a44 avm2: Impl `Vector.removeAt` 2021-09-02 17:57:58 -06:00