Audio Controller - aaronboult/emulator-8080 GitHub Wiki

AudioController

A struct used to manage the audio that should be played through the machine. The volume initializes at 64 (50% of max volume)

Methods

Contents


.close(...)

Declaration

pub fn close(&mut self)

Description

Wraps the close_audio() method on the sdl2::mixer module


.play_track(...)

Declaration

pub fn play_track(&mut self, track_index: u8, number_of_repeats: i32)

Description

Plays the track that was loaded at index track_index and repeats the track as specified in number_of_repeats


.stop_track(...)

Declaration

pub fn stop_track(&mut self, track_index: u8)

Description

Stops all channels playing the track that was loaded at index track_index


.volume_up(...)

Declaration

pub fn volume_up(&mut self)

Description

Increases the volume by a value of 1; the volume does not change if the volume is already at it's maximum value of 128


.volume_down(...)

Declaration

pub fn volume_down(&mut self)

Description

Decreases the volume by a value of 1; the volume does not change if the volume is already 0


.toggle_mute(...)

Declaration

pub fn toggle_mute(&mut self)

Description

Mutes the volume if it is not already muted, otherwise the audio is unmuted

⚠️ **GitHub.com Fallback** ⚠️