# Amuse: amuse::Voice Class Reference

amuse::Voice Class Reference

`#include <Voice.hpp>`

Inheritance diagram for amuse::Voice:
Collaboration diagram for amuse::Voice:

## Public Member Functions

| Voice (Engine &engine, const AudioGroup &group, int groupId, int vid, bool emitter, Submix *smx)
| Voice (Engine &engine, const AudioGroup &group, int groupId, ObjectId oid, int vid, bool emitter, Submix *smx)
size_t | supplyAudio (size_t frames, int16_t *data)
Submix * | getSubmix ()
VoiceState | state () const
int | vid () const
int | maxVid () const
std::shared_ptr< Voice > | startChildMacro (int8_t addNote, ObjectId macroId, int macroStep)
bool | loadSoundObject (ObjectId objectId, int macroStep, double ticksPerSec, uint8_t midiKey, uint8_t midiVel, uint8_t midiMod, bool pushPc=false)
void | keyOff ()
void | message (int32_t val)
void | startSample (int16_t sampId, int32_t offset)
void | stopSample ()
void | setVolume (float vol)
void | setPan (float pan)
void | setSurroundPan (float span)
void | startEnvelope (double dur, float vol, const Curve *envCurve)
void | startFadeIn (double dur, float vol, const Curve *envCurve)
void | startPanning (double dur, uint8_t panPos, uint8_t panWidth)
void | startSpanning (double dur, uint8_t spanPos, uint8_t spanWidth)
void | setPitchKey (int32_t cents)
void | setPedal (bool pedal)
void | setDoppler (float doppler)
void | setVibrato (int32_t level, int32_t modLevel, float period)
void | setMod2VibratoRange (int32_t modLevel)
void | setTremolo (float tremoloScale, float tremoloModScale)
void | setLFO1Period (float period)
void | setLFO2Period (float period)
void | setPitchSweep1 (uint8_t times, int16_t add)
void | setPitchSweep2 (uint8_t times, int16_t add)
void | setReverbVol (float rvol)
void | setAdsr (ObjectId adsrId, bool dls)
void | setPitchFrequency (uint32_t hz, uint16_t fine)
void | setPitchAdsr (ObjectId adsrId, int32_t cents)
void | setPitchWheel (float pitchWheel)
void | setPitchWheelRange (int8_t up, int8_t down)
void | setAftertouch (uint8_t aftertouch)
void | setKeygroup (uint8_t kg)
uint8_t | getLastNote () const
void | notifyCtrlChange (uint8_t ctrl, int8_t val)
int8_t | getCtrlValue (uint8_t ctrl) const
void | setCtrlValue (uint8_t ctrl, int8_t val)
int8_t | getModWheel () const
void | installCtrlValues (int8_t *cvs)
int8_t | getPitchWheel () const
int8_t | getAftertouch () const
size_t | getTotalVoices () const
Public Member Functions inherited from amuse::Entity
| Entity (Engine &engine, const AudioGroup &group, int groupId, ObjectId oid=ObjectId())
Engine & | getEngine ()
const AudioGroup & | getAudioGroup () const
int | getGroupId () const
ObjectId | getObjectId () const

## Friends

class | Engine
class | Sequencer
class | SoundMacroState

## Additional Inherited Members

Protected Member Functions inherited from amuse::Entity
void | _destroy ()
Protected Attributes inherited from amuse::Entity
bool | m_destroyed = false
Engine & | m_engine
const AudioGroup & | m_audioGroup
int | m_groupId
ObjectId | m_objectId = 0xffff

## Detailed Description

Individual source of audio

Definition at line 30 of file Voice.hpp.

## Member Function Documentation

int8_t amuse::Voice::getAftertouch | ( |  | ) | const

inline

Get MIDI aftertouch value on voice

Definition at line 308 of file Voice.hpp.

int8_t amuse::Voice::getCtrlValue | ( | uint8_t | ctrl | ) | const

inline

Get MIDI Controller value on voice

Definition at line 270 of file Voice.hpp.

uint8_t amuse::Voice::getLastNote | ( |  | ) | const

inline

Get note played on voice

Definition at line 265 of file Voice.hpp.

int8_t amuse::Voice::getModWheel | ( |  | ) | const

inline

Get ModWheel value on voice

Definition at line 295 of file Voice.hpp.

int8_t amuse::Voice::getPitchWheel | ( |  | ) | const

inline

Get MIDI pitch wheel value on voice

Definition at line 305 of file Voice.hpp.

Submix* amuse::Voice::getSubmix | ( |  | ) |

inline

Obtain pointer to Voice's Submix

Definition at line 158 of file Voice.hpp.

size_t amuse::Voice::getTotalVoices | ( |  | ) | const

Get count of all voices in hierarchy, including this one

void amuse::Voice::installCtrlValues | ( | int8_t * | cvs | ) |

inline

'install' external MIDI controller storage

Definition at line 298 of file Voice.hpp.

void amuse::Voice::keyOff | ( |  | ) |

Signals voice to begin fade-out (or defer if sustained), eventually reaching silence

bool amuse::Voice::loadSoundObject | ( | ObjectId | objectId,
|  | int | macroStep,
|  | double | ticksPerSec,
|  | uint8_t | midiKey,
|  | uint8_t | midiVel,
|  | uint8_t | midiMod,
|  | bool | pushPc = `false`
| ) |  |

