Implementation of basic S3 methods
s3methods.Rd
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 '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 '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, ...)
Arguments
- x
Object to apply S3 method to. See 'usage' section for allowed object types.
- ...
Passed on to other methods.
- padding
A
vector
ofcharacter
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 singlecharacter
values used to represent empty pattern elements. First element is used for notes, second for instrument number, the third for effect commands. Values are recycled.- fmt
Experimental feature to format a
pt2cell
. It should be a namedlist
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.- 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 formattedcharacter
representation of the objectprint
: same asformat
as.character
: same asformat
as.raw
: araw
representation of the object. In many cases it inherits the same class asx
as.integer
: convertedraw
8 bit sample data to signed pulse code modulationinteger
values between -128 and +127.