fn sweep_calculation(&mut self) -> u16 {
		// X(t-1)/2^n
		let mut new_frequency = self.sweep_shadow >> self.sweep.shift;

		new_frequency = if self.sweep.direction == 0 {
			// Sweep direction 0 is increase
			self.sweep_shadow + new_frequency
		} else {
			// Sweep direction 1 is decrease
			self.sweep_shadow - new_frequency
		};

		if new_frequency > 2047 {
			self.enabled = false;
		}

		new_frequency
	}
// Calculates new frequency based on sweep shift.
// X(t) = X(t-1) +/- X(t-1)/2^n
Calculates new frequency based on sweep shift.
Calculates new frequency based on sweep shift .
fn sweep_calculation(&mut self) -> u16 {
		// X(t-1)/2^n
		let mut new_frequency = self.sweep_shadow >> self.sweep.shift;
		new_frequency = if self.sweep.direction == 0 {
			// Sweep direction 0 is increase
			self.sweep_shadow + new_frequency
		} else {
			// Sweep direction 1 is decrease
			self.sweep_shadow - new_frequency
		};
		if new_frequency > 2047 {
			self.enabled = false;
		}
		new_frequency
	}
fn sweep_calculation ( & mut self ) -> u16 { // X(t-1)/2^n let mut new_frequency = self . sweep_shadow >> self . sweep . shift ; new_frequency = if self . sweep . direction == 0 { // Sweep direction 0 is increase self . sweep_shadow + new_frequency } else { // Sweep direction 1 is decrease self . sweep_shadow - new_frequency } ; if new_frequency > 2047 { self . enabled = false ; } new_frequency }
Calculates new frequency based on sweep shift.
Calculates new frequency based on sweep shift .
&mut self
&mut self