svcore  1.9
SamplePlayer Class Reference

#include <SamplePlayer.h>

Static Public Member Functions

static const DSSI_Descriptor * getDescriptor (unsigned long index)
 

Private Types

enum  {
  OutputPort = 0, RetunePort = 1, BasePitchPort = 2, ConcertAPort = 3,
  SustainPort = 4, ReleasePort = 5, PortCount = 6
}
 
enum  { Polyphony = 128 }
 

Private Member Functions

 SamplePlayer (int sampleRate)
 
 ~SamplePlayer ()
 
void searchSamples ()
 
void loadSampleData (QString path)
 
void runImpl (unsigned long, snd_seq_event_t *, unsigned long)
 
void addSample (int, unsigned long, unsigned long)
 

Static Private Member Functions

static LADSPA_Handle instantiate (const LADSPA_Descriptor *, unsigned long)
 
static void connectPort (LADSPA_Handle, unsigned long, LADSPA_Data *)
 
static void activate (LADSPA_Handle)
 
static void run (LADSPA_Handle, unsigned long)
 
static void deactivate (LADSPA_Handle)
 
static void cleanup (LADSPA_Handle)
 
static char * configure (LADSPA_Handle, const char *, const char *)
 
static const DSSI_Program_Descriptor * getProgram (LADSPA_Handle, unsigned long)
 
static void selectProgram (LADSPA_Handle, unsigned long, unsigned long)
 
static int getMidiController (LADSPA_Handle, unsigned long)
 
static void runSynth (LADSPA_Handle, unsigned long, snd_seq_event_t *, unsigned long)
 
static void receiveHostDescriptor (const DSSI_Host_Descriptor *descriptor)
 
static void workThreadCallback (LADSPA_Handle)
 

Private Attributes

float * m_output
 
float * m_retune
 
float * m_basePitch
 
float * m_concertA
 
float * m_sustain
 
float * m_release
 
float * m_sampleData
 
size_t m_sampleCount
 
int m_sampleRate
 
long m_ons [Polyphony]
 
long m_offs [Polyphony]
 
int m_velocities [Polyphony]
 
long m_sampleNo
 
QString m_sampleDir
 
QString m_program
 
std::vector< std::pair< QString, QString > > m_samples
 
bool m_sampleSearchComplete
 
int m_pendingProgramChange
 
QMutex m_mutex
 

Static Private Attributes

static const char *const portNames [PortCount]
 
static const LADSPA_PortDescriptor ports [PortCount]
 
static const LADSPA_PortRangeHint hints [PortCount]
 
static const LADSPA_Properties properties = LADSPA_PROPERTY_HARD_RT_CAPABLE
 
static const LADSPA_Descriptor ladspaDescriptor
 
static const DSSI_Descriptor dssiDescriptor
 
static const DSSI_Host_Descriptor * hostDescriptor = 0
 

Detailed Description

Definition at line 30 of file SamplePlayer.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
OutputPort 
RetunePort 
BasePitchPort 
ConcertAPort 
SustainPort 
ReleasePort 
PortCount 

Definition at line 39 of file SamplePlayer.h.

◆ anonymous enum

anonymous enum
private
Enumerator
Polyphony 

Definition at line 49 of file SamplePlayer.h.

Constructor & Destructor Documentation

◆ SamplePlayer()

SamplePlayer::SamplePlayer ( int  sampleRate)
private

Definition at line 129 of file SamplePlayer.cpp.

Referenced by instantiate().

◆ ~SamplePlayer()

SamplePlayer::~SamplePlayer ( )
private

Definition at line 146 of file SamplePlayer.cpp.

References m_sampleData.

Member Function Documentation

◆ getDescriptor()

const DSSI_Descriptor * SamplePlayer::getDescriptor ( unsigned long  index)
static

Definition at line 123 of file SamplePlayer.cpp.

References dssiDescriptor.

Referenced by DSSIPluginFactory::getDSSIDescriptor().

◆ instantiate()

LADSPA_Handle SamplePlayer::instantiate ( const LADSPA_Descriptor *  ,
unsigned long  rate 
)
staticprivate

Definition at line 152 of file SamplePlayer.cpp.

References hostDescriptor, SamplePlayer(), SVDEBUG, and workThreadCallback().

◆ connectPort()

void SamplePlayer::connectPort ( LADSPA_Handle  handle,
unsigned long  port,
LADSPA_Data *  location 
)
staticprivate

Definition at line 172 of file SamplePlayer.cpp.

References m_basePitch, m_concertA, m_output, m_release, m_retune, m_sustain, PortCount, and ports.

◆ activate()

void SamplePlayer::activate ( LADSPA_Handle  handle)
staticprivate

