[][src]Struct nbs::header::Header

pub struct Header {
    pub vannila_instrument_count: Option<i8>,
    pub layer_count: i16,
    pub song_name: String,
    pub song_author: String,
    pub original_song_author: String,
    pub song_description: String,
    pub song_tempo: i16,
    pub auto_saving: bool,
    pub auto_saving_duration: i8,
    pub time_signature: i8,
    pub minutes_spent: i32,
    pub left_clicks: i32,
    pub right_clicks: i32,
    pub noteblocks_added: i32,
    pub noteblocks_removed: i32,
    pub imported_file_name: String,
    pub is_loop: Option<bool>,
    pub max_loop_count: Option<i8>,
    pub loop_start_tick: Option<i16>,
    pub format: NbsFormat,
    // some fields omitted
}

The header contains information about the file

Fields

vannila_instrument_count: Option<i8>

Amount of default instruments when the song was saved. This is needed to determine at what index custom instruments start. Only avabile in the new format

layer_count: i16

The last layer with at least one note block in it, or the last layer that has had its name, volume or stereo changed.

song_name: String

The name of the song.

song_author: String

The author of the song.

original_song_author: String

The original author of the song.

song_description: String

The description of the song.

song_tempo: i16

The tempo of the song multiplied by 100.

auto_saving: bool

Whether auto-saving has been enabled. As of NBS version 4 this value is still saved to the file, but no longer used in the program.

auto_saving_duration: i8

The amount of minutes between each auto-save (if it has been enabled) (1-60). As of NBS version 4 this value is still saved to the file, but no longer used in the program.

time_signature: i8

The time signature of the song. If this is 3, then the signature is 3/4. Default is 4. This value ranges from 2-8.

minutes_spent: i32

Amount of minutes spent on the project.

left_clicks: i32

Amount of times the user has left-clicked.

right_clicks: i32

Amount of times the user has right-clicked.

noteblocks_added: i32

Amount of times the user has added a note block.

noteblocks_removed: i32

The amount of times the user have removed a note block.

imported_file_name: String

If the song has been imported from a .mid or .schematic file, that file name is stored here (only the name of the file, not the path).

is_loop: Option<bool>

Whether looping is on or off. Only avabile in the new format.

max_loop_count: Option<i8>

0 = infinite. Other values mean the amount of times the song loops. Only avabile in the new format.

loop_start_tick: Option<i16>

Determines which part of the song (in ticks) it loops back to. Only avabile in the new format.

format: NbsFormat

Not part of the Header.

Methods

impl Header[src]

pub fn new(format: NbsFormat) -> Self[src]

pub fn decode<R>(reader: &mut R) -> Result<Self, NbsError> where
    R: ReadStringExt
[src]

pub fn encode<W>(
    &self,
    format: NbsFormat,
    writer: &mut W
) -> Result<(), NbsError> where
    W: WriteStringExt
[src]

pub fn song_ticks(&self) -> Option<i16>[src]

Returns the song ticks. This method will only return valid results for old versions and version 3 and 4 of the new version.

pub fn song_length(&self) -> Option<Duration>[src]

Returns the song Duration. This method will only return valid results for old versions and version 3 and 4 of the new version.

Trait Implementations

impl Debug for Header[src]

Auto Trait Implementations

impl RefUnwindSafe for Header

impl Send for Header

impl Sync for Header

impl Unpin for Header

impl UnwindSafe for Header

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.