openshot-audio  0.1.7
Public Member Functions | Friends | List of all members
SamplerSound Class Reference

#include <juce_Sampler.h>

Inheritance diagram for SamplerSound:
SynthesiserSound ReferenceCountedObject

Public Member Functions

 SamplerSound (const String &name, AudioFormatReader &source, const BigInteger &midiNotes, int midiNoteForNormalPitch, double attackTimeSecs, double releaseTimeSecs, double maxSampleLengthSeconds)
 
 ~SamplerSound ()
 
const StringgetName () const noexcept
 
AudioSampleBuffergetAudioData () const noexcept
 
bool appliesToNote (int midiNoteNumber) override
 
bool appliesToChannel (int midiChannel) override
 
- Public Member Functions inherited from SynthesiserSound
virtual ~SynthesiserSound ()
 
- Public Member Functions inherited from ReferenceCountedObject
void incReferenceCount () noexcept
 
void decReferenceCount () noexcept
 
bool decReferenceCountWithoutDeleting () noexcept
 
int getReferenceCount () const noexcept
 

Friends

class SamplerVoice
 

Additional Inherited Members

- Public Types inherited from SynthesiserSound
typedef
ReferenceCountedObjectPtr
< SynthesiserSound
Ptr
 
- Protected Member Functions inherited from SynthesiserSound
 SynthesiserSound ()
 
- Protected Member Functions inherited from ReferenceCountedObject
 ReferenceCountedObject ()
 
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

Constructor & Destructor Documentation

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
namea name for the sample
sourcethe audio to load. This object can be safely deleted by the caller after this constructor returns
midiNotesthe set of midi keys that this sound should be played on. This is used by the SynthesiserSound::appliesToNote() method
midiNoteForNormalPitchthe 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
attackTimeSecsthe attack (fade-in) time, in seconds
releaseTimeSecsthe decay (fade-out) time, in seconds
maxSampleLengthSecondsa maximum length of audio to read from the audio source, in seconds
SamplerSound::~SamplerSound ( )

Destructor.

Member Function Documentation

bool 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 SynthesiserSound.

bool 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 SynthesiserSound.

AudioSampleBuffer* SamplerSound::getAudioData ( ) const
inlinenoexcept

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

const String& SamplerSound::getName ( ) const
inlinenoexcept

Returns the sample's name

Friends And Related Function Documentation

friend class SamplerVoice
friend

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