Load specified Sound Object from within group into voice

int amuse::Voice::maxVid | ( |  | ) | const

Get max VoiceId of this voice and any contained children

void amuse::Voice::message | ( | int32_t | val | ) |

Sends numeric message to voice and all siblings

void amuse::Voice::setAdsr | ( | ObjectId | adsrId,
|  | bool | dls
| ) |  |

Set envelope for voice

void amuse::Voice::setAftertouch | ( | uint8_t | aftertouch | ) |

Set aftertouch

void amuse::Voice::setCtrlValue | ( | uint8_t | ctrl,
|  | int8_t | val
| ) |  |

inline

Set MIDI Controller value on voice

Definition at line 282 of file Voice.hpp.

void amuse::Voice::setDoppler | ( | float | doppler | ) |

Set doppler factor for voice

void amuse::Voice::setKeygroup | ( | uint8_t | kg | ) |

inline

Assign voice to keygroup for coordinated mass-silencing

Definition at line 262 of file Voice.hpp.

void amuse::Voice::setLFO1Period | ( | float | period | ) |

inline

Setup LFO1 for voice

Definition at line 229 of file Voice.hpp.

void amuse::Voice::setLFO2Period | ( | float | period | ) |

inline

Setup LFO2 for voice

Definition at line 232 of file Voice.hpp.

void amuse::Voice::setMod2VibratoRange | ( | int32_t | modLevel | ) |

Configure modwheel influence range over vibrato

void amuse::Voice::setPan | ( | float | pan | ) |

Set current voice panning immediately

void amuse::Voice::setPedal | ( | bool | pedal | ) |

Set sustain status within voice; clearing will trigger a deferred keyoff

void amuse::Voice::setPitchAdsr | ( | ObjectId | adsrId,
|  | int32_t | cents
| ) |  |

Set pitch envelope

void amuse::Voice::setPitchFrequency | ( | uint32_t | hz,
|  | uint16_t | fine
| ) |  |

Set pitch in absolute hertz

void amuse::Voice::setPitchKey | ( | int32_t | cents | ) |

Set voice relative-pitch in cents

void amuse::Voice::setPitchSweep1 | ( | uint8_t | times,
|  | int16_t | add
| ) |  |

Setup pitch sweep controller 1

void amuse::Voice::setPitchSweep2 | ( | uint8_t | times,
|  | int16_t | add
| ) |  |

Setup pitch sweep controller 2

void amuse::Voice::setPitchWheel | ( | float | pitchWheel | ) |

Set pitchwheel value for use with controller

void amuse::Voice::setPitchWheelRange | ( | int8_t | up,
|  | int8_t | down
| ) |  |

Set effective pitch range via the pitchwheel controller

void amuse::Voice::setReverbVol | ( | float | rvol | ) |

Set reverb mix for voice

void amuse::Voice::setSurroundPan | ( | float | span | ) |

Set current voice surround-panning immediately

void amuse::Voice::setTremolo | ( | float | tremoloScale,
|  | float | tremoloModScale
| ) |  |

Setup tremolo parameters for voice

void amuse::Voice::setVibrato | ( | int32_t | level,
|  | int32_t | modLevel,
|  | float | period
| ) |  |

Set vibrato parameters for voice

void amuse::Voice::setVolume | ( | float | vol | ) |

Set current voice volume immediately

std::shared_ptr<Voice> amuse::Voice::startChildMacro | ( | int8_t | addNote,
|  | ObjectId | macroId,
|  | int | macroStep
| ) |  |

Allocate parallel macro and tie to voice for possible emitter influence

void amuse::Voice::startEnvelope | ( | double | dur,
|  | float | vol,
|  | const Curve * | envCurve
| ) |  |

Start volume envelope to specified level

void amuse::Voice::startFadeIn | ( | double | dur,
|  | float | vol,
|  | const Curve * | envCurve
| ) |  |

Start volume envelope from zero to current level

void amuse::Voice::startPanning | ( | double | dur,
|  | uint8_t | panPos,
|  | uint8_t | panWidth
| ) |  |

Start pan envelope to specified position

void amuse::Voice::startSample | ( | int16_t | sampId,
|  | int32_t | offset
| ) |  |

Start playing specified sample from within group, optionally by sample offset

void amuse::Voice::startSpanning | ( | double | dur,
|  | uint8_t | spanPos,
|  | uint8_t | spanWidth
| ) |  |

Start span envelope to specified position

VoiceState amuse::Voice::state | ( |  | ) | const

inline

Get current state of voice

Definition at line 161 of file Voice.hpp.

void amuse::Voice::stopSample | ( |  | ) |

Stop playing current sample

size_t amuse::Voice::supplyAudio | ( | size_t | frames,
|  | int16_t * | data
| ) |  |

Request specified count of audio frames (samples) from voice, internally advancing the voice stream

int amuse::Voice::vid | ( |  | ) | const

inline

Get VoiceId of this voice (unique to all currently-playing voices)

Definition at line 164 of file Voice.hpp.

The documentation for this class was generated from the following file:

- include/amuse/Voice.hpp