Skip to content

Commit

Permalink
Add trackGroup() getter function
Browse files Browse the repository at this point in the history
- MusicMixer.trackGroup() will only return a track if it exists and is a
  track group
  • Loading branch information
almic committed Apr 27, 2024
1 parent e05d9a4 commit cd5aaa2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/MusicMixer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ class MusicMixer {
return this.tracks[name];
}

/**
* Retrieve a track group by its name.
*
* @param name track group name
* @returns {TrackGroup} if found, `undefined` otherwise
*/
public trackGroup(name: string): TrackGroup | undefined {
const track = this.track(name);
return track instanceof TrackGroup ? track : undefined;
}

/**
* Set the volume of this mixer, the "master volumen."
* @param volume gain multiplier
Expand Down

0 comments on commit cd5aaa2

Please sign in to comment.