Skip to contents

Implementation of basic S3 methods, such as, format, print, as.raw and as.character ( see usage section for a complete overview). See vignette('s3class') for an overview of ProTrackR2 S3 class objects. See usage section for an overview of available methods.

Usage

# S3 method for class 'pt2mod'
format(x, ...)

# S3 method for class 'pt2mod'
print(x, ...)

# S3 method for class 'pt2pat'
format(
  x,
  padding = " ",
  empty_char = "-",
  fmt = getOption("pt2_cell_format"),
  ...
)

# S3 method for class 'pt2command'
format(x, fmt = getOption("pt2_effect_format"), ...)

# S3 method for class 'pt2command'
print(x, max.print = 10L, ...)

# S3 method for class 'pt2pat'
print(x, sep = "  ", show_header = TRUE, show_row = TRUE, ...)

# S3 method for class 'pt2pat'
as.character(x, ...)

# S3 method for class 'pt2celllist'
as.raw(x, ...)

# S3 method for class 'logical'
as.raw.pt2celllist(x, compact = TRUE, ...)

# S3 method for class 'pt2pat'
as.raw(x, ...)

# S3 method for class 'logical'
as.raw.pt2pat(x, compact = TRUE, ...)

# S3 method for class 'pt2cell'
format(
  x,
  padding = " ",
  empty_char = "-",
  fmt = getOption("pt2_cell_format"),
  ...
)

# S3 method for class 'pt2cell'
print(x, ...)

# S3 method for class 'pt2cell'
as.character(x, ...)

# S3 method for class 'pt2command'
as.raw(x, ...)

# S3 method for class 'pt2cell'
as.raw(x, ...)

# S3 method for class 'logical'
as.raw.pt2cell(x, compact = TRUE, ...)

# S3 method for class 'pt2samp'
format(x, ...)

# S3 method for class 'pt2samp'
print(x, ...)

# S3 method for class 'pt2patlist'
format(x, ...)

# S3 method for class 'pt2patlist'
print(x, ...)

# S3 method for class 'pt2celllist'
format(x, ...)

# S3 method for class 'pt2celllist'
print(x, ...)

# S3 method for class 'pt2samplist'
format(x, ...)

# S3 method for class 'pt2samplist'
print(x, ...)

# S3 method for class 'pt2mod'
as.raw(x, ...)

# S3 method for class 'pt2samp'
as.raw(x, ...)

# S3 method for class 'pt2samp'
as.integer(x, ...)

# S3 method for class 'pt2celllist'
length(x, ...)

# S3 method for class 'pt2command'
length(x, ...)

Arguments

x

Object to apply S3 method to. See 'usage' section for allowed object types.

...

Passed on to other methods.

padding

A vector of character strings used to pad between note and instrument number (element 1) and between instrument number and effect command (element 2). Values are recycled.

empty_char

A vector of single character values used to represent empty pattern elements. First element is used for notes, second for instrument number, the third for effect commands (see also vignette("effect_commands")). Values are recycled.

fmt

Experimental feature to format a pt2cell. It should be a named list containing formatting strings for elements in the cell. It should contain the elements "note", "padding", "instrument" and "effect". Its implementation may change in future releases.

max.print

Maximum number of elements to be printed.

sep

A separator character string for concatenating pattern table columns (i.e. channels).

show_header

A logical value indicating if a header should be shown for the pattern table.

show_row

A logical value indicating if the row of a pattern table should be labelled with its index.

compact

Should the pattern be formatted using a compact notation (as used for file storage), or a none-compact format as used by the player? This can be set with the compact argument.

Value

The following is returned by the different methods:

  • format: a formatted character representation of the object

  • print: same as format

  • as.character: same as format

  • as.raw: a raw representation of the object. In many cases it inherits the same class as x

  • as.integer: converted raw 8 bit sample data to signed pulse code modulation integer values between -128 and +127.

  • length returns number of elements in x