Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
stk::Stk Class Reference

STK base class. More...

#include <Stk.h>

Inheritance diagram for stk::Stk:
pd::SoundFiler stk::FileRead stk::FileWrite stk::WvIn stk::FileWvIn

Public Types

typedef unsigned long StkFormat
 

Public Member Functions

void ignoreSampleRateChange (bool ignore=true)
 A function to enable/disable the automatic updating of class data when the STK sample rate changes. More...
 

Static Public Member Functions

static StkFloat sampleRate (void)
 Static method that returns the current STK sample rate.
 
static void setSampleRate (StkFloat rate)
 Static method that sets the STK sample rate. More...
 
static std::string rawwavePath (void)
 Static method that returns the current rawwave path.
 
static void setRawwavePath (std::string path)
 Static method that sets the STK rawwave path.
 
static void swap16 (unsigned char *ptr)
 Static method that byte-swaps a 16-bit data type.
 
static void swap32 (unsigned char *ptr)
 Static method that byte-swaps a 32-bit data type.
 
static void swap64 (unsigned char *ptr)
 Static method that byte-swaps a 64-bit data type.
 
static void sleep (unsigned long milliseconds)
 Static cross-platform method to sleep for a number of milliseconds.
 
static bool inRange (StkFloat value, StkFloat min, StkFloat max)
 Static method to check whether a value is within a specified range.
 
static void handleError (const char *message, StkError::Type type)
 Static function for error reporting and handling using c-strings.
 
static void handleError (std::string message, StkError::Type type)
 Static function for error reporting and handling using c++ strings.
 
static void showWarnings (bool status)
 Toggle display of WARNING and STATUS messages.
 
static void printErrors (bool status)
 Toggle display of error messages before throwing exceptions.
 

Static Public Attributes

static const StkFormat STK_SINT8 = 0x1
 
static const StkFormat STK_SINT16 = 0x2
 
static const StkFormat STK_SINT24 = 0x4
 
static const StkFormat STK_SINT32 = 0x8
 
static const StkFormat STK_FLOAT32 = 0x10
 
static const StkFormat STK_FLOAT64 = 0x20
 

Protected Member Functions

 Stk (void)
 Default constructor.
 
virtual ~Stk (void)
 Class destructor.
 
virtual void sampleRateChanged (StkFloat newRate, StkFloat oldRate)
 This function should be implemented in subclasses that depend on the sample rate.
 
void addSampleRateAlert (Stk *ptr)
 Add class pointer to list for sample rate change notification.
 
void removeSampleRateAlert (Stk *ptr)
 Remove class pointer from list for sample rate change notification.
 
void handleError (StkError::Type type) const
 Internal function for error reporting that assumes message in oStream_ variable.
 

Protected Attributes

bool ignoreSampleRateChange_
 

Static Protected Attributes

static std::ostringstream oStream_
 

Detailed Description

STK base class.

Nearly all STK classes inherit from this class. The global sample rate and rawwave path variables can be queried and modified via Stk. In addition, this class provides error handling and byte-swapping functions.

The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. STK currently runs with realtime support (audio and MIDI) on Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.

STK WWW site: http://ccrma.stanford.edu/software/stk/

The Synthesis ToolKit in C++ (STK) Copyright (c) 1995–2014 Perry R. Cook and Gary P. Scavone

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Any person wishing to distribute modifications to the Software is asked to send the modifications to the original developer so that they can be incorporated into the canonical version. This is, however, not a binding provision of this license.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Member Function Documentation

void stk::Stk::ignoreSampleRateChange ( bool  ignore = true)
inline

A function to enable/disable the automatic updating of class data when the STK sample rate changes.

This function allows the user to enable or disable class data updates in response to global sample rate changes on a class by class basis.

void Stk::setSampleRate ( StkFloat  rate)
static

Static method that sets the STK sample rate.

The sample rate set using this method is queried by all STK classes that depend on its value. It is initialized to the default SRATE set in Stk.h. Many STK classes use the sample rate during instantiation. Therefore, if you wish to use a rate that is different from the default rate, it is imperative that it be set BEFORE STK objects are instantiated. A few classes that make use of the global STK sample rate are automatically notified when the rate changes so that internal class data can be appropriately updated. However, this has not been fully implemented. Specifically, classes that appropriately update their own data when either a setFrequency() or noteOn() function is called do not currently receive the automatic notification of rate change. If the user wants a specific class instance to ignore such notifications, perhaps in a multi-rate context, the function Stk::ignoreSampleRateChange() should be called.

Member Data Documentation

const Stk::StkFormat Stk::STK_FLOAT32 = 0x10
static

Normalized between plus/minus 1.0.

const Stk::StkFormat Stk::STK_FLOAT64 = 0x20
static

Normalized between plus/minus 1.0.

const Stk::StkFormat Stk::STK_SINT16 = 0x2
static

-32768 to +32767

const Stk::StkFormat Stk::STK_SINT24 = 0x4
static

Lower 3 bytes of 32-bit signed integer.

const Stk::StkFormat Stk::STK_SINT32 = 0x8
static

-2147483648 to +2147483647.

const Stk::StkFormat Stk::STK_SINT8 = 0x1
static

-128 to +127


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