Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
851 lines (445 sloc) 11.7 KB
layout permalink title excerpt
default
music-track.html
MOM/Track documentation
API Music\Track usage

API: Music / Track

Table of contents


Parent container

A Track is contained by a Song.


Accessing child nodes

countMeasures()

This method returns the number of measures contained by the track.

Type

integer

Example


$tab = new PhpTabs('mytabs.gp4');

$track = $tab->getTrack(0);

// Count the number of measures
echo $track->countMeasures();

// Will print a number between 0 and n-1

[^ Table of contents]({{ page.permalink }}#top)


getMeasure($index)

This method returns a Measure resource.

Parameters

  • integer $index

Type

\PhpTabs\Music\Measure

Example


$tab = new PhpTabs('mytabs.gp4');

// Get first measure
$measure = $tab->getTrack(0)->getMeasure(0);

// Print the measure id
echo $measure->getNumber();

// Will print "1"

[^ Table of contents]({{ page.permalink }}#top)


getMeasures()

This method returns an array of Measure resources.

These are all measures contained in the current track.

Type

[]\PhpTabs\Music\Measure

Example


$tab = new PhpTabs('mytabs.gp4');

// Get all measures
$measures = $tab->getTrack(0)->getMeasures();

// Print all measure ids
foreach ($measures as $index => $measure) {
	echo sprintf(
		"\nMeasure number=%d, index=%d",
		$measure->getNumber(),
		$index
	);
}

will ouput something like:


Measure number=1, index=0
Measure number=2, index=1
Measure number=3, index=2
Measure number=4, index=3

[^ Table of contents]({{ page.permalink }}#top)


countStrings()

This method returns the number of strings.

Type

integer

Example


$tab = new PhpTabs('mytabs.gp4');

$track = $tab->getTrack(0);

// Count the number of strings
echo $track->countStrings();

// Will print something like 6

[^ Table of contents]({{ page.permalink }}#top)


getString($index)

This method returns a TabString resource.

Parameters

  • integer $index

Type

\PhpTabs\Music\TabString

Example


$tab = new PhpTabs('mytabs.gp4');

// Get the first string
$string = $tab->getTrack(0)->getString(0);

// Print string value
echo $track->getValue();

// Will print something like "34"

[^ Table of contents]({{ page.permalink }}#top)


getStrings()

This method returns an array of TabString resources.

These are all configured strings for the current track.

Type

[]\PhpTabs\Music\TabString

Example


$tab = new PhpTabs('mytabs.gp4');

// Get all strings
$strings = $tab->getTrack(0)->getStrings();

// Print all strings data
foreach ($strings as $index => $string) {
	echo sprintf(
		"\nString index=%d, number=%d, value=%d",
		$index,
    $string->getNumber(),
    $string->getValue()
	);
}

will ouput something like:


String index=0, number=1, value=64
String index=1, number=2, value=59
String index=2, number=3, value=55
String index=3, number=4, value=50
String index=4, number=5, value=45
String index=5, number=6, value=40

[^ Table of contents]({{ page.permalink }}#top)


setNumber()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


addMeasure()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


removeMeasure()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


addString()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setStrings()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


getColor()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setColor()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setName()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


getOffset()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setOffset()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


isSolo()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setSolo()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


isMute()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setMute()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setChannelId()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setLyrics()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


setSong()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


clear()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


copyFrom()

This method returns.

Parameters

None

Type

integer

Values

Example

[^ Table of contents]({{ page.permalink }}#top)


Accessing properties

getSong()

This method returns the parent Song.

Type

\PhpTabs\Music\Song

Example


$tab = new Phptabs('mytab.gp4');

$track = $tab->getTrack(0);

// Print song name
echo $track->getSong()->getName();

// Will ouput "My song name"

[^ Table of contents]({{ page.permalink }}#top)


getName()

This method returns the name of the track.

Type

string

Example


$tab = new PhpTabs('mytabs.gp4');

// Get the first track
$track = $tab->getTrack(0);

// Print track name
echo $track->getName();

will ouput something like:

My track name

[^ Table of contents]({{ page.permalink }}#top)


getChannelId()

This method returns the channel identifier for this track.

Type

integer

Example


$tab = new PhpTabs('mytabs.gp4');

// Get the first track
$track = $tab->getTrack(0);

// Print the channel id
echo $track->getChannelId();

will ouput something like:

1

[^ Table of contents]({{ page.permalink }}#top)


getNumber()

This method returns the number identifier of the track.

Type

integer

Example


$tab = new PhpTabs('mytabs.gp4');

// Get the first track
$track = $tab->getTrack(0);

// Print the channel id
echo $track->getNumber();

will ouput something like:

1

[^ Table of contents]({{ page.permalink }}#top)


getLyrics()

This method returns a Lyric resource.

Type

\PhpTabs\Music\Lyric

Example

[^ Table of contents]({{ page.permalink }}#top)


Updating children


Updating properties


Examples

None


{% capture doc_url %}{{ site.github_doc_repository_url }}/docs/music-track.md{% endcapture %} {% include edit-doc-link.html %}