diff --git a/core/src/avm2/globals/flash/media/soundchannel.rs b/core/src/avm2/globals/flash/media/soundchannel.rs index c94607816..e449b3fe6 100644 --- a/core/src/avm2/globals/flash/media/soundchannel.rs +++ b/core/src/avm2/globals/flash/media/soundchannel.rs @@ -2,7 +2,7 @@ use crate::avm2::activation::Activation; use crate::avm2::class::{Class, ClassAttributes}; -use crate::avm2::method::Method; +use crate::avm2::method::{Method, NativeMethodImpl}; use crate::avm2::names::{Namespace, QName}; use crate::avm2::object::{soundchannel_allocator, Object}; use crate::avm2::value::Value; @@ -31,6 +31,24 @@ pub fn class_init<'gc>( Ok(Value::Undefined) } +/// Stub `SoundChannel.leftPeak` +pub fn left_peak<'gc>( + _activation: &mut Activation<'_, 'gc, '_>, + _this: Option>, + _args: &[Value<'gc>], +) -> Result, Error> { + Err("Sound.leftPeak is a stub.".into()) +} + +/// Stub `SoundChannel.rightPeak` +pub fn right_peak<'gc>( + _activation: &mut Activation<'_, 'gc, '_>, + _this: Option>, + _args: &[Value<'gc>], +) -> Result, Error> { + Err("Sound.rightPeak is a stub.".into()) +} + /// Construct `SoundChannel`'s class. pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> { let class = Class::new( @@ -46,5 +64,15 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc> write.set_attributes(ClassAttributes::SEALED | ClassAttributes::FINAL); write.set_instance_allocator(soundchannel_allocator); + const PUBLIC_INSTANCE_PROPERTIES: &[( + &str, + Option, + Option, + )] = &[ + ("leftPeak", Some(left_peak), None), + ("rightPeak", Some(right_peak), None), + ]; + write.define_public_builtin_instance_properties(mc, PUBLIC_INSTANCE_PROPERTIES); + class }