src/rconv/memson

  Source   Edit

Types

BpmRange = tuple[min: float, max: float]
The range of BPM the file is in   Source   Edit
Difficulty {.pure.} = enum
  Basic = "basic", Advanced = "advanced", Extreme = "extreme", Edit = "edit"
Difficulty for jubeat like games. Will be removed/replaced with a more generic solution soonish   Source   Edit
Memson = ref object
  songTitle*: string         ## The title of the chart's song.
  artist*: string            ## The artist of the chart's song.
  difficulty*: Difficulty    ## The difficulty of the chart.
  level*: int                ## The difficulty as level range (Usually 1-10) of the chart.
  bpm*: float                ## The BPM of the chart. May not be accurate if the `bpmRange` is set.
  bpmRange*: BpmRange        ## The BPM-Range of the chart.
                             ## May only be set if BPM changes occur in the chart.
  sections*: seq[Section]    ## The sections of the chart.
  
Memson is the in-memory data-structure for memo-files.   Source   Edit
Note = ref object
  time*: int                 ## The timing id when this note has to be pressed.
  partIndex*: int            ## In which part this note was originally defined.
  case kind*: NoteType       ## Which kind this Note is (Note or Hold)
  of NoteType.Hold:
      animationStartIndex*: int ## On which position the animation for the hold starts on.
      releaseTime*: int      ## The release timing id when the hold has to be released.
      releasePart*: int      ## The part in which the the hold was released.
      releaseSection*: int   ## In which section it has to look for the timing id.
    
  else:
      nil

  
A Note or Hold which has to be pressed.   Source   Edit
NoteRange = range[0 .. 15]
All positions a note can be placed on. Posion description:
0  1  2  3
4  5  6  7
8  9 10 11
12 13 14 15
  Source   Edit
NoteType {.pure.} = enum
  Note = "note", Hold = "hold"
The types of notes that exist (regular note, or a hold)   Source   Edit
RowIndex = range[0 .. 3]
Range of how many row-indices may exist (4).   Source   Edit
Section = ref object
  index*: int                ## The index of this section.
  bpm*: float                ## What BPM this section is using.
  partCount*: int            ## How many parts this section originally consisted of.
  timings*: seq[int]         ## Timing ids which defined when a note needs to be pressed.
  snaps*: seq[Snap]          ## The snaps for the timing.
  noteCount*: uint           ## How many notes in total are stored
  notes*: OrderedTable[NoteRange, seq[Note]] ## Notes that need to be played.
                                             ## Keys are the positions, which start from top-left to bottom-right.
                                             ## _`NoteRange`
  
Describes a complete section (with all parts).   Source   Edit
Snap = ref object
  length*: int               ## How many notes fit into a Snap.
  partIndex*: int            ## In which part of the original section this snap is defined.
  row*: RowIndex             ## The row in which this snap is defined.
  
Describes the amount of notes that can occur in a single beat.   Source   Edit

Procs

func newHold(time: int = 0; partIndex: int = 0; animationStartIndex: int = 0;
             releaseTime: int = 0; releasePart: int = 0; releaseSection: int = 1): Note {.
    ...raises: [], tags: [].}
  Source   Edit
func newMemson(songTitle: string = ""; artist: string = "";
               difficulty: Difficulty = Difficulty.Basic; level: int = 1;
               bpm: float = 0.0; bpmRange: BpmRange;
               sections: seq[Section] = @[]): Memson {....raises: [], tags: [].}
  Source   Edit
func newNote(time: int = 0; partIndex: int = 0): Note {....raises: [], tags: [].}
  Source   Edit
func newSection(index: int = 1; bpm: float = 0.0; partCount: int = 1;
                timings: seq[int] = @[]; snaps: seq[Snap] = @[];
                noteCount: uint = 0;
                notes: OrderedTable[NoteRange, seq[Note]] = initOrderedTable()): Section {.
    ...raises: [], tags: [].}
  Source   Edit
func newSnap(length: int = 1; partIndex: int = 0; row = 0): Snap {....raises: [],
    tags: [].}
  Source   Edit
func parseDifficulty(input: string): Difficulty {....raises: [], tags: [].}
  Source   Edit