Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

GapeConsts Class Reference

A class containing constant values for the program. More...

#include <gapeconsts.h>

List of all members.

Public Types

enum  PlaybackMode { LOOPING, ONEPLAY }
 The possible playback mode for a file - either loop over and over or just play once.

enum  TickMode { SEQUENTIAL, PARALLEL }
 Used by unitgroups that can tick either in sequential or parallel mode. More...


Static Public Methods

void reportError (const char *error)
 Prints messages to "error.txt". More...

GapeIntSample floatToInt (GapeFloat value)
 An inlined function which converts a GapeFloat to a GapeIntSample. More...

GapeFloat IntToFloat (GapeIntSample value)
 An inlined function which converts a GapeintSample to a GapeFloat. More...

void** expandArray (void **array, int *oldCapacity, int factor=2)
 Given an array of pointers, copies it into a larger array and returns the new array. More...


Static Public Attributes

int sampleRate = 22050
 All units that need to know the sampling rate must check this variable, which can be changed. More...

int updateMutexPeriod = 441
 Determines how often some units check for control changes. More...


Detailed Description

A class containing constant values for the program.

The important member of this class is the sampleRate variable, which can be checked at any time to determine the sample rate, and can be changed by the user in their actual program, without re-compilng GAPE (as opposed to defining it). This is the only way to set the sample rate - the sound and output classes check this class for their info. It also contains a handy error reporting method (allowing you to print to an "error'txt" file, since console printing in win9x is not the default.

Author:
Dave Chisholm
Since:
Beta 1.0
Version:
Last Modified Beta 1.0

Definition at line 96 of file gapeconsts.h.


Member Enumeration Documentation

enum GapeConsts::TickMode
 

Used by unitgroups that can tick either in sequential or parallel mode.

For detila, see GapeParallelUnitGroup.

Definition at line 106 of file gapeconsts.h.


Member Function Documentation

void GapeConsts::reportError ( const char * error ) [static]
 

Prints messages to "error.txt".

Parameters:
error   A constant string to be printed.

Definition at line 24 of file gapeconsts.cpp.

Referenced by GapeAccumulator::GapeAccumulator(), GapeAudioInput::GapeAudioInput(), GapeAudioOutput::GapeAudioOutput(), GapeFileReader::GapeFileReader(), GapeFileSampleUnit::fillBuffer(), GapeAudioPlot::receiveTick(), GapeAudioOutput::receiveTick(), GapeAudioInput::receiveTick(), GapeUnit::removeController(), GapeUnitGroup::removeUnit(), GapeAccumulator::resizeAccumulator(), GapeUnit::setFreq(), GapeAudioOutput::setNumChannels(), and GapeAudioInput::setNumChannels().

GapeIntSample GapeConsts::floatToInt ( GapeFloat value ) [inline, static]
 

An inlined function which converts a GapeFloat to a GapeIntSample.

Parameters:
GapeFloat   A sample in floating point form, between -1.0 and 1.0

Definition at line 129 of file gapeconsts.h.

Referenced by GapeAudioOutput::receiveTick().

GapeFloat GapeConsts::IntToFloat ( GapeIntSample value ) [inline, static]
 

An inlined function which converts a GapeintSample to a GapeFloat.

Parameters:
GapeIntSample   A sample in integer form (16 bit)

Definition at line 137 of file gapeconsts.h.

Referenced by GapeAudioInput::receiveTick().

void ** GapeConsts::expandArray ( void ** array,
int * oldCapacity,
int factor = 2 ) [static]
 

Given an array of pointers, copies it into a larger array and returns the new array.

Parameters:
array   the old array to be expanded
oldCapacity   a pointer to the old capacity of the array - so that it can be updated by this function
factor   an optional factor to expand by - ie default doubles the size of the array @
Returns:
The new array

Definition at line 30 of file gapeconsts.cpp.

Referenced by GapeUnit::addController(), and GapeUnitGroup::addUnit().


Member Data Documentation

int GapeConsts::sampleRate = 22050 [static]
 

All units that need to know the sampling rate must check this variable, which can be changed.

I'm worried there could be multithreaded and muytex type issues here - ie sample rate changes, and not everyone know about it, someone assume the samplerate, etc. Perhaps I should include a listener broadcast notification thing and have getSampleRate which is mutexed? def = 22050hz

Definition at line 6 of file gapeconsts.cpp.

int GapeConsts::updateMutexPeriod = 441 [static]
 

Determines how often some units check for control changes.

Because updateMutex() is actually a slow function, even when a mutex is unlocked, we only check for control changes periodically, as opposed to every sample. A higher number will make for faster cpu perfomance, but slower response to slider pulls. Going any higher than 2000 or 4000 would be preety useless, since the cpu gain is minimal, (gain grows as 1/n) but the delay would start to become more audible. You can just leave it at the default of 441 (ie every 20 ms)

Definition at line 7 of file gapeconsts.cpp.


The documentation for this class was generated from the following files:
Generated at Thu Jun 21 13:28:51 2001 for GAPE by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001