pub fn add_effect(
		&mut self,
		mut effect: impl Effect + 'static,
		settings: EffectSettings,
	) -> Result<EffectHandle, AddEffectError> {
		if self.active_effect_ids.len() >= self.active_effect_ids.capacity() {
			return Err(AddEffectError::EffectLimitReached);
		}
		let effect_id = settings.id.unwrap_or(EffectId::new());
		let handle = EffectHandle::new(
			effect_id,
			self.id.into(),
			&settings,
			self.command_producer.clone(),
		);
		effect.init(self.sample_rate);
		if let Some(handle) = self.resource_collector_handle.upgrade() {
			self.command_producer.push(
				MixerCommand::AddEffect(
					self.id.into(),
					effect_id,
					Owned::new(&handle, Box::new(effect)),
					settings,
				)
				.into(),
			)?;
			self.active_effect_ids.insert(effect_id);
		}
		Ok(handle)
	}
/// Adds an effect to the track.
Adds an effect to the track.
Adds an effect to the track .
pub fn add_effect(
		&mut self,
		mut effect: impl Effect + 'static,
		settings: EffectSettings,
	) -> Result<EffectHandle, AddEffectError> {
		if self.active_effect_ids.len() >= self.active_effect_ids.capacity() {
			return Err(AddEffectError::EffectLimitReached);
		}
		let effect_id = settings.id.unwrap_or(EffectId::new());
		let handle = EffectHandle::new(
			effect_id,
			self.id.into(),
			&settings,
			self.command_producer.clone(),
		);
		effect.init(self.sample_rate);
		if let Some(handle) = self.resource_collector_handle.upgrade() {
			self.command_producer.push(
				MixerCommand::AddEffect(
					self.id.into(),
					effect_id,
					Owned::new(&handle, Box::new(effect)),
					settings,
				)
				.into(),
			)?;
			self.active_effect_ids.insert(effect_id);
		}
		Ok(handle)
	}
pub fn add_effect ( & mut self , mut effect : impl Effect + ' static , settings : EffectSettings , ) -> Result < EffectHandle , AddEffectError > { if self . active_effect_ids . len ( ) >= self . active_effect_ids . capacity ( ) { return Err ( AddEffectError :: EffectLimitReached ) ; } let effect_id = settings . id . unwrap_or ( EffectId :: new ( ) ) ; let handle = EffectHandle :: new ( effect_id , self . id . into ( ) , & settings , self . command_producer . clone ( ) , ) ; effect . init ( self . sample_rate ) ; if let Some ( handle ) = self . resource_collector_handle . upgrade ( ) { self . command_producer . push ( MixerCommand :: AddEffect ( self . id . into ( ) , effect_id , Owned :: new ( & handle , Box :: new ( effect ) ) , settings , ) . into ( ) , ) ? ; self . active_effect_ids . insert ( effect_id ) ; } Ok ( handle ) }
Adds an effect to the track.
Adds an effect to the track .
&mut self
effect
impl Effect + 'static
settings
EffectSettings
&mut self
effect
impl Effect + 'static
settings
EffectSettings