name: Obtain or replace the name of a PTModule or PTSample

nameR Documentation

Obtain or replace the name of a PTModule or PTSample

Description

The name of both a PTModule and PTSample are stored as raw data. This method returns the name as a character string, or it can be used to assign a new name to a PTModule or PTSample.

Usage

## S4 method for signature 'PTSample'
name(x)

## S4 replacement method for signature 'PTSample,character'
name(x) <- value

## S4 method for signature 'PTModule'
name(x)

## S4 replacement method for signature 'PTModule,character'
name(x) <- value

Arguments

x

A PTModule or a PTSample object for which to obtain or replace the name.

value

A character string which should be used to replace the name of PTModule or PTSample x.

Details

The name of a PTModule and PTSample is stored as a vector of raw data with a length of 20 or 22 respectively. This method provides the means for getting the name as a character string or to safely redefine the name of a PTModule or PTSample object. To do so, the provided name (value) is converted to a raw vector of length 20 or 22 respectively. Long names may therefore get clipped.

Value

For name, the name of the PTModule or PTSample object as a character string is returned.

For name<-, object x with an updated name is returned.

Author(s)

Pepijn de Vries

See Also

Other character.operations: as.character(), periodToChar(), rawToCharNull(), sampleRate

Other sample.operations: PTSample-class, PTSample-method, fineTune(), loopLength(), loopSample(), loopStart(), loopState(), playSample(), read.sample(), sampleLength(), volume(), waveform(), write.sample()

Examples

data("mod.intro")

## get the name of mod.intro:
name(mod.intro)

## I don't like the name, let's change it:
name(mod.intro) <- "I like this name better"

## Note that the provided name was too long and is truncated:
name(mod.intro)

## print all sample names in the module:
unlist(lapply(as.list(1:31), function(x)
  name(PTSample(mod.intro, x))))


ProTrackR documentation built on Aug. 23, 2023, 1:07 a.m.