OpenShot Audio Library | OpenShotAudio: juce::SamplerSound Class Reference

OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::SamplerSound Class Reference

`#include <juce_Sampler.h>`

Inheritance diagram for juce::SamplerSound:

## Public Member Functions
| SamplerSound (const String &name, AudioFormatReader &source, const BigInteger &midiNotes, int midiNoteForNormalPitch, double attackTimeSecs, double releaseTimeSecs, double maxSampleLengthSeconds)
| ~SamplerSound () override
const String & | getName () const noexcept
AudioBuffer< float > * | getAudioData () const noexcept
void | setEnvelopeParameters (ADSR::Parameters parametersToUse)
bool | appliesToNote (int midiNoteNumber) override
bool | appliesToChannel (int midiChannel) override
Public Member Functions inherited from juce::SynthesiserSound
| ~SynthesiserSound () override
Public Member Functions inherited from juce::ReferenceCountedObject
void | incReferenceCount () noexcept
void | decReferenceCount () noexcept
bool | decReferenceCountWithoutDeleting () noexcept
int | getReferenceCount () const noexcept

## Additional Inherited Members
Public Types inherited from juce::SynthesiserSound
using | Ptr = ReferenceCountedObjectPtr<SynthesiserSound>
Protected Member Functions inherited from juce::SynthesiserSound
Protected Member Functions inherited from juce::ReferenceCountedObject
| ReferenceCountedObject ()=default
| ReferenceCountedObject (const ReferenceCountedObject &) noexcept
| ReferenceCountedObject (ReferenceCountedObject &&) noexcept
ReferenceCountedObject & | operator= (const ReferenceCountedObject &) noexcept
ReferenceCountedObject & | operator= (ReferenceCountedObject &&) noexcept
virtual | ~ReferenceCountedObject ()
void | resetReferenceCount () noexcept

## Detailed Description

A subclass of SynthesiserSound that represents a sampled audio clip.

This is a pretty basic sampler, and just attempts to load the whole audio stream into memory.

To use it, create a Synthesiser, add some SamplerVoice objects to it, then give it some SampledSound objects to play.

See also
  SamplerVoice, Synthesiser, SynthesiserSound

Definition at line 43 of file juce_Sampler.h.

## Constructor & Destructor Documentation

## ◆ SamplerSound()

juce::SamplerSound::SamplerSound | ( | const String & | name,
|  | AudioFormatReader & | source,
|  | const BigInteger & | midiNotes,
|  | int | midiNoteForNormalPitch,
|  | double | attackTimeSecs,
|  | double | releaseTimeSecs,
|  | double | maxSampleLengthSeconds )

Creates a sampled sound from an audio reader.

This will attempt to load the audio from the source into memory and store it in this object.

Parameters

  name | a name for the sample
  source | the audio to load. This object can be safely deleted by the caller after this constructor returns
  midiNotes | the set of midi keys that this sound should be played on. This is used by the SynthesiserSound::appliesToNote() method
  midiNoteForNormalPitch | the midi note at which the sample should be played with its natural rate. All other notes will be pitched up or down relative to this one
  attackTimeSecs | the attack (fade-in) time, in seconds
  releaseTimeSecs | the decay (fade-out) time, in seconds
  maxSampleLengthSeconds | a maximum length of audio to read from the audio source, in seconds

Definition at line 29 of file juce_Sampler.cpp.

## ◆ ~SamplerSound()

juce::SamplerSound::~SamplerSound | ( |  | ) |
| override

Destructor.

Definition at line 55 of file juce_Sampler.cpp.

## Member Function Documentation

## ◆ appliesToChannel()

bool juce::SamplerSound::appliesToChannel | ( | int | midiChannel | ) |
| overridevirtual

Returns true if the sound should be triggered by midi events on a given channel.

The Synthesiser will use this information when deciding which sounds to trigger for a given note.

Implements juce::SynthesiserSound.

Definition at line 64 of file juce_Sampler.cpp.

## ◆ appliesToNote()

bool juce::SamplerSound::appliesToNote | ( | int | midiNoteNumber | ) |
| overridevirtual

Returns true if this sound should be played when a given midi note is pressed.

The Synthesiser will use this information when deciding which sounds to trigger for a given note.

Implements juce::SynthesiserSound.

Definition at line 59 of file juce_Sampler.cpp.

## ◆ getAudioData()

AudioBuffer< float > * juce::SamplerSound::getAudioData | ( |  | ) | const
| inlinenoexcept

Returns the audio sample data. This could return nullptr if there was a problem loading the data.

Definition at line 83 of file juce_Sampler.h.

## ◆ getName()

const String & juce::SamplerSound::getName | ( |  | ) | const
| inlinenoexcept

Returns the sample's name

Definition at line 78 of file juce_Sampler.h.

## ◆ setEnvelopeParameters()

void juce::SamplerSound::setEnvelopeParameters | ( | ADSR::Parameters | parametersToUse | ) |
| inline

Changes the parameters of the ADSR envelope which will be applied to the sample.

Definition at line 87 of file juce_Sampler.h.

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

- juce_Sampler.h
- juce_Sampler.cpp