You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: wavetable_instance.rs
    path of file: ./repos/UnicornConsole/unicorn/src/sound/instruments/wavetable
    
    the code of the file until where you have to start completion: use std::{mem::MaybeUninit, sync::Arc};

use crate::audio::instruments::index_interpolator::IndexInterpolatorResult;
use crate::audio::instruments::wavetable::wavetable_definition::WavetableDefinition;
use crate::audio::instruments::wavetable::WavetableBitDepth;

use crate::sound::instruments::ActiveState;
use crate::sound::envelope::envelope_instance::EnvelopeInstance;
use crate::sound::instruments::wavetable::wavetable_oscillator::WavetableOscillator;

pub(crate) static mut NO_SOUND_DEFINITION: MaybeUninit<Arc<WavetableDefinition>> =
    MaybeUninit::uninit();

#[derive(Clone, Debug)]
pub struct WavetableInstance {
    definition: Arc<Waveta
    
    pub fn tick(&mut self) -> f32 {
        let index = self.oscillator.tick();

        let indices = self.oscillator.get_interpolated_indices(index);

        let output = match indices {
            IndexInterpolatorResult::Single(index) => {
                self.definition.data[index] as f32 / WavetableBitDepth::MAX as f32
            }
            IndexInterpolatorResult::Multiple(indices) => {
                indices.into_iter().fold(0.0, |val, (index, scaling)| {
                    val + ((self.definition.data[index] as f32 / WavetableBitDepth::MAX as f32)
                        * scaling)
                })
            }
        };

        let envelope = self.envelope.tick(self.active);

        if ActiveState::Trigger == self.active {
            self.active = ActiveState::Off;
        }

        output * envelope
    }