# Play handles

In LMMS, play handles manage playback of notes, instruments, or sample clips. All play handles are managed by subclasses of `PlayHandle`.

### Types of play handles

There are several types of `PlayHandle`s defined:

* [`NotePlayHandle`](https://docs.lmms.io/developer-guides/core/play-handles/noteplayhandle): manages `Note`s being played, and get audio output for specific note
* [`InstrumentPlayHandle`](https://docs.lmms.io/developer-guides/core/play-handles/instrumentplayhandle): manages instruments which provides per-instrument audio output(single-streamed instruments)
* [`SamplePlayHandle`](https://docs.lmms.io/developer-guides/core/play-handles/sampleplayhandle): manages sample playback
* `PresetPreviewHandle`
* `SampleRecordHandle`

### Important member variables and functions

* `m_offset`(type `f_cnt_t`): The number remaining of audio frames before the play handle starts to produce audio, evaluated at the beginning of a rendering period

### Functions which subclasses should implement

`PlayHandle` itself can't be used directly because it doesn't implement some of the required functionalities.

* `play(sampleFrame *buf)`: Render a period of audio buffer to `buf` and check/manage the playback state of the managed object
* `isFinished()`: Return whether the managed object finished playing and `this` can be deleted
* `isFromTrack(const Track *track)`: Check if the play handle plays objects in the given `track`