Definition at line 190 of file SamplePlayer.cpp.

References m_mutex, m_offs, m_ons, m_sampleNo, m_velocities, and Polyphony.

Referenced by deactivate().

◆ run()

void SamplePlayer::run ( LADSPA_Handle  handle,
unsigned long  samples 
)
staticprivate

Definition at line 205 of file SamplePlayer.cpp.

References runSynth().

◆ deactivate()

void SamplePlayer::deactivate ( LADSPA_Handle  handle)
staticprivate

Definition at line 211 of file SamplePlayer.cpp.

References activate().

◆ cleanup()

void SamplePlayer::cleanup ( LADSPA_Handle  handle)
staticprivate

Definition at line 217 of file SamplePlayer.cpp.

◆ configure()

char * SamplePlayer::configure ( LADSPA_Handle  handle,
const char *  key,
const char *  value 
)
staticprivate

Definition at line 223 of file SamplePlayer.cpp.

References m_mutex, m_sampleDir, m_sampleSearchComplete, and searchSamples().

◆ getProgram()

const DSSI_Program_Descriptor * SamplePlayer::getProgram ( LADSPA_Handle  handle,
unsigned long  program 
)
staticprivate

Definition at line 254 of file SamplePlayer.cpp.

References m_mutex, m_samples, m_sampleSearchComplete, and searchSamples().

◆ selectProgram()

void SamplePlayer::selectProgram ( LADSPA_Handle  handle,
unsigned long  ,
unsigned long  program 
)
staticprivate

Definition at line 280 of file SamplePlayer.cpp.

References m_pendingProgramChange.

◆ getMidiController()

int SamplePlayer::getMidiController ( LADSPA_Handle  ,
unsigned long  port 
)
staticprivate

Definition at line 289 of file SamplePlayer.cpp.

References PortCount.

◆ runSynth()

void SamplePlayer::runSynth ( LADSPA_Handle  handle,
unsigned long  samples,
snd_seq_event_t *  events,
unsigned long  eventCount 
)
staticprivate

Definition at line 303 of file SamplePlayer.cpp.

References runImpl().

Referenced by run().

◆ receiveHostDescriptor()

void SamplePlayer::receiveHostDescriptor ( const DSSI_Host_Descriptor *  descriptor)
staticprivate

Definition at line 312 of file SamplePlayer.cpp.

References hostDescriptor.

◆ workThreadCallback()

void SamplePlayer::workThreadCallback ( LADSPA_Handle  handle)
staticprivate

◆ searchSamples()

void SamplePlayer::searchSamples ( )
private

Definition at line 361 of file SamplePlayer.cpp.

References m_sampleDir, m_samples, m_sampleSearchComplete, and SVDEBUG.

Referenced by configure(), getProgram(), and workThreadCallback().

◆ loadSampleData()

void SamplePlayer::loadSampleData ( QString  path)
private

Definition at line 389 of file SamplePlayer.cpp.

References m_mutex, m_offs, m_ons, m_sampleCount, m_sampleData, m_sampleRate, m_velocities, and Polyphony.

Referenced by workThreadCallback().

◆ runImpl()

void SamplePlayer::runImpl ( unsigned long  sampleCount,
snd_seq_event_t *  events,
unsigned long  eventCount 
)
private

◆ addSample()

void SamplePlayer::addSample ( int  n,
unsigned long  pos,
unsigned long  count 
)
private

Member Data Documentation

◆ portNames

const char *const SamplePlayer::portNames
staticprivate
Initial value:
=
{
"Output",
"Tuned (on/off)",
"Base Pitch (MIDI)",
"Tuning of A (Hz)",
"Sustain (on/off)",
"Release time (s)"
}

Definition at line 53 of file SamplePlayer.h.

◆ ports

const LADSPA_PortDescriptor SamplePlayer::ports
staticprivate
Initial value:
=
{
LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO,
LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL
}

Definition at line 54 of file SamplePlayer.h.

Referenced by connectPort().

◆ hints

const LADSPA_PortRangeHint SamplePlayer::hints
staticprivate
Initial value:
=
{
{ 0, 0, 0 },
{ LADSPA_HINT_DEFAULT_MAXIMUM | LADSPA_HINT_INTEGER |
LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE, 0, 1 },
{ LADSPA_HINT_DEFAULT_MIDDLE | LADSPA_HINT_INTEGER |
LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE, 0, 120 },
{ LADSPA_HINT_DEFAULT_440 | LADSPA_HINT_LOGARITHMIC |
LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE, 400, 499 },
{ LADSPA_HINT_DEFAULT_MINIMUM | LADSPA_HINT_INTEGER |
LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE, 0, 1 },
{ LADSPA_HINT_DEFAULT_MINIMUM | LADSPA_HINT_LOGARITHMIC |
LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE, 0.001, 2.0 }
}

Definition at line 55 of file SamplePlayer.h.

◆ properties

const LADSPA_Properties SamplePlayer::properties = LADSPA_PROPERTY_HARD_RT_CAPABLE
staticprivate

Definition at line 56 of file SamplePlayer.h.

◆ ladspaDescriptor

const LADSPA_Descriptor SamplePlayer::ladspaDescriptor
staticprivate
Initial value:
=
{
0,
"sample_player",
"Library Sample Player",
"Chris Cannam",
"GPL",
0,
run,
0,
0,
}

Definition at line 57 of file SamplePlayer.h.

◆ dssiDescriptor

const DSSI_Descriptor SamplePlayer::dssiDescriptor
staticprivate
Initial value:

Definition at line 58 of file SamplePlayer.h.

Referenced by getDescriptor().

◆ hostDescriptor

const DSSI_Host_Descriptor * SamplePlayer::hostDescriptor = 0
staticprivate

Definition at line 59 of file SamplePlayer.h.

Referenced by instantiate(), and receiveHostDescriptor().

◆ m_output

float* SamplePlayer::m_output
private

Definition at line 81 of file SamplePlayer.h.

Referenced by addSample(), connectPort(), and runImpl().

◆ m_retune

float* SamplePlayer::m_retune
private

Definition at line 82 of file SamplePlayer.h.

Referenced by addSample(), and connectPort().

◆ m_basePitch

float* SamplePlayer::m_basePitch
private

Definition at line 83 of file SamplePlayer.h.

Referenced by addSample(), and connectPort().

◆ m_concertA

float* SamplePlayer::m_concertA
private

Definition at line 84 of file SamplePlayer.h.

Referenced by addSample(), and connectPort().

◆ m_sustain

float* SamplePlayer::m_sustain
private

Definition at line 85 of file SamplePlayer.h.

Referenced by connectPort(), and runImpl().

◆ m_release

float* SamplePlayer::m_release
private

Definition at line 86 of file SamplePlayer.h.

Referenced by addSample(), and connectPort().

◆ m_sampleData

float* SamplePlayer::m_sampleData
private

Definition at line 88 of file SamplePlayer.h.

Referenced by addSample(), loadSampleData(), runImpl(), and ~SamplePlayer().

◆ m_sampleCount

size_t SamplePlayer::m_sampleCount
private

Definition at line 89 of file SamplePlayer.h.

Referenced by addSample(), loadSampleData(), and runImpl().

◆ m_sampleRate

int SamplePlayer::m_sampleRate
private

Definition at line 90 of file SamplePlayer.h.

Referenced by addSample(), and loadSampleData().

◆ m_ons

long SamplePlayer::m_ons[Polyphony]
private

Definition at line 92 of file SamplePlayer.h.

Referenced by activate(), addSample(), loadSampleData(), and runImpl().

◆ m_offs

long SamplePlayer::m_offs[Polyphony]
private

Definition at line 93 of file SamplePlayer.h.

Referenced by activate(), addSample(), loadSampleData(), and runImpl().

◆ m_velocities

int SamplePlayer::m_velocities[Polyphony]
private

Definition at line 94 of file SamplePlayer.h.

Referenced by activate(), addSample(), loadSampleData(), and runImpl().

◆ m_sampleNo

long SamplePlayer::m_sampleNo
private

Definition at line 95 of file SamplePlayer.h.

Referenced by activate(), addSample(), and runImpl().

◆ m_sampleDir

QString SamplePlayer::m_sampleDir
private

Definition at line 97 of file SamplePlayer.h.

Referenced by configure(), and searchSamples().

◆ m_program

QString SamplePlayer::m_program
private

Definition at line 98 of file SamplePlayer.h.

Referenced by workThreadCallback().

◆ m_samples

std::vector<std::pair<QString, QString> > SamplePlayer::m_samples
private

Definition at line 99 of file SamplePlayer.h.

Referenced by getProgram(), searchSamples(), and workThreadCallback().

◆ m_sampleSearchComplete

bool SamplePlayer::m_sampleSearchComplete
private

Definition at line 100 of file SamplePlayer.h.

Referenced by configure(), getProgram(), searchSamples(), and workThreadCallback().

◆ m_pendingProgramChange

int SamplePlayer::m_pendingProgramChange
private

Definition at line 101 of file SamplePlayer.h.

Referenced by selectProgram(), and workThreadCallback().

◆ m_mutex

QMutex SamplePlayer::m_mutex
private

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