pub struct Notes<T> {
pub wav_path_root: Option<PathBuf>,
pub wav_files: HashMap<ObjId, PathBuf>,
pub midi_file: Option<PathBuf>,
pub materials_wav: Vec<PathBuf>,
pub bgm_volume_changes: BTreeMap<ObjTime, BgmVolumeObj>,
pub key_volume_changes: BTreeMap<ObjTime, KeyVolumeObj>,
pub seek_events: BTreeMap<ObjTime, SeekObj>,
pub text_events: BTreeMap<ObjTime, TextObj>,
pub judge_events: BTreeMap<ObjTime, JudgeObj>,
pub bga_keybound_events: BTreeMap<ObjTime, BgaKeyboundObj>,
pub option_events: BTreeMap<ObjTime, OptionObj>,
/* private fields */
}
Expand description
The playable objects set for querying by lane or time.
Fields§
§wav_path_root: Option<PathBuf>
The path to override the base path of the WAV file path. This allows WAV files to be referenced relative to a different directory.
wav_files: HashMap<ObjId, PathBuf>
The WAV file paths corresponding to the id of the note object.
midi_file: Option<PathBuf>
The path of MIDI file, which is played as BGM while playing the score.
materials_wav: Vec<PathBuf>
Material WAV file paths. #MATERIALSWAV
bgm_volume_changes: BTreeMap<ObjTime, BgmVolumeObj>
BGM volume change events, indexed by time. #97
key_volume_changes: BTreeMap<ObjTime, KeyVolumeObj>
KEY volume change events, indexed by time. #98
seek_events: BTreeMap<ObjTime, SeekObj>
Seek events, indexed by time. #05
text_events: BTreeMap<ObjTime, TextObj>
Text events, indexed by time. #99
judge_events: BTreeMap<ObjTime, JudgeObj>
Judge events, indexed by time. #A0
bga_keybound_events: BTreeMap<ObjTime, BgaKeyboundObj>
BGA keybound events, indexed by time. #A5
option_events: BTreeMap<ObjTime, OptionObj>
Option events, indexed by time. #A6
Implementations§
Source§impl<T> Notes<T>
impl<T> Notes<T>
Sourcepub fn into_all_notes(self) -> Vec<WavObj>
pub fn into_all_notes(self) -> Vec<WavObj>
Converts into the notes.
Sourcepub fn all_notes(&self) -> impl Iterator<Item = &WavObj>
pub fn all_notes(&self) -> impl Iterator<Item = &WavObj>
Returns the iterator having all of the notes sorted by time.
Sourcepub fn all_entries(&self) -> impl Iterator<Item = (WavObjArenaIndex, &WavObj)>
pub fn all_entries(&self) -> impl Iterator<Item = (WavObjArenaIndex, &WavObj)>
Returns the iterator having all of the notes and its index sorted by time.
Sourcepub fn playables(&self) -> impl Iterator<Item = &WavObj>where
T: KeyLayoutMapper,
pub fn playables(&self) -> impl Iterator<Item = &WavObj>where
T: KeyLayoutMapper,
Returns all the playable notes in the score.
Sourcepub fn displayables(&self) -> impl Iterator<Item = &WavObj>where
T: KeyLayoutMapper,
pub fn displayables(&self) -> impl Iterator<Item = &WavObj>where
T: KeyLayoutMapper,
Returns all the displayable notes in the score.
Sourcepub fn bgms(&self) -> impl Iterator<Item = &WavObj>where
T: KeyLayoutMapper,
pub fn bgms(&self) -> impl Iterator<Item = &WavObj>where
T: KeyLayoutMapper,
Returns all the bgms in the score.
Sourcepub fn notes_on(
&self,
channel_id: NoteChannelId,
) -> impl Iterator<Item = (WavObjArenaIndex, &WavObj)>where
T: KeyLayoutMapper,
pub fn notes_on(
&self,
channel_id: NoteChannelId,
) -> impl Iterator<Item = (WavObjArenaIndex, &WavObj)>where
T: KeyLayoutMapper,
Retrieves notes on the specified channel id by the key mapping T
.
Sourcepub fn notes_in<R: RangeBounds<ObjTime>>(
&self,
time_span: R,
) -> impl DoubleEndedIterator<Item = (WavObjArenaIndex, &WavObj)>
pub fn notes_in<R: RangeBounds<ObjTime>>( &self, time_span: R, ) -> impl DoubleEndedIterator<Item = (WavObjArenaIndex, &WavObj)>
Retrieves notes in the specified time span.
Sourcepub fn next_obj_by_key(
&self,
channel_id: NoteChannelId,
time: ObjTime,
) -> Option<&WavObj>
pub fn next_obj_by_key( &self, channel_id: NoteChannelId, time: ObjTime, ) -> Option<&WavObj>
Finds next object on the key Key
from the time ObjTime
.
Sourcepub fn last_obj_time(&self) -> Option<ObjTime>
pub fn last_obj_time(&self) -> Option<ObjTime>
Gets the latest starting time of all notes.
Sourcepub fn last_playable_time(&self) -> Option<ObjTime>where
T: KeyLayoutMapper,
pub fn last_playable_time(&self) -> Option<ObjTime>where
T: KeyLayoutMapper,
Gets the time of last playable object.
Sourcepub fn last_bgm_time(&self) -> Option<ObjTime>where
T: KeyLayoutMapper,
pub fn last_bgm_time(&self) -> Option<ObjTime>where
T: KeyLayoutMapper,
Gets the time of last BGM object.
You can’t use this to find the length of music. Because this doesn’t consider that the length of sound. And visible notes may ring after all BGMs.
Source§impl<T> Notes<T>
impl<T> Notes<T>
Sourcepub fn remove_note(&mut self, wav_id: ObjId) -> Vec<WavObj>where
T: KeyLayoutMapper,
pub fn remove_note(&mut self, wav_id: ObjId) -> Vec<WavObj>where
T: KeyLayoutMapper,
Removes notes belonging to the wav id.
Sourcepub fn pop_by_idx(&mut self, idx: WavObjArenaIndex) -> Option<WavObj>
pub fn pop_by_idx(&mut self, idx: WavObjArenaIndex) -> Option<WavObj>
Removes a note of the specified index idx
.
Sourcepub fn pop_latest_of(&mut self, wav_id: ObjId) -> Option<WavObj>where
T: KeyLayoutMapper,
pub fn pop_latest_of(&mut self, wav_id: ObjId) -> Option<WavObj>where
T: KeyLayoutMapper,
Removes the latest note using the wav of wav_id
.
Sourcepub fn push_bgm(&mut self, time: ObjTime, wav_id: ObjId)where
T: KeyLayoutMapper,
pub fn push_bgm(&mut self, time: ObjTime, wav_id: ObjId)where
T: KeyLayoutMapper,
Adds the BGM (auto-played) note of wav_id
at time
.
Sourcepub fn push_wav<P: Into<PathBuf>>(
&mut self,
wav_id: ObjId,
path: P,
) -> Option<PathBuf>
pub fn push_wav<P: Into<PathBuf>>( &mut self, wav_id: ObjId, path: P, ) -> Option<PathBuf>
Links the wav file path
to the object id wav_id
. Then returns the old path if existed.
Sourcepub fn remove_wav(&mut self, wav_id: &ObjId) -> Option<PathBuf>
pub fn remove_wav(&mut self, wav_id: &ObjId) -> Option<PathBuf>
Unlinks the wav file path from the object id wav_id
, and return the path if existed.
Sourcepub fn retain_notes<F: FnMut(&WavObj) -> bool>(&mut self, cond: F)where
T: KeyLayoutMapper,
pub fn retain_notes<F: FnMut(&WavObj) -> bool>(&mut self, cond: F)where
T: KeyLayoutMapper,
Retains note objects with the condition cond
. It keeps only the WavObj
s which cond
returned true
.
Sourcepub fn dup_note_into(&mut self, src: ObjId, at: ObjTime, dst: NoteChannelId)
pub fn dup_note_into(&mut self, src: ObjId, at: ObjTime, dst: NoteChannelId)
Duplicates the object with id src
at the time at
into the channel of id dst
.
Sourcepub fn push_bgm_volume_change(
&mut self,
volume_obj: BgmVolumeObj,
prompt_handler: &mut impl PromptHandler,
) -> Result<(), ParseWarning>
pub fn push_bgm_volume_change( &mut self, volume_obj: BgmVolumeObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>
Adds a new BGM volume change object to the notes.
Sourcepub fn push_key_volume_change(
&mut self,
volume_obj: KeyVolumeObj,
prompt_handler: &mut impl PromptHandler,
) -> Result<(), ParseWarning>
pub fn push_key_volume_change( &mut self, volume_obj: KeyVolumeObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>
Adds a new KEY volume change object to the notes.
Sourcepub fn push_seek_event(
&mut self,
seek_obj: SeekObj,
prompt_handler: &mut impl PromptHandler,
) -> Result<(), ParseWarning>
pub fn push_seek_event( &mut self, seek_obj: SeekObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>
Adds a new seek object to the notes.
Sourcepub fn push_text_event(
&mut self,
text_obj: TextObj,
prompt_handler: &mut impl PromptHandler,
) -> Result<(), ParseWarning>
pub fn push_text_event( &mut self, text_obj: TextObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>
Adds a new text object to the notes.
Sourcepub fn push_judge_event(
&mut self,
judge_obj: JudgeObj,
prompt_handler: &mut impl PromptHandler,
) -> Result<(), ParseWarning>
pub fn push_judge_event( &mut self, judge_obj: JudgeObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>
Adds a new judge object to the notes.
Sourcepub fn push_bga_keybound_event(
&mut self,
keybound_obj: BgaKeyboundObj,
prompt_handler: &mut impl PromptHandler,
) -> Result<(), ParseWarning>
pub fn push_bga_keybound_event( &mut self, keybound_obj: BgaKeyboundObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>
Adds a new BGA keybound object to the notes.
Sourcepub fn push_option_event(
&mut self,
option_obj: OptionObj,
prompt_handler: &mut impl PromptHandler,
) -> Result<(), ParseWarning>
pub fn push_option_event( &mut self, option_obj: OptionObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>
Adds a new option object to the notes.
Source§impl<T> Notes<T>
impl<T> Notes<T>
Sourcepub fn change_note_channel<I>(&mut self, targets: I, dst: NoteChannelId)where
T: KeyLayoutMapper,
I: IntoIterator<Item = WavObjArenaIndex>,
pub fn change_note_channel<I>(&mut self, targets: I, dst: NoteChannelId)where
T: KeyLayoutMapper,
I: IntoIterator<Item = WavObjArenaIndex>,
Changes the channel of notes target
in time_span
into another channel dst
.
Sourcepub fn change_note_time(
&mut self,
target: WavObjArenaIndex,
new_time: ObjTime,
) -> Option<ObjTime>
pub fn change_note_time( &mut self, target: WavObjArenaIndex, new_time: ObjTime, ) -> Option<ObjTime>
Changes the specified object target
’s offset time into new_time
.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Notes<T>
impl<'de, T> Deserialize<'de> for Notes<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<T: Eq> Eq for Notes<T>
impl<T> StructuralPartialEq for Notes<T>
Auto Trait Implementations§
impl<T> Freeze for Notes<T>
impl<T> RefUnwindSafe for Notes<T>
impl<T> Send for Notes<T>
impl<T> Sync for Notes<T>
impl<T> Unpin for Notes<T>
impl<T> UnwindSafe for Notes<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§impl<T> SourceRangeMixinExt for T
impl<T> SourceRangeMixinExt for T
Source§fn into_wrapper<W>(
self,
wrapper: &SourceRangeMixin<W>,
) -> SourceRangeMixin<Self>where
Self: Sized,
fn into_wrapper<W>(
self,
wrapper: &SourceRangeMixin<W>,
) -> SourceRangeMixin<Self>where
Self: Sized,
SourceRangeMixin
with the same span as a wrapper.Source§fn into_wrapper_range(self, range: Range<usize>) -> SourceRangeMixin<Self>where
Self: Sized,
fn into_wrapper_range(self, range: Range<usize>) -> SourceRangeMixin<Self>where
Self: Sized,
SourceRangeMixin
with a given range.Source§fn into_wrapper_span(self, span: (usize, usize)) -> SourceRangeMixin<Self>where
Self: Sized,
fn into_wrapper_span(self, span: (usize, usize)) -> SourceRangeMixin<Self>where
Self: Sized,
SourceRangeMixin
with a given (start, end) span.