SynthLab SDK
SynthLab::IPCMSampleSource Class Referenceabstract

Interface for PCM sample sources. More...

#include <synthbase.h>

Inheritance diagram for SynthLab::IPCMSampleSource:
SynthLab::SynthLabPCMSource

Public Member Functions

virtual double selectSample (double oscFrequency)=0
 Selects a PCM sample based on the current oscillation frequency (after all modulations have been applied) More...
 
virtual PCMSampleOutput readSample (double &readIndex, double inc)=0
 Read a PCM sample at a fractional read index location (not normalized) More...
 
virtual void setSampleLoopMode (SampleLoopMode _loopMode)=0
 Set the looping mode: More...
 
virtual void deleteSamples ()=0
 Delete the samples, part of destruction process.
 
virtual uint32_t getValidSampleCount ()=0
 query for valid sample count (not used in SynthLab but avialable)
 
virtual bool haveValidSamples ()=0
 query for valid samples; needed if WAV parsing fails and we need to delete the entry
 

Detailed Description

Interface for PCM sample sources.

  • A PCM sample database stores a set of PCM sample sources
  • each source represents one waveform generator, or one set of PCM samples that make a patch
  • each PCM sample source has a uniqe name string, that is usually the name of the waveform or the sample which itself must be unique otherwise the user would be confused
  • the source may consist of a PCM sample but most implement an array of PCM samples, for example to implement bandlimited multi-samples across a set of keys
  • The source interface functions allow:
  1. selection of a table (this should mark the table in some way as being the currently selected item)
  2. read the selected wavetable
  3. set the sample looping mode
  4. delete the samples (for low level destruction)
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included and described in further detail in Designing Software Synthesizer Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2021 / 04 / 26

Member Function Documentation

◆ readSample()

virtual PCMSampleOutput SynthLab::IPCMSampleSource::readSample ( double &  readIndex,
double  inc 
)
pure virtual

Read a PCM sample at a fractional read index location (not normalized)

  • modifies the readIndex that is passed-by-reference depending on the number of samples read
Parameters
readIndexunnormalized read location within the sample
incsample incrememter value (called phaseInc for the oscillator objects)
Returns
a PCMSampleOutput structure that contians the audio sample(s)

Implemented in SynthLab::SynthLabPCMSource.

◆ selectSample()

virtual double SynthLab::IPCMSampleSource::selectSample ( double  oscFrequency)
pure virtual

Selects a PCM sample based on the current oscillation frequency (after all modulations have been applied)

Parameters
oscFrequencythe frequency in Hz of the currently rendered pitch

Implemented in SynthLab::SynthLabPCMSource.

◆ setSampleLoopMode()

virtual void SynthLab::IPCMSampleSource::setSampleLoopMode ( SampleLoopMode  _loopMode)
pure virtual

Set the looping mode:

  • SampleLoopMode::loop: loop from start to end of sample
  • SampleLoopMode::sustain: loop over a pre-set range of sustain samples (steady state section of sample)
  • SampleLoopMode::oneShot: play the sample once and never again
Parameters
_loopModethe SampleLoopMode

Implemented in SynthLab::SynthLabPCMSource.


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