SynthLab SDK
SynthLab::PCMSample Class Reference

Opens a WAV file and extracts contents into a floating point buffer, regardless of original datatypes in file. After parsing the file, use const float* getSampleBuffer() to acces the read-only buffer of data. The following types are supported: More...

#include <pcmsample.h>

Public Member Functions

bool loadPCMSample (const char *filePath)
 Opens a WAV file and extracts the audio guts into a buffer of floats. Anytime later, you can use isSampleLoaded( ) to see if the sample data is valid. More...
 
const float * getSampleBuffer ()
 
void setPitchless (bool _pitchlessSample)
 
bool isPitchless ()
 
bool isSampleLoaded ()
 
uint32_t getNumChannels ()
 Immutable variables can only be set during file parse.
 
uint32_t getSampleRate ()
 Immutable variables can only be set during file parse.
 
uint32_t getSampleCount ()
 Immutable variables can only be set during file parse.
 
uint32_t getLoopType ()
 Immutable variables can only be set during file parse.
 
uint32_t getSmpteFormat ()
 Immutable variables can only be set during file parse.
 
uint32_t getSmpteOffset ()
 Immutable variables can only be set during file parse.
 
uint32_t getLoopCount ()
 Mutable variables that may need to be re-calculated after parsing.
 
void setLoopCount (uint32_t u)
 Mutable variables that may need to be re-calculated after parsing.
 
uint32_t getLoopStartIndex ()
 Mutable variables that may need to be re-calculated after parsing.
 
void setLoopStartIndex (uint32_t u)
 Mutable variables that may need to be re-calculated after parsing.
 
uint32_t getLoopEndIndex ()
 Mutable variables that may need to be re-calculated after parsing.
 
void setLoopEndIndex (uint32_t u)
 Mutable variables that may need to be re-calculated after parsing.
 
uint32_t getUnityMIDINote ()
 Mutable variables that may need to be re-calculated after parsing.
 
void setUnityMIDINote (uint32_t u)
 Mutable variables that may need to be re-calculated after parsing.
 
uint32_t getUnityMIDIPitchFraction ()
 Mutable variables that may need to be re-calculated after parsing.
 
void setUnityMIDIPitchFraction (uint32_t u)
 Mutable variables that may need to be re-calculated after parsing.
 

Protected Attributes

uint32_t numChannels = 0
 
uint32_t sampleRate = 0
 
uint32_t sampleCount = 0
 
uint32_t loopCount = 0
 
uint32_t loopStartIndex = 0
 
uint32_t loopEndIndex = 0
 
uint32_t loopType = 0
 
uint32_t unityMIDINote = 0
 
uint32_t unityMIDIPitchFraction = 0
 
uint32_t smpteFormat = 0
 
uint32_t smpteOffset = 0
 
bool sampleLoaded = false
 
float * pcmSampleBuffer = nullptr
 
bool pitchlessSample = false
 

Detailed Description

Opens a WAV file and extracts contents into a floating point buffer, regardless of original datatypes in file. After parsing the file, use const float* getSampleBuffer() to acces the read-only buffer of data. The following types are supported:

  • 16-BIT Signed Integer PCM
  • 24-BIT Signed Integer PCM 3-ByteAlign
  • 24-BIT Signed Integer PCM 4-ByteAlign
  • 32-BIT Signed Integer PCM
  • 32-BIT Floating Point
  • 64-BIT Floating Point
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

◆ isSampleLoaded()

bool SynthLab::PCMSample::isSampleLoaded ( )
inline

only set true if WAV parse was sucessful

◆ loadPCMSample()

bool SynthLab::PCMSample::loadPCMSample ( const char *  pFilePath)

Opens a WAV file and extracts the audio guts into a buffer of floats. Anytime later, you can use isSampleLoaded( ) to see if the sample data is valid.

PCM sample load and buffer access

Parameters
pFilePathfully qualified WAV file path
Returns
true if sucessful

◆ setPitchless()

void SynthLab::PCMSample::setPitchless ( bool  _pitchlessSample)
inline

pitchless samples (read inc = 1 always)


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