*.h/c : Added 'cdg' markup to virtually all source files in libcm, libcm/app and libcm/dsp.

This commit is contained in:
Kevin Larke 2015-11-16 14:59:27 -05:00
parent e0d5b50a64
commit 176073874f
105 changed files with 2335 additions and 2073 deletions

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Convert a JSON graph description to a DOT vector graphics file." kw:[file plot]}
enum
{
kOkDotRC = cmOkRC,
@ -19,6 +21,8 @@ extern "C" {
cmDotRC_t cmDspPgmJsonToDot( cmCtx_t* ctx, const cmChar_t* inFn, const cmChar_t* outFn );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Musical event onset detector." kw:[audio] }
enum
{
kOkOnRC = cmOkRC,
@ -65,6 +67,8 @@ extern "C" {
cmOnRC_t cmOnsetTest( cmCtx_t* c );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,7 @@
extern "C" {
#endif
//( { file_desc:"'fluxo' channel calibration and gain normalization program." kw:[fluxo]}
enum
{
@ -88,6 +89,7 @@ extern "C" {
void cmPuReport( cmPuH_t h, cmRpt_t* rpt );
void cmPuTest(cmCtx_t* ctx);
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Object for managing musical score data." kw:[score]}
enum
{
kOkScRC = cmOkRC,
@ -273,6 +275,7 @@ extern "C" {
void cmScoreTest( cmCtx_t* ctx, const cmChar_t* fn );
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Programs for processing cmScore and peformane data." kw:[score seq]}
typedef unsigned cmSpRC_t;
enum
@ -21,6 +23,8 @@ extern "C" {
cmSpRC_t cmScoreProc(cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,7 +5,8 @@
extern "C" {
#endif
/*
/*( { file_desc:"Musical instrument sample database manager and synthetic sequence generator." kw:[audio] }
The CSV file used to initialize a SDB object has the following column syntax.
Column Name Type Description
@ -292,6 +293,8 @@ extern "C" {
cmSdbRC_t cmSdbTest( cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,7 @@
extern "C" {
#endif
//( { file_desc:"Concatenate multipel overlapping MIDI performances into a single virtual performance based by associating score information with the MIDI events." kw:[seq] }
enum
{
@ -123,6 +124,8 @@ extern "C" {
cmTsbRC_t cmTakeSeqBldrTest( cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Manage, save, and restore a time-line containing MIDI files, Audio files, Audio events, and arbitrary markers ." kw[seq] }
typedef cmHandle_t cmTlH_t;
@ -248,6 +250,8 @@ extern "C" {
// callback function.
cmTlRC_t cmTimeLineDecode( const void* msg, unsigned msgByteCnt, cmTlUiMsg_t* uiMsg );
//)
#ifdef __cplusplus
}
#endif

286
cmApBuf.h
View File

@ -1,34 +1,33 @@
/// \file cmApBuf.h
/// \brief Thread-safe audio buffer class.
///
/// This file defines an audio buffer class which handles
/// buffering incoming (recording) and outgoing (playback)
/// samples in a thread-safe manner.
///
/// Usage example and testing code:
/// See cmApBufTest() and cmAudioSysTest().
/// \snippet cmApBuf.c cmApBufExample
///
/// Notes on channel flags:
/// Disabled channels: kChFl is cleared
/// cmApBufGet()
/// in - return NULL buffer pointers
/// out - return NULL buffer points
///
/// cmApBufUpdate()
/// in - incoming samples are set to 0.
/// out - outgoing samples are set to 0.
///
/// Muted channels: kMuteFl is set
/// cmApBufUpdate()
/// in - incoming samples are set to 0.
/// out - outgoing samples are set to 0.
///
/// Tone channels: kToneFl is set
/// cmApBufUpdate()
/// in - incoming samples are filled with a 1k sine tone
/// out - outgoing samples are filled with a 1k sine tone
///
//( {file_desc: "Thread safe audio buffer class." kw:[rt audio]}
//
// This file defines an audio buffer class which handles
// buffering incoming (recording) and outgoing (playback)
// samples in a thread-safe manner.
//
// Usage example and testing code:
// See cmApBufTest() and cmAudioSysTest().
// \snippet cmApBuf.c cmApBufExample
//
// Notes on channel flags:
// Disabled channels: kChFl is cleared
// cmApBufGet()
// in - return NULL buffer pointers
// out - return NULL buffer points
//
// cmApBufUpdate()
// in - incoming samples are set to 0.
// out - outgoing samples are set to 0.
//
// Muted channels: kMuteFl is set
// cmApBufUpdate()
// in - incoming samples are set to 0.
// out - outgoing samples are set to 0.
//
// Tone channels: kToneFl is set
// cmApBufUpdate()
// in - incoming samples are filled with a 1k sine tone
// out - outgoing samples are filled with a 1k sine tone
//)
#ifndef cmApBuf_h
#define cmApBuf_h
@ -37,198 +36,199 @@
extern "C" {
#endif
typedef cmRC_t cmAbRC_t; ///< Result code type
//(
typedef cmRC_t cmAbRC_t; //< Result code type
enum
{
kOkAbRC = 0
};
/// Allocate and initialize an audio buffer.
/// devCnt - count of devices this buffer will handle.
/// meterMs - length of the meter buffers in milliseconds (automatically limit to the range:10 to 1000)
// Allocate and initialize an audio buffer.
// devCnt - count of devices this buffer will handle.
// meterMs - length of the meter buffers in milliseconds (automatically limit to the range:10 to 1000)
cmAbRC_t cmApBufInitialize( unsigned devCnt, unsigned meterMs );
/// Deallocate and release any resource held by an audio buffer allocated via cmApBufInitialize().
// Deallocate and release any resource held by an audio buffer allocated via cmApBufInitialize().
cmAbRC_t cmApBufFinalize();
/// Configure a buffer for a given device.
// Configure a buffer for a given device.
cmAbRC_t cmApBufSetup(
unsigned devIdx, ///< device to setup
double srate, ///< device sample rate (only required for synthesizing the correct test-tone frequency)
unsigned dspFrameCnt, /// dspFrameCnt - count of samples in channel buffers returned via cmApBufGet()
unsigned cycleCnt, ///< number of audio port cycles to store
unsigned inChCnt, ///< input channel count on this device
unsigned inFramesPerCycle, ///< maximum number of incoming sample frames on an audio port cycle
unsigned outChCnt, ///< output channel count on this device
unsigned outFramesPerCycle ///< maximum number of outgoing sample frames in an audio port cycle
unsigned devIdx, //< device to setup
double srate, //< device sample rate (only required for synthesizing the correct test-tone frequency)
unsigned dspFrameCnt, // dspFrameCnt - count of samples in channel buffers returned via cmApBufGet()
unsigned cycleCnt, //< number of audio port cycles to store
unsigned inChCnt, //< input channel count on this device
unsigned inFramesPerCycle, //< maximum number of incoming sample frames on an audio port cycle
unsigned outChCnt, //< output channel count on this device
unsigned outFramesPerCycle //< maximum number of outgoing sample frames in an audio port cycle
);
/// Prime the buffer with 'audioCycleCnt' * outFramesPerCycle samples ready to be played
// Prime the buffer with 'audioCycleCnt' * outFramesPerCycle samples ready to be played
cmAbRC_t cmApBufPrimeOutput( unsigned devIdx, unsigned audioCycleCnt );
/// Notify the audio buffer that a device is being enabled or disabled.
// Notify the audio buffer that a device is being enabled or disabled.
void cmApBufOnPortEnable( unsigned devIdx, bool enabelFl );
/// This function is called asynchronously by the audio device driver to transfer incoming samples to the
/// the buffer and to send outgoing samples to the DAC. This function is
/// intended to be called from the audio port callback function (\see cmApCallbackPtr_t).
/// This function is thread-safe under the condition where the audio device uses
/// different threads for input and output.
///
/// Enable Flag:
/// Input: If an input channel is disabled then the incoming samples are replaced with zeros.
/// Output: If an output channel is disabled then the packet samples are set to zeros.
///
/// Tone Flag:
/// Input: If the tone flag is set on an input channel then the incoming samples are set to a sine tone.
/// Output: If the tone flag is set on an output channel then the packet samples are set to a sine tone.
///
/// The enable flag has higher precedence than the tone flag therefore disabled channels
/// will be set to zero even if the tone flag is set.
// This function is called asynchronously by the audio device driver to transfer incoming samples to the
// the buffer and to send outgoing samples to the DAC. This function is
// intended to be called from the audio port callback function (\see cmApCallbackPtr_t).
// This function is thread-safe under the condition where the audio device uses
// different threads for input and output.
//
// Enable Flag:
// Input: If an input channel is disabled then the incoming samples are replaced with zeros.
// Output: If an output channel is disabled then the packet samples are set to zeros.
//
// Tone Flag:
// Input: If the tone flag is set on an input channel then the incoming samples are set to a sine tone.
// Output: If the tone flag is set on an output channel then the packet samples are set to a sine tone.
//
// The enable flag has higher precedence than the tone flag therefore disabled channels
// will be set to zero even if the tone flag is set.
cmAbRC_t cmApBufUpdate(
cmApAudioPacket_t* inPktArray, ///< full audio packets from incoming audio (from ADC)
unsigned inPktCnt, ///< count of incoming audio packets
cmApAudioPacket_t* outPktArray, ///< empty audio packet for outgoing audio (to DAC)
unsigned outPktCnt ///< count of outgoing audio packets
cmApAudioPacket_t* inPktArray, //< full audio packets from incoming audio (from ADC)
unsigned inPktCnt, //< count of incoming audio packets
cmApAudioPacket_t* outPktArray, //< empty audio packet for outgoing audio (to DAC)
unsigned outPktCnt //< count of outgoing audio packets
);
/// Channel flags
// Channel flags
enum
{
kInApFl = 0x01, ///< Identify an input channel
kOutApFl = 0x02, ///< Identify an output channel
kEnableApFl = 0x04, ///< Set to enable a channel, Clear to disable.
kInApFl = 0x01, //< Identify an input channel
kOutApFl = 0x02, //< Identify an output channel
kEnableApFl = 0x04, //< Set to enable a channel, Clear to disable.
kChApFl = 0x08, ///< Used to enable/disable a channel
kMuteApFl = 0x10, ///< Mute this channel
kToneApFl = 0x20, ///< Generate a tone on this channel
kMeterApFl = 0x40, ///< Turn meter's on/off
kPassApFl = 0x80 ///< Pass input channels throught to the output. Must use cmApBufGetIO() to implement this functionality.
kChApFl = 0x08, //< Used to enable/disable a channel
kMuteApFl = 0x10, //< Mute this channel
kToneApFl = 0x20, //< Generate a tone on this channel
kMeterApFl = 0x40, //< Turn meter's on/off
kPassApFl = 0x80 //< Pass input channels throught to the output. Must use cmApBufGetIO() to implement this functionality.
};
/// Return the meter window period as set by cmApBufInitialize()
// Return the meter window period as set by cmApBufInitialize()
unsigned cmApBufMeterMs();
// Set the meter update period. THis function limits the value to between 10 and 1000.
void cmApBufSetMeterMs( unsigned meterMs );
/// Returns the channel count set via cmApBufSetup().
// Returns the channel count set via cmApBufSetup().
unsigned cmApBufChannelCount( unsigned devIdx, unsigned flags );
/// Set chIdx to -1 to enable all channels on this device.
/// Set flags to {kInApFl | kOutApFl} | {kChApFl | kToneApFl | kMeterFl} | { kEnableApFl=on | 0=off }
// Set chIdx to -1 to enable all channels on this device.
// Set flags to {kInApFl | kOutApFl} | {kChApFl | kToneApFl | kMeterFl} | { kEnableApFl=on | 0=off }
void cmApBufSetFlag( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Return true if the the flags is set.
// Return true if the the flags is set.
bool cmApBufIsFlag( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Set chIdx to -1 to enable all channels on this device.
// Set chIdx to -1 to enable all channels on this device.
void cmApBufEnableChannel( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Returns true if an input/output channel is enabled on the specified device.
// Returns true if an input/output channel is enabled on the specified device.
bool cmApBufIsChannelEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
/// Set the state of the tone generator on the specified channel.
/// Set chIdx to -1 to apply the change to all channels on this device.
/// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
// Set the state of the tone generator on the specified channel.
// Set chIdx to -1 to apply the change to all channels on this device.
// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
void cmApBufEnableTone( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Returns true if an input/output tone is enabled on the specified device.
// Returns true if an input/output tone is enabled on the specified device.
bool cmApBufIsToneEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
/// Mute a specified channel.
/// Set chIdx to -1 to apply the change to all channels on this device.
/// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
// Mute a specified channel.
// Set chIdx to -1 to apply the change to all channels on this device.
// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
void cmApBufEnableMute( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Returns true if an input/output channel is muted on the specified device.
// Returns true if an input/output channel is muted on the specified device.
bool cmApBufIsMuteEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
/// Set the specified channel to pass through.
/// Set chIdx to -1 to apply the change to all channels on this device.
/// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
// Set the specified channel to pass through.
// Set chIdx to -1 to apply the change to all channels on this device.
// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
void cmApBufEnablePass( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Returns true if pass through is enabled on the specified channel.
// Returns true if pass through is enabled on the specified channel.
bool cmApBufIsPassEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
/// Turn meter data collection on and off.
/// Set chIdx to -1 to apply the change to all channels on this device.
/// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
// Turn meter data collection on and off.
// Set chIdx to -1 to apply the change to all channels on this device.
// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
void cmApBufEnableMeter( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Returns true if an input/output tone is enabled on the specified device.
// Returns true if an input/output tone is enabled on the specified device.
bool cmApBufIsMeterEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
/// Return the meter value for the requested channel.
/// Set flags to kInApFl | kOutApFl.
// Return the meter value for the requested channel.
// Set flags to kInApFl | kOutApFl.
cmApSample_t cmApBufMeter(unsigned devIdx, unsigned chIdx, unsigned flags );
/// Set chIdx to -1 to apply the gain to all channels on the specified device.
// Set chIdx to -1 to apply the gain to all channels on the specified device.
void cmApBufSetGain( unsigned devIdx, unsigned chIdx, unsigned flags, double gain );
/// Return the current gain seting for the specified channel.
// Return the current gain seting for the specified channel.
double cmApBufGain( unsigned devIdx, unsigned chIdx, unsigned flags );
/// Get the meter and fault status of the channel input or output channel array of a device.
/// Set 'flags' to { kInApFl | kOutApFl }.
/// The returns value is the count of channels actually written to meterArray.
/// If 'faultCntPtr' is non-NULL then it is set to the faultCnt of the associated devices input or output buffer.
// Get the meter and fault status of the channel input or output channel array of a device.
// Set 'flags' to { kInApFl | kOutApFl }.
// The returns value is the count of channels actually written to meterArray.
// If 'faultCntPtr' is non-NULL then it is set to the faultCnt of the associated devices input or output buffer.
unsigned cmApBufGetStatus( unsigned devIdx, unsigned flags, double* meterArray, unsigned meterCnt, unsigned* faultCntPtr );
/// Do all enabled input/output channels on this device have samples available?
/// 'flags' can be set to either or both kInApFl and kOutApFl
// Do all enabled input/output channels on this device have samples available?
// 'flags' can be set to either or both kInApFl and kOutApFl
bool cmApBufIsDeviceReady( unsigned devIdx, unsigned flags );
/// This function is called by the application to get full incoming sample buffers and
/// to fill empty outgoing sample buffers.
/// Upon return each element in bufArray[bufChCnt] holds a pointer to a buffer assoicated
/// with an audio channel or to NULL if the channel is disabled.
/// 'flags' can be set to kInApFl or kOutApFl but not both.
/// The buffers pointed to by bufArray[] each contain 'dspFrameCnt' samples. Where
/// 'dspFrameCnt' was set in the earlier call to cmApBufSetup() for this device.
/// (see cmApBufInitialize()).
/// Note that this function just returns audio information it does not
/// change any cmApBuf() internal states.
// This function is called by the application to get full incoming sample buffers and
// to fill empty outgoing sample buffers.
// Upon return each element in bufArray[bufChCnt] holds a pointer to a buffer assoicated
// with an audio channel or to NULL if the channel is disabled.
// 'flags' can be set to kInApFl or kOutApFl but not both.
// The buffers pointed to by bufArray[] each contain 'dspFrameCnt' samples. Where
// 'dspFrameCnt' was set in the earlier call to cmApBufSetup() for this device.
// (see cmApBufInitialize()).
// Note that this function just returns audio information it does not
// change any cmApBuf() internal states.
void cmApBufGet( unsigned devIdx, unsigned flags, cmApSample_t* bufArray[], unsigned bufChCnt );
/// This function replaces calls to cmApBufGet() and implements pass-through and output
/// buffer zeroing:
///
/// 1) cmApBufGet(in);
/// 2) cmApBufGet(out);
/// 3) Copy through channels marked for 'pass' and set the associated oBufArray[i] channel to NULL.
/// 4) Zero all other enabled output channels.
///
/// Notes:
/// 1) The oBufArray[] channels that are disabled or marked for pass-through will
/// be set to NULL.
/// 2) The client is required to use this function to implement pass-through internally.
/// 3) This function just returns audio information it does not
/// change any cmApBuf() internal states.
/// 4) The timestamp pointers are optional.
// This function replaces calls to cmApBufGet() and implements pass-through and output
// buffer zeroing:
//
// 1) cmApBufGet(in);
// 2) cmApBufGet(out);
// 3) Copy through channels marked for 'pass' and set the associated oBufArray[i] channel to NULL.
// 4) Zero all other enabled output channels.
//
// Notes:
// 1) The oBufArray[] channels that are disabled or marked for pass-through will
// be set to NULL.
// 2) The client is required to use this function to implement pass-through internally.
// 3) This function just returns audio information it does not
// change any cmApBuf() internal states.
// 4) The timestamp pointers are optional.
void cmApBufGetIO( unsigned iDevIdx, cmApSample_t* iBufArray[], unsigned iBufChCnt, cmTimeSpec_t* iTimeStampPtr,
unsigned oDevIdx, cmApSample_t* oBufArray[], unsigned oBufChCnt, cmTimeSpec_t* oTimeStampPtr );
/// The application calls this function each time it completes processing of a bufArray[]
/// returned from cmApBufGet(). 'flags' can be set to either or both kInApFl and kOutApFl.
/// This function should only be called from the client thread.
// The application calls this function each time it completes processing of a bufArray[]
// returned from cmApBufGet(). 'flags' can be set to either or both kInApFl and kOutApFl.
// This function should only be called from the client thread.
void cmApBufAdvance( unsigned devIdx, unsigned flags );
/// Copy all available samples incoming samples from an input device to an output device.
/// The source code for this example is a good example of how an application should use cmApBufGet()
/// and cmApBufAdvance().
// Copy all available samples incoming samples from an input device to an output device.
// The source code for this example is a good example of how an application should use cmApBufGet()
// and cmApBufAdvance().
void cmApBufInputToOutput( unsigned inDevIdx, unsigned outDevIdx );
/// Print the current buffer state.
// Print the current buffer state.
void cmApBufReport( cmRpt_t* rpt );
/// Run a buffer usage simulation to test the class. cmAudioPortTest.c calls this function.
// Run a buffer usage simulation to test the class. cmAudioPortTest.c calls this function.
void cmApBufTest( cmRpt_t* rpt );
//)
#ifdef __cplusplus

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc: "Dynamic array container class." kw:[container] }
enum
{
kOkArRC = cmOkRC,
@ -55,6 +57,8 @@ enum
// Zero elements i:i+n-1
#define cmArrayClrN(t,h,i,n) ((t*)cmArraySet(h,i,NULL,n))
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,8 +5,7 @@
extern "C" {
#endif
// This API supports a serialized interface to an internal instance of
// cmAudioSys and cmDspSys.
//( { file_desc: "Supports a serialized interface to an internal instance of cmAudioSys and cmDspSys." kw:[rt]}
enum
{
@ -50,6 +49,8 @@ extern "C" {
// client program to the aud_dsp system.
cmAdRC_t cmAudDspReceiveClientMsg( cmAdH_t h, unsigned msgBytecnt, const void* msg );
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc: "Virtual interface to the audio DSP system." kw:[rt]}
//
// This class provides a two-way interface to the audio DSP system.
// It is designed to work independenty of the physical
// method of communication. For example, when used by
@ -41,8 +43,9 @@ extern "C" {
// client provided cmAdIfDispatch_t function (ssInitFunc,statusFunc or uiFunc).
// Note that this entire chain of calls occurs in the client thread
// and in the context of the cmAdIfDispatchMsgToHost() procedure.
//)
//(
enum
{
kOkAiRC = cmOkRC,
@ -174,6 +177,7 @@ extern "C" {
*/
//)
#ifdef __cplusplus
}

View File

@ -5,17 +5,19 @@
extern "C" {
#endif
/*
This class instantiates an audio-DSP engine (cmAudDsp),
an interface for communicating with it (cmAudDspIF),
and message delivery functions for copying messages
in both directions between cmAuDsp and cmAudDspIF.
//( { file_desc: "Implementation of the audio DSP interface for local, in-memory, communication." kw:[rt]}
//
// This class instantiates an audio-DSP engine (cmAudDsp),
// an interface for communicating with it (cmAudDspIF),
// and message delivery functions for copying messages
// in both directions between cmAuDsp and cmAudDspIF.
//
// Note that the underlying inteface which allows an application to
// control, and receive message from, cmAudDsp is provided by
// cmAudDspIF - which this class provides a handle to.
//)
Note that the actual inteface which allows an application to
control, and receive message from, cmAudDsp is provided by
cmAudDspIF - which this class provides a handle to.
*/
//(
enum
{
@ -44,6 +46,7 @@ extern "C" {
cmAiH_t cmAudDspLocalIF_Handle( cmAdlH_t h );
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Read and write Audacity label files." kw:[audio file] }
enum
{
kOkAlfRC = cmOkRC,
@ -43,6 +45,8 @@ enum
void cmAudLabelFileTest( cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc: "Audio device driver for cmAudioPort which aggregates multiple hardware devices to appear as a single devices." kw:[rt] }
enum
{
kOkAgRC = cmOkRC,
@ -95,6 +97,7 @@ extern "C" {
int cmApAggTest( bool runFl, cmCtx_t* ctx, int argc, const char* argv[] );
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( {file_desc: "Obsolete audio buffer class. This class is superceded by cmApBuf."}
enum
{
kOkBaRC = cmOkRC
@ -53,7 +55,7 @@ extern "C" {
cmBaRC_t cmAudioBufAdvance( unsigned devIdx, unsigned flags );
//)
#ifdef __cplusplus

View File

@ -1,13 +1,9 @@
/// \file cmAudioFile.h
/// \brief Audio file reader/writer class.
///
/// This class supports reading uncompressed AIFF and WAV files and writing uncompressed AIFF files.
/// The reading and writing routines are known to work with 8,16,24, and 32 bit integer sample formats.
///
/// Testing and example usage for this API can be found in cmProcTest.c cmAudioReadWriteTest().
///
/// Usage example:
/// \snippet cmAudioFile.c cmAudioFileExample
//( { file_desc: "Read and write AIFF and WAV audio files." kw:[file audio] }
//
// This class supports reading uncompressed AIFF and WAV files and writing uncompressed AIFF files.
// The reading and writing routines are known to work with 8,16,24, and 32 bit integer sample formats.
//
//)
#ifndef cmAudioFile_h
#define cmAudioFile_h
@ -16,15 +12,17 @@
extern "C" {
#endif
//(
#ifndef cmAudioFile_MAX_FRAME_READ_CNT
/// Maximum number of samples which will be read in one call to fread().
/// This value is only significant in that an internal buffer is created on the stack
/// whose size must be limited to prevent stack overflows.
// Maximum number of samples which will be read in one call to fread().
// This value is only significant in that an internal buffer is created on the stack
// whose size must be limited to prevent stack overflows.
#define cmAudioFile_MAX_FRAME_READ_CNT (8192)
#endif
/// Audio file result codes.
// Audio file result codes.
enum
{
kOkAfRC = 0,
@ -41,18 +39,18 @@ extern "C" {
kUnknownErrAfRC
};
/// Informational flags used by audioFileInfo
// Informational flags used by audioFileInfo
enum
{
kAiffAfFl = 0x01, ///< this is an AIFF file
kWavAfFl = 0x02, ///< this is a WAV file
kSwapAfFl = 0x04, ///< file header bytes must be swapped
kAifcAfFl = 0x08, ///< this is an AIFC file
kSwapSamplesAfFl = 0x10 ///< file sample bytes must be swapped
kAiffAfFl = 0x01, // this is an AIFF file
kWavAfFl = 0x02, // this is a WAV file
kSwapAfFl = 0x04, // file header bytes must be swapped
kAifcAfFl = 0x08, // this is an AIFC file
kSwapSamplesAfFl = 0x10 // file sample bytes must be swapped
};
/// Constants
// Constants
enum
{
kAudioFileLabelCharCnt = 256,
@ -64,7 +62,7 @@ extern "C" {
kAfBextOriginTimeN = 8
};
/// Aiff marker record
// Aiff marker record
typedef struct
{
unsigned id;
@ -72,9 +70,9 @@ extern "C" {
char label[kAudioFileLabelCharCnt];
} cmAudioFileMarker_t;
/// Broadcast WAV header record As used by ProTools audio files. See http://en.wikipedia.org/wiki/Broadcast_Wave_Format
/// When generated from Protools the timeRefLow/timeRefHigh values appear to actually refer
/// to the position on the Protools time-line rather than the wall clock time.
// Broadcast WAV header record As used by ProTools audio files. See http://en.wikipedia.org/wiki/Broadcast_Wave_Format
// When generated from Protools the timeRefLow/timeRefHigh values appear to actually refer
// to the position on the Protools time-line rather than the wall clock time.
typedef struct
{
char desc[ kAfBextDescN + 1 ];
@ -86,102 +84,103 @@ extern "C" {
unsigned timeRefHigh; // sample count since midnight high word
} cmAudioFileBext_t;
/// Audio file information record used by audioFileNew and audioFileOpen
// Audio file information record used by audioFileNew and audioFileOpen
typedef struct
{
unsigned bits; ///< bits per sample
unsigned chCnt; ///< count of audio file channels
double srate; ///< audio file sample rate in samples per second
unsigned frameCnt; ///< total number of sample frames in the audio file
unsigned flags; ///< informational flags
unsigned markerCnt; ///< count of markers in markerArray
cmAudioFileMarker_t* markerArray; ///< array of markers
cmAudioFileBext_t bextRecd; ///< only used with Broadcast WAV files
unsigned bits; // bits per sample
unsigned chCnt; // count of audio file channels
double srate; // audio file sample rate in samples per second
unsigned frameCnt; // total number of sample frames in the audio file
unsigned flags; // informational flags
unsigned markerCnt; // count of markers in markerArray
cmAudioFileMarker_t* markerArray; // array of markers
cmAudioFileBext_t bextRecd; // only used with Broadcast WAV files
} cmAudioFileInfo_t;
typedef cmHandle_t cmAudioFileH_t; ///< opaque audio file handle
extern cmAudioFileH_t cmNullAudioFileH; ///< NULL audio file handle
typedef cmHandle_t cmAudioFileH_t; // opaque audio file handle
extern cmAudioFileH_t cmNullAudioFileH; // NULL audio file handle
/// Create an audio file handle and optionally use the handle to open an audio file.
///
/// \param fn The audio file name to open or NULL to create the audio file handle without opening the file.
/// \param infoPtr A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
/// \param rcPtr A pointer to a result code to be set in the event of a runtime error or NULL to ignore.
/// \param rpt A pointer to a cmRpt_t object which error messages from this class will be directed to.
/// \retval cmAudioFileH_t A new audio file handle.
///
// Create an audio file handle and optionally use the handle to open an audio file.
//
// fn The audio file name to open or NULL to create the audio file handle without opening the file.
// infoPtr A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
// rcPtr A pointer to a result code to be set in the event of a runtime error or NULL to ignore.
// rpt A pointer to a cmRpt_t object which error messages from this class will be directed to.
// Returns cmAudioFileH_t A new audio file handle.
//
cmAudioFileH_t cmAudioFileNewOpen( const cmChar_t* fn, cmAudioFileInfo_t* infoPtr, cmRC_t* rcPtr, cmRpt_t* rpt );
/// Open an audio file for writing
// Open an audio file for writing
cmAudioFileH_t cmAudioFileNewCreate( const cmChar_t* fn, double srate, unsigned bits, unsigned chCnt, cmRC_t* rcPtr, cmRpt_t* rpt );
/// Open an audio file for reading using a handle returned from an earlier call to audioFileNewXXX().
///
/// \param h A file handle returned from and earlier call to cmAudioFileNewOpen() or cmAudioFileNewCreate().
/// \param fn The audio file name to open or NULL to create the audio file handle without opening the file.
/// \param infoPtr A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
/// \retval Returns an cmRC_t value indicating the success (kOkAfRC) or failure of the call.
///
/// If the audio file handle 'h' refers to an open file then it is automatically closed prior to being
/// reopened with the new file.
// Open an audio file for reading using a handle returned from an earlier call to audioFileNewXXX().
//
// h A file handle returned from and earlier call to cmAudioFileNewOpen() or cmAudioFileNewCreate().
// fn The audio file name to open or NULL to create the audio file handle without opening the file.
// infoPtr A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
// Returns an cmRC_t value indicating the success (kOkAfRC) or failure of the call.
//
// If the audio file handle 'h' refers to an open file then it is automatically closed prior to being
// reopened with the new file.
cmRC_t cmAudioFileOpen( cmAudioFileH_t h, const cmChar_t* fn, cmAudioFileInfo_t* infoPtr );
/// Open an audio file for writing. The type of the audio file, AIF or WAV
/// is determined by the file name extension.
// Open an audio file for writing. The type of the audio file, AIF or WAV
// is determined by the file name extension.
cmRC_t cmAudioFileCreate(
cmAudioFileH_t h, ///< Handle returned from an earlier call to cmAudioFileNewCreate() or cmAudioFileNewOpen().
const cmChar_t* fn, ///< File name of the new file.
double srate, ///< Sample rate of the new file.
unsigned bits, ///< Sample word width for the new file in bits (must be 8,16,24 or 32).
unsigned chCnt ///< Audio channel count for the new file.
cmAudioFileH_t h, // Handle returned from an earlier call to cmAudioFileNewCreate() or cmAudioFileNewOpen().
const cmChar_t* fn, // File name of the new file.
double srate, // Sample rate of the new file.
unsigned bits, // Sample word width for the new file in bits (must be 8,16,24 or 32).
unsigned chCnt // Audio channel count for the new file.
);
/// Close a the file associated with handle 'h' but do not release the handle.
/// If the file was opened for writing (cmAudioFileCreate()) then this function will
/// write the file header prior to closing the file.
// Close a the file associated with handle 'h' but do not release the handle.
// If the file was opened for writing (cmAudioFileCreate()) then this function will
// write the file header prior to closing the file.
cmRC_t cmAudioFileClose( cmAudioFileH_t* h );
/// Close the file associated with handle 'h' (via an internal call to
/// cmAudioFileClose()) and release the handle and any resources
/// associated with it. This is the complement to cmAudioFileOpen/Create().
// Close the file associated with handle 'h' (via an internal call to
// cmAudioFileClose()) and release the handle and any resources
// associated with it. This is the complement to cmAudioFileOpen/Create().
cmRC_t cmAudioFileDelete( cmAudioFileH_t* h );
/// Return true if the handle is not closed or deleted.
// Return true if the handle is not closed or deleted.
bool cmAudioFileIsValid( cmAudioFileH_t h );
/// Return true if the handle is open.
// Return true if the handle is open.
bool cmAudioFileIsOpen( cmAudioFileH_t h );
/// Return true if the current file position is at the end of the file.
// Return true if the current file position is at the end of the file.
bool cmAudioFileIsEOF( cmAudioFileH_t h );
/// Return the current file position as a frame index.
// Return the current file position as a frame index.
unsigned cmAudioFileTell( cmAudioFileH_t h );
/// Set the current file position as an offset from the first frame.
// Set the current file position as an offset from the first frame.
cmRC_t cmAudioFileSeek( cmAudioFileH_t h, unsigned frmIdx );
/// \name Sample Reading Functions.
///@{
/// Fill a user suppled buffer with up to frmCnt samples.
/// If less than frmCnt samples are available at the specified audio file location then the unused
/// buffer space is set to zero. Check *actualFrmCntPtr for the count of samples actually available
/// in the return buffer. Functions which do not include a begFrmIdx argument begin reading from
/// the current file location (see cmAudioFileSeek()). The buf argument is always a pointer to an
/// array of pointers of length chCnt. Each channel buffer specified in buf[] must contain at least
/// frmCnt samples.
///
/// \param h An audio file handle returned from an earlier call to audioFileNew()
/// \param fn The name of the audio file to read.
/// \param begFrmIdx The frame index of the first sample to read. Functions that do not use this parameter begin reading at the current file location (See cmAudioFileTell()).
/// \param frmCnt The number of samples allocated in buf.
/// \param chIdx The index of the first channel to read.
/// \param chCnt The count of channels to read.
/// \param buf An array containing chCnt pointers to arrays of frmCnt samples.
/// \param actualFrmCntPtr The number of frames actually written to the return buffer (ignored if NULL)
// Sample Reading Functions.
//
// Fill a user suppled buffer with up to frmCnt samples.
// If less than frmCnt samples are available at the specified audio file location then the unused
// buffer space is set to zero. Check *actualFrmCntPtr for the count of samples actually available
// in the return buffer. Functions which do not include a begFrmIdx argument begin reading from
// the current file location (see cmAudioFileSeek()). The buf argument is always a pointer to an
// array of pointers of length chCnt. Each channel buffer specified in buf[] must contain at least
// frmCnt samples.
//
//
// h An audio file handle returned from an earlier call to audioFileNew()
// fn The name of the audio file to read.
// begFrmIdx The frame index of the first sample to read. Functions that do not use this parameter begin reading at the current file location (See cmAudioFileTell()).
// frmCnt The number of samples allocated in buf.
// chIdx The index of the first channel to read.
// chCnt The count of channels to read.
// buf An array containing chCnt pointers to arrays of frmCnt samples.
// actualFrmCntPtr The number of frames actually written to the return buffer (ignored if NULL)
cmRC_t cmAudioFileReadInt( cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, int** buf, unsigned* actualFrmCntPtr );
cmRC_t cmAudioFileReadFloat( cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float** buf, unsigned* actualFrmCntPtr );
@ -191,10 +190,7 @@ extern "C" {
cmRC_t cmAudioFileGetFloat( const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float** buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
cmRC_t cmAudioFileGetDouble( const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, double** buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
///@}
/// \name Sum the returned samples into the output buffer.
///@{
// Sum the returned samples into the output buffer.
cmRC_t cmAudioFileReadSumInt( cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, int** buf, unsigned* actualFrmCntPtr );
cmRC_t cmAudioFileReadSumFloat( cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float** buf, unsigned* actualFrmCntPtr );
cmRC_t cmAudioFileReadSumDouble( cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, double** buf, unsigned* actualFrmCntPtr );
@ -202,12 +198,8 @@ extern "C" {
cmRC_t cmAudioFileGetSumInt( const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, int** buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
cmRC_t cmAudioFileGetSumFloat( const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float** buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
cmRC_t cmAudioFileGetSumDouble( const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, double** buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
///@}
///@}
/// \name Sample Writing Functions
///@{
// Sample Writing Functions
cmRC_t cmAudioFileWriteInt( cmAudioFileH_t h, unsigned frmCnt, unsigned chCnt, int** bufPtrPtr );
cmRC_t cmAudioFileWriteFloat( cmAudioFileH_t h, unsigned frmCnt, unsigned chCnt, float** bufPtrPtr );
cmRC_t cmAudioFileWriteDouble( cmAudioFileH_t h, unsigned frmCnt, unsigned chCnt, double** bufPtrPtr );
@ -215,14 +207,11 @@ extern "C" {
cmRC_t cmAudioFileWriteFileInt( const char* fn, double srate, unsigned bit, unsigned frmCnt, unsigned chCnt, int** bufPtrPtr, cmRpt_t* rpt );
cmRC_t cmAudioFileWriteFileFloat( const char* fn, double srate, unsigned bit, unsigned frmCnt, unsigned chCnt, float** bufPtrPtr, cmRpt_t* rpt );
cmRC_t cmAudioFileWriteFileDouble( const char* fn, double srate, unsigned bit, unsigned frmCnt, unsigned chCnt, double** bufPtrPtr, cmRpt_t* rpt );
///@}
/// \name cmSample_t and cmReal_t Alias Macros
///@{
/// Alias the cmSample_t and cmReal_t sample reading and writing functions to the appropriate
/// type based on #CM_FLOAT_SMP and #CM_FLOAT_REAL.
// Alias the cmSample_t and cmReal_t sample reading and writing functions to the appropriate
// type based on #CM_FLOAT_SMP and #CM_FLOAT_REAL.
#if CM_FLOAT_SMP == 1
@ -263,51 +252,44 @@ extern "C" {
#define cmAudioFileWriteFileReal cmAudioFileWriteFileDouble
#endif
///@}
/// \name Minimum, Maximum, Mean
///@{
/// Scan an entire audio file and return the minimum, maximum and mean sample value.
/// On error *minPtr, *maxPtr, and *meanPtr are set to -acSample_MAX, cmSample_MAX, and 0 respectively
// Scan an entire audio file and return the minimum, maximum and mean sample value.
// On error *minPtr, *maxPtr, and *meanPtr are set to -acSample_MAX, cmSample_MAX, and 0 respectively
cmRC_t cmAudioFileMinMaxMean( cmAudioFileH_t h, unsigned chIdx, cmSample_t* minPtr, cmSample_t* maxPtr, cmSample_t* meanPtr );
cmRC_t cmAudioFileMinMaxMeanFn( const cmChar_t* fn, unsigned chIdx, cmSample_t* minPtr, cmSample_t* maxPtr, cmSample_t* meanPtr, cmRpt_t* rpt );
///@}
/// Return the file name associated with a audio file handle.
// Return the file name associated with a audio file handle.
const cmChar_t* cmAudioFileName( cmAudioFileH_t h );
/// Given an error code return the associated message.
// Given an error code return the associated message.
const char* cmAudioFileErrorMsg( unsigned rc );
/// \name Get information about an audio file
///@{
/// Return the cmAudioFileInfo_t record associated with a file.
// Return the cmAudioFileInfo_t record associated with a file.
cmRC_t cmAudioFileGetInfo( const cmChar_t* fn, cmAudioFileInfo_t* infoPtr, cmRpt_t* rpt );
/// Print the cmAudioFileInfo_t to a file.
// Print the cmAudioFileInfo_t to a file.
void cmAudioFilePrintInfo( const cmAudioFileInfo_t* infoPtr, cmRpt_t* );
/// Print the file header information and frmCnt sample values beginning at frame index frmIdx.
// Print the file header information and frmCnt sample values beginning at frame index frmIdx.
cmRC_t cmAudioFileReport( cmAudioFileH_t h, cmRpt_t* rpt, unsigned frmIdx, unsigned frmCnt );
/// Print the file header information and frmCnt sample values beginning at frame index frmIdx.
// Print the file header information and frmCnt sample values beginning at frame index frmIdx.
cmRC_t cmAudioFileReportFn( const cmChar_t* fn, unsigned frmIdx, unsigned frmCnt, cmRpt_t* rpt );
///@}
/// Change the sample rate value in the header. Note that this function does not resample the audio
/// signal it simply changes the value of the sample rate in the header.
// Change the sample rate value in the header. Note that this function does not resample the audio
// signal it simply changes the value of the sample rate in the header.
cmRC_t cmAudioFileSetSrate( const cmChar_t* audioFn, unsigned srate );
// Generate a sine tone and write it to a file.
cmRC_t cmAudioFileSine( cmCtx_t* ctx, const cmChar_t* fn, double srate, unsigned bits, double hz, double gain, double secs );
/// Testing and example routine for functions in cmAudioFile.h.
/// Also see cmProcTest.c cmAudioFileReadWriteTest()
// Testing and example routine for functions in cmAudioFile.h.
// Also see cmProcTest.c cmAudioFileReadWriteTest()
void cmAudioFileTest( cmCtx_t* ctx, int argc, const char* argv[] );
//)
#ifdef __cplusplus
}

View File

@ -1,6 +1,11 @@
#ifndef cmAudioFileDev_h
#define cmAudioFileDev_h
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Implements cmAudioFileDev for reading and writing audio files under control of cmAudioPort.", kw:[audio file rt]}
enum
{
kOkAfdRC = cmOkRC,
@ -72,4 +77,10 @@ void cmAudioFileDevReport( cmAfdH_t h, cmRpt_t* rpt );
void cmAudioFileDevTest( cmRpt_t* rpt );
//)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -4,6 +4,9 @@
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Manages a collection of audio files and maintains downsampled copies of their signals." kw:[audio file] }
enum
{
kOkAfmRC = cmOkRC,
@ -56,7 +59,7 @@ extern "C" {
bool cmAfmIsValid( cmAfmH_t h );
cmAfmFileH_t cmAfmIdToHandle( cmAfmH_t h, unsigned fileId );
//)
#ifdef __cplusplus

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Audio device driver which generates the callbacks to run cmAudioPort in a non-real time mode." kw:[audio rt]}
cmApRC_t cmApNrtAllocate( cmRpt_t* rpt );
cmApRC_t cmApNrtFree();
@ -57,6 +59,7 @@ extern "C" {
/// Return true if the device is currently started.
bool cmApNrtDeviceIsStarted( unsigned devIdx );
//)
#ifdef __cplusplus
}

View File

@ -1,27 +1,24 @@
/// \file cmAudioPort.h
/// \brief Cross platform audio I/O interface.
///
/// This interface provides data declarations for platform dependent
/// audio I/O functions. The implementation for the functions are
/// in platform specific modules. See cmAudioPortOsx.c and cmAudioPortAlsa.c.
///
/// ALSA Notes:
/// Assign capture device to line or mic input:
/// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Mic
/// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Line
///
/// -c 0 select the first card
/// -iface=MIXER the cset is targetting the MIXER component
/// -name='Input Source',index=0 the control to set is the first 'Input Source'
/// Note that the 'Capture' control sets the input gain.
///
/// See alsamixer for a GUI to accomplish the same thing.
///
///
/// Usage example and testing code:
/// See cmApPortTest() and cmAudioSysTest().
/// \snippet cmAudioPort.c cmAudioPortExample
///
//( { file_desc: "Cross platform audio device interface." kw:[audio rt] }
//
// This interface provides data declarations for platform dependent
// audio I/O functions. The implementation for the functions are
// in platform specific modules. See cmAudioPortOsx.c and cmAudioPortAlsa.c.
//
// ALSA Notes:
// Assign capture device to line or mic input:
// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Mic
// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Line
//
// -c 0 select the first card
// -iface=MIXER the cset is targetting the MIXER component
// -name='Input Source',index=0 the control to set is the first 'Input Source'
// Note that the 'Capture' control sets the input gain.
//
// See alsamixer for a GUI to accomplish the same thing.
//
//
//)
#ifndef cmAudioPort_h
#define cmAudioPort_h
@ -29,8 +26,10 @@
extern "C" {
#endif
typedef unsigned cmApRC_t; ///< Audio port interface result code.
typedef float cmApSample_t; ///< Audio sample type.
//(
typedef unsigned cmApRC_t; // Audio port interface result code.
typedef float cmApSample_t; // Audio sample type.
enum
{
@ -45,81 +44,81 @@ extern "C" {
// cmApAudioPacket_t flags
enum
{
kInterleavedApFl = 0x01, ///< The audio samples are interleaved.
kFloatApFl = 0x02 ///< The audio samples are single precision floating point values.
kInterleavedApFl = 0x01, // The audio samples are interleaved.
kFloatApFl = 0x02 // The audio samples are single precision floating point values.
};
/// Audio packet record used by the cmApAudioPacket_t callback.
/// Audio ports send and receive audio using this data structure.
// Audio packet record used by the cmApAudioPacket_t callback.
// Audio ports send and receive audio using this data structure.
typedef struct
{
unsigned devIdx; ///< device associated with packet
unsigned begChIdx; ///< first device channel
unsigned chCnt; ///< count of channels
unsigned audioFramesCnt; ///< samples per channel (see note below)
unsigned bitsPerSample; ///< bits per sample word
unsigned flags; ///< kInterleavedApFl | kFloatApFl
void* audioBytesPtr; ///< pointer to sample data
void* userCbPtr; ///< user defined value passed in cmApDeviceSetup()
cmTimeSpec_t timeStamp; ///< Packet time stamp.
unsigned devIdx; // device associated with packet
unsigned begChIdx; // first device channel
unsigned chCnt; // count of channels
unsigned audioFramesCnt; // samples per channel (see note below)
unsigned bitsPerSample; // bits per sample word
unsigned flags; // kInterleavedApFl | kFloatApFl
void* audioBytesPtr; // pointer to sample data
void* userCbPtr; // user defined value passed in cmApDeviceSetup()
cmTimeSpec_t timeStamp; // Packet time stamp.
} cmApAudioPacket_t;
/// Audio port callback signature.
/// inPktArray[inPktCnt] are full packets of audio coming from the ADC to the application.
/// outPktArray[outPktCnt] are empty packets of audio which will be filled by the application
/// and then sent to the DAC.
///
/// The value of audioFrameCnt gives the number of samples per channel which are available
/// in the packet data buffer 'audioBytesPtr'. The callback function may decrease this number in
/// output packets if the number of samples available is less than the size of the buffer.
/// It is the responsibility of the calling audio port to notice this change and pass the new,
/// decreased number of samples to the hardware.
///
/// In general it should be assmed that this call is made from a system thread which is not
/// the same as the application thread.
/// The usual thread safety precautions should therefore be taken if this function implementation
/// interacts with data structures also handled by the application. The audio buffer class (\see cmApBuf.h)
/// is designed to provide a safe and efficient way to communicate between
/// the audio thread and the application.
// Audio port callback signature.
// inPktArray[inPktCnt] are full packets of audio coming from the ADC to the application.
// outPktArray[outPktCnt] are empty packets of audio which will be filled by the application
// and then sent to the DAC.
//
// The value of audioFrameCnt gives the number of samples per channel which are available
// in the packet data buffer 'audioBytesPtr'. The callback function may decrease this number in
// output packets if the number of samples available is less than the size of the buffer.
// It is the responsibility of the calling audio port to notice this change and pass the new,
// decreased number of samples to the hardware.
//
// In general it should be assmed that this call is made from a system thread which is not
// the same as the application thread.
// The usual thread safety precautions should therefore be taken if this function implementation
// interacts with data structures also handled by the application. The audio buffer class (\see cmApBuf.h)
// is designed to provide a safe and efficient way to communicate between
// the audio thread and the application.
typedef void (*cmApCallbackPtr_t)( cmApAudioPacket_t* inPktArray, unsigned inPktCnt, cmApAudioPacket_t* outPktArray, unsigned outPktCnt );
/// Setup the audio port management object for this machine.
// Setup the audio port management object for this machine.
cmApRC_t cmApInitialize( cmRpt_t* rpt );
/// Stop all audio devices and release any resources held
/// by the audio port management object.
// Stop all audio devices and release any resources held
// by the audio port management object.
cmApRC_t cmApFinalize();
/// Return the count of audio devices attached to this machine.
// Return the count of audio devices attached to this machine.
unsigned cmApDeviceCount();
/// Get a textual description of the device at index 'devIdx'.
// Get a textual description of the device at index 'devIdx'.
const char* cmApDeviceLabel( unsigned devIdx );
/// Given an audio device label return the associated device index.
// Given an audio device label return the associated device index.
unsigned cmApDeviceLabelToIndex( const cmChar_t* label );
/// Get the count of audio input or output channesl on device at index 'devIdx'.
// Get the count of audio input or output channesl on device at index 'devIdx'.
unsigned cmApDeviceChannelCount( unsigned devIdx, bool inputFl );
/// Get the current sample rate of a device. Note that if the device has both
/// input and output capability then the sample rate is the same for both.
// Get the current sample rate of a device. Note that if the device has both
// input and output capability then the sample rate is the same for both.
double cmApDeviceSampleRate( unsigned devIdx );
/// Get the count of samples per callback for the input or output for this device.
// Get the count of samples per callback for the input or output for this device.
unsigned cmApDeviceFramesPerCycle( unsigned devIdx, bool inputFl );
/// Configure a device.
/// All devices must be setup before they are started.
/// framesPerCycle is the requested number of samples per audio callback. The
/// actual number of samples made from a callback may be smaller. See the note
/// regarding this in cmApAudioPacket_t.
/// If the device cannot support the requested configuration then the function
/// will return an error code.
/// If the device is started when this function is called then it will be
/// automatically stopped and then restarted following the reconfiguration.
/// If the reconfiguration fails then the device may not be restared.
// Configure a device.
// All devices must be setup before they are started.
// framesPerCycle is the requested number of samples per audio callback. The
// actual number of samples made from a callback may be smaller. See the note
// regarding this in cmApAudioPacket_t.
// If the device cannot support the requested configuration then the function
// will return an error code.
// If the device is started when this function is called then it will be
// automatically stopped and then restarted following the reconfiguration.
// If the reconfiguration fails then the device may not be restared.
cmApRC_t cmApDeviceSetup(
unsigned devIdx,
double srate,
@ -127,25 +126,26 @@ extern "C" {
cmApCallbackPtr_t callbackPtr,
void* userCbPtr );
/// Start a device. Note that the callback may be made prior to this function returning.
// Start a device. Note that the callback may be made prior to this function returning.
cmApRC_t cmApDeviceStart( unsigned devIdx );
/// Stop a device.
// Stop a device.
cmApRC_t cmApDeviceStop( unsigned devIdx );
/// Return true if the device is currently started.
// Return true if the device is currently started.
bool cmApDeviceIsStarted( unsigned devIdx );
/// Print a report of all the current audio device configurations.
// Print a report of all the current audio device configurations.
void cmApReport( cmRpt_t* rpt );
/// Test the audio port by synthesizing a sine signal or passing audio through
/// from the input to the output. This is also a good example of how to
/// use all of the functions in the interface.
/// Set runFl to false to print a report without starting any audio devices.
/// See cmAudiotPortTest.c for usage example for this function.
// Test the audio port by synthesizing a sine signal or passing audio through
// from the input to the output. This is also a good example of how to
// use all of the functions in the interface.
// Set runFl to false to print a report without starting any audio devices.
// See cmAudiotPortTest.c for usage example for this function.
int cmApPortTest(bool runFl, cmRpt_t* rpt, int argc, const char* argv[] );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"This is an audio device driver for cmAudioPort which supports reading and writing audio files as though they are real-time devices." kw[audio file rt] }
cmApRC_t cmApFileAllocate( cmRpt_t* rpt );
cmApRC_t cmApFileFree();
@ -41,6 +43,8 @@ extern "C" {
void cmApFileReport( cmRpt_t* rpt );
void cmApFileTest( cmRpt_t* rpt );
//)
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,4 @@
// cmAudioSys.h
// Implements a real-time audio processing engine.
//( { file_desc: "This is the kernel of a real-time audio processing engine." kw:[audio rt] }
//
// The audio system is composed a collection of independent sub-systems.
// Each sub-system maintains a thread which runs asynchrounsly
@ -49,9 +48,7 @@
// delivered to the DSP procedure at the end of the DSP execution
// procedure.
//
// Usage example and testing code:
// See cmAudioSysTest().
// \snippet cmAudioSys.c cmAudioSysTest
//)
#ifndef cmAudioSys_h
#define cmAudioSys_h
@ -60,6 +57,7 @@
extern "C" {
#endif
//(
// Audio system result codes
enum
{
@ -296,6 +294,7 @@ extern "C" {
// Audio system test and example function.
void cmAudioSysTest( cmRpt_t* rpt, int argc, const char* argv[] );
//)
#ifdef __cplusplus

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Constrants and data structures used to communicate messages to and from cmAudioSys" kw:[audio real_time]}
/// Reserved DSP message selector id's (second field of all host<->audio system messages)
enum
{
@ -112,6 +114,7 @@ extern "C" {
} cmAudioSysStatus_t;
//)
#ifdef __cplusplus
}

View File

@ -1,9 +1,15 @@
#ifndef cmComplexTypes_h
#define cmComplexTypes_h
#ifdef __cplusplus
extern "C" {
#endif
#include <complex.h>
#include <fftw3.h>
//( { file_desc: "Constants and functions used for working with complex values." kw:[base math] }
#if CM_FLOAT_SMP == 1
#define cmCabsS cabsf
@ -95,5 +101,10 @@ void cmVOCR_Abs( cmSample_t* y, const cmComplexR_t* x, unsigned n );
void cmVOCR_MultVS( cmComplexR_t* y, cmReal_t v, unsigned n );
void cmVOCR_DivVS( cmComplexR_t* y, cmReal_t v, unsigned n );
//)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -6,6 +6,8 @@
extern "C" {
#endif
//( { file_desc:"Comma seperated value file reader and writer." kw[file] }
enum
{
kOkCsvRC = 0,
@ -146,6 +148,8 @@ extern "C" {
cmCsvRC_t cmCsvPrint( cmCsvH_t h, unsigned rowCnt );
//)
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,6 @@
//{
//(
//( { file_desc:"Global application context record." kw[base] }
//
// cmCtx_t is used to hold application supplied cmRpt_t, cmErr_t and
// other global values for easy distribution throughtout a cm based application.
//
@ -44,7 +45,6 @@ extern "C" {
unsigned mmFlags // Initialization flags used to configure \ref cmMallocDebug.h
);
//)
//}
#ifdef __cplusplus
}

View File

@ -6,6 +6,8 @@
extern "C" {
#endif
//( { file_desc:"Dynamic generic array with user programmable indexing and sorting capablity." kw:[container] }
enum
{
kOkDlRC = cmOkRC,
@ -86,7 +88,7 @@ extern "C" {
// which this iterator is attached to.
const void* cmDListIterFind( cmDListIterH_t iH, const void* key, unsigned keyN, unsigned* recdByteNRef);
//)
#ifdef __cplusplus
}
#endif

View File

@ -1,4 +1,6 @@
//( { file_desc:"Template 'include' code for using cmDList as a template." kw:[container] }
// The following two macros must be defined prior to including this code:
// #define cmSFX(a) a##_MySuffix
// #define cmTYPE My_Type
@ -117,6 +119,8 @@ const cmTYPE* cmSFX(cmDListIterFind)( cmDListIterH_t iH, const cmTYPE* key
#endif // cmGEN_CODE
//)
#undef cmSFX
#undef cmTYPE

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Generic, introspective, data structure." }
/*
TODO:
0) Figure out an error handling scheme that does not rely on
@ -688,7 +690,7 @@ extern "C" {
void cmDataPrint( const cmData_t* p, cmRpt_t* rpt );
void cmDataTest( cmCtx_t* ctx );
//)
#ifdef __cplusplus
}

View File

@ -4,6 +4,9 @@
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"A class for managing persistent device configuration information." kw:[audio hardware] }
/*
IMPLEMENTATION:
1) A 'cfg' record is a device reference with a 'cfg label'.
@ -210,6 +213,7 @@ extern "C" {
// Set 'fn' to NULL to use filename from cmDevCfgAlloc()
cmDcRC_t cmDevCfgWrite( cmDevCfgH_t h, const cmChar_t* fn );
//)
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
//{
//(
//( { file_desc:"Format error messages and track the last error generated." kw:[base]}
//
// This class is used to format error messages and track the last error generated.
//
// Most of the cmHandle_t based classes use cmErr_t to format error messages with a
@ -75,7 +75,6 @@ extern "C" {
cmRC_t cmErrClearRC( cmErr_t* err );
//)
//}
#ifdef __cplusplus
}

View File

@ -6,6 +6,7 @@
extern "C" {
#endif
//( file_desc:"Run a child process via 'execvp()'" kw[system]
enum
{
kOkExRC,
@ -22,6 +23,8 @@ extern "C" {
cmExRC_t cmExecV( cmErr_t* err, int* returnValRef, const cmChar_t* pgmFn, va_list vl );
cmExRC_t cmExec( cmErr_t* err, int* returnValRef, const cmChar_t* pgmFn, ... );
//)
#ifdef __cplusplus
}
#endif

View File

@ -2106,7 +2106,7 @@ cmFtRC_t cmFtReaderAdvance( cmFtFileH_t h, cmFtFrameDesc_t* fdp )
{
if( rc == kOkFtRC )
{
fdp->smpIdx = frameDescPtr->time.sampleIdx;
fdp->smpIdx = frameDescPtr->tm.sampleIdx;
fdp->frmIdx = cmFrameFileFrameLoadedIndex(fp->ffH);
}
else

View File

@ -1,7 +1,6 @@
/// \file cmFeatFile.h
/// \brief Audio file acoustic feature analyzer and accompanying file reader.
///
///
//( { file_desc:" Audio file acoustic feature analyzer and accompanying file reader." kw:[audio analysis file]}
//
//
#ifndef cmFeatFile_h
#define cmFeatFile_h
@ -12,7 +11,7 @@ extern "C" {
/// Result codes for all functions in cmFeatFile.h
// Result codes for all functions in cmFeatFile.h
enum
{
kOkFtRC = cmOkRC,
@ -36,241 +35,238 @@ extern "C" {
kInvalidFrmIdxFtRC
};
/// Feature Id's
// Feature Id's
enum
{
kInvalidFtId, ///< 0
kAmplFtId, ///< 1 Fourier transform amplitude
kDbAmplFtId, ///< 2 Fourier transform decibel
kPowFtId, ///< 3 Fourier transform power
kDbPowFtId, ///< 4 Fourier transform power decibel
kPhaseFtId, ///< 5 Fourier transform phase (not unwrapped)
kBfccFtId, ///< 6 Bark Frequency Cepstral Coeffcients
kMfccFtId, ///< 7 Mel Frequency Cepstral Coefficients
kCepsFtId, ///< 8 Cepstral Coefficients
kConstQFtId, ///< 9 Constant-Q transform
kLogConstQFtId, ///< 10 Log Constant-Q transform
kRmsFtId, ///< 11 Root means square of the audio signal
kDbRmsFtId, ///< 12 RMS in decibels
kInvalidFtId, // 0
kAmplFtId, // 1 Fourier transform amplitude
kDbAmplFtId, // 2 Fourier transform decibel
kPowFtId, // 3 Fourier transform power
kDbPowFtId, // 4 Fourier transform power decibel
kPhaseFtId, // 5 Fourier transform phase (not unwrapped)
kBfccFtId, // 6 Bark Frequency Cepstral Coeffcients
kMfccFtId, // 7 Mel Frequency Cepstral Coefficients
kCepsFtId, // 8 Cepstral Coefficients
kConstQFtId, // 9 Constant-Q transform
kLogConstQFtId, // 10 Log Constant-Q transform
kRmsFtId, // 11 Root means square of the audio signal
kDbRmsFtId, // 12 RMS in decibels
kD1AmplFtId, ///< 13 1st order difference over time of the Fourier transform amplitude
kD1DbAmplFtId, ///< 14 1st order difference over time of the Fourier transform decibel
kD1PowFtId, ///< 15 1st order difference over time of the Fourier transform power
kD1DbPowFtId, ///< 16 1st order difference over time of the Fourier transform power decibel
kD1PhaseFtId, ///< 17 1st order difference over time of the Fourier transform phase (not unwrapped)
kD1BfccFtId, ///< 18 1st order difference over time of the Bark Frequency Cepstral Coeffcients
kD1MfccFtId, ///< 19 1st order difference over time of the Mel Frequency Cepstral Coefficients
kD1CepsFtId, ///< 20 1st order difference over time of the Cepstral Coefficients
kD1ConstQFtId, ///< 21 1st order difference over time of the Constant-Q transform
kD1LogConstQFtId, ///< 22 1st order difference over time of the Log Constant-Q transform
kD1RmsFtId, ///< 23 1st order difference over time of the Root means square of the audio signal
kD1DbRmsFtId, ///< 24 1st order difference over time of the RMS in decibels
kD1AmplFtId, // 13 1st order difference over time of the Fourier transform amplitude
kD1DbAmplFtId, // 14 1st order difference over time of the Fourier transform decibel
kD1PowFtId, // 15 1st order difference over time of the Fourier transform power
kD1DbPowFtId, // 16 1st order difference over time of the Fourier transform power decibel
kD1PhaseFtId, // 17 1st order difference over time of the Fourier transform phase (not unwrapped)
kD1BfccFtId, // 18 1st order difference over time of the Bark Frequency Cepstral Coeffcients
kD1MfccFtId, // 19 1st order difference over time of the Mel Frequency Cepstral Coefficients
kD1CepsFtId, // 20 1st order difference over time of the Cepstral Coefficients
kD1ConstQFtId, // 21 1st order difference over time of the Constant-Q transform
kD1LogConstQFtId, // 22 1st order difference over time of the Log Constant-Q transform
kD1RmsFtId, // 23 1st order difference over time of the Root means square of the audio signal
kD1DbRmsFtId, // 24 1st order difference over time of the RMS in decibels
};
/// User defined feature parameters
// User defined feature parameters
typedef struct
{
unsigned id; ///< feature id
unsigned cnt; ///< length of feature vector
bool normFl; ///< normalize this feature
bool enableFl; ///< true if this feature is enabled
unsigned id; // feature id
unsigned cnt; // length of feature vector
bool normFl; // normalize this feature
bool enableFl; // true if this feature is enabled
} cmFtAttr_t;
/// Skip input audio range record
// Skip input audio range record
typedef struct
{
unsigned smpIdx; ///< Index of first sample to skip
unsigned smpCnt; ///< Count of successive samples to skip.
unsigned smpIdx; // Index of first sample to skip
unsigned smpCnt; // Count of successive samples to skip.
} cmFtSkip_t;
/// Analysis parameters
// Analysis parameters
typedef struct
{
const char* audioFn; ///< Audio file name.
const char* featFn; ///< Feature file name.
unsigned chIdx; ///< Audio file channel index
cmReal_t wndMs; ///< Length of the analysis window in milliseconds.
unsigned hopFact; ///< Analysis window overlap factor 1 = 1:1 2=2:1 ...
bool normAudioFl; ///< Normalize the audio over the length of the audio file
cmMidiByte_t constQMinPitch; ///< Used to determine the base const-q octave.
cmMidiByte_t constQMaxPitch; ///< Used to determine the maximum const-q frequency of interest.
unsigned constQBinsPerOctave; ///< Bands per const-q octave.
unsigned onsetMedFiltWndSmpCnt; ///< Complex onset median filter
cmReal_t onsetThreshold; ///< Complex onset threshold
cmReal_t minDb; ///< Fourier Transform magnitude values below minDb are set to minDb.
cmReal_t floorThreshDb; ///< Frames with an RMS below this value will be skipped
cmFtSkip_t* skipArray; ///< skipArray[skipCnt] user defined sample skip ranges
unsigned skipCnt; ///< Count of records in skipArray[].
cmFtAttr_t* attrArray; ///< attrArray[attrCnt] user defined parameter array
unsigned attrCnt; ///< Count of records in attrArray[].
const char* audioFn; // Audio file name.
const char* featFn; // Feature file name.
unsigned chIdx; // Audio file channel index
cmReal_t wndMs; // Length of the analysis window in milliseconds.
unsigned hopFact; // Analysis window overlap factor 1 = 1:1 2=2:1 ...
bool normAudioFl; // Normalize the audio over the length of the audio file
cmMidiByte_t constQMinPitch; // Used to determine the base const-q octave.
cmMidiByte_t constQMaxPitch; // Used to determine the maximum const-q frequency of interest.
unsigned constQBinsPerOctave; // Bands per const-q octave.
unsigned onsetMedFiltWndSmpCnt; // Complex onset median filter
cmReal_t onsetThreshold; // Complex onset threshold
cmReal_t minDb; // Fourier Transform magnitude values below minDb are set to minDb.
cmReal_t floorThreshDb; // Frames with an RMS below this value will be skipped
cmFtSkip_t* skipArray; // skipArray[skipCnt] user defined sample skip ranges
unsigned skipCnt; // Count of records in skipArray[].
cmFtAttr_t* attrArray; // attrArray[attrCnt] user defined parameter array
unsigned attrCnt; // Count of records in attrArray[].
} cmFtParam_t;
/// Feature summary information
// Feature summary information
typedef struct
{
unsigned id; ///< feature id (same as associated cmFtAttr.id)
unsigned cnt; ///< length of each feature vector (same as associated cmFtAttr.cnt)
unsigned id; // feature id (same as associated cmFtAttr.id)
unsigned cnt; // length of each feature vector (same as associated cmFtAttr.cnt)
/// The raw feature summary values are calculated prior to normalization.
cmReal_t* rawMinV; ///< Vector of min value over time for each feature element.
cmReal_t* rawMaxV; ///< Vector of max value over time for each feature element.
cmReal_t* rawAvgV; ///< Vector of avg value over time for each feature element.
cmReal_t* rawSdvV; ///< Vector of standard deviation values over time for each feature element.
cmReal_t rawMin; ///< Min value of all values for this feature. Equivalent to min(rawMinV).
cmReal_t rawMax; ///< Max value of all values for this feature. Equivalent to max(rawMaxV).
// The raw feature summary values are calculated prior to normalization.
cmReal_t* rawMinV; // Vector of min value over time for each feature element.
cmReal_t* rawMaxV; // Vector of max value over time for each feature element.
cmReal_t* rawAvgV; // Vector of avg value over time for each feature element.
cmReal_t* rawSdvV; // Vector of standard deviation values over time for each feature element.
cmReal_t rawMin; // Min value of all values for this feature. Equivalent to min(rawMinV).
cmReal_t rawMax; // Max value of all values for this feature. Equivalent to max(rawMaxV).
/// normalized feature summary values
cmReal_t* normMinV; ///< Vector of min value over time for each feature element.
cmReal_t* normMaxV; ///< Vector of max value over time for each feature element.
cmReal_t* normAvgV; ///< Vector of avg value over time for each feature element.
cmReal_t* normSdvV; ///< Vector of standard deviation values over time for each feature element.
cmReal_t normMin; ///< Min value of all values for this feature. Equivalent to min(normMinV).
cmReal_t normMax; ///< Max value of all values for this feature. Equivalent to max(rawMaxV).
// normalized feature summary values
cmReal_t* normMinV; // Vector of min value over time for each feature element.
cmReal_t* normMaxV; // Vector of max value over time for each feature element.
cmReal_t* normAvgV; // Vector of avg value over time for each feature element.
cmReal_t* normSdvV; // Vector of standard deviation values over time for each feature element.
cmReal_t normMin; // Min value of all values for this feature. Equivalent to min(normMinV).
cmReal_t normMax; // Max value of all values for this feature. Equivalent to max(rawMaxV).
} cmFtSumm_t;
/// Feature file info record
// Feature file info record
typedef struct
{
unsigned frmCnt; ///< count of frames in the file
cmReal_t srate; ///< audio sample rate
unsigned smpCnt; ///< audio sample count
unsigned fftSmpCnt; ///< FFT window length (always power of 2)
unsigned hopSmpCnt; ///< audio sample hop count
unsigned binCnt; ///< FFT bin count (always fftSmpCnt/2 + 1)
unsigned skipFrmCnt; ///< count of frames skipped based on user skip array
unsigned floorFrmCnt; ///< count of frames skipped because below floorThreshDb
cmFtParam_t param; ///< analysis parameter record used to form this feature file
cmFtSumm_t* summArray; ///< summArray[ param.attrCnt ] feature summary information
unsigned frmCnt; // count of frames in the file
cmReal_t srate; // audio sample rate
unsigned smpCnt; // audio sample count
unsigned fftSmpCnt; // FFT window length (always power of 2)
unsigned hopSmpCnt; // audio sample hop count
unsigned binCnt; // FFT bin count (always fftSmpCnt/2 + 1)
unsigned skipFrmCnt; // count of frames skipped based on user skip array
unsigned floorFrmCnt; // count of frames skipped because below floorThreshDb
cmFtParam_t param; // analysis parameter record used to form this feature file
cmFtSumm_t* summArray; // summArray[ param.attrCnt ] feature summary information
} cmFtInfo_t;
/// Data structure returned by cmFtReaderAdvance().
// Data structure returned by cmFtReaderAdvance().
typedef struct
{
unsigned smpIdx; ///< The audio signal sample index this frames information is based on.
unsigned frmIdx; ///< The frame index relative to other frames in this feature file.
unsigned smpIdx; // The audio signal sample index this frames information is based on.
unsigned frmIdx; // The frame index relative to other frames in this feature file.
} cmFtFrameDesc_t;
typedef cmHandle_t cmFtH_t; ///< Analyzer handle
typedef cmHandle_t cmFtFileH_t; ///< Feature file handle.
typedef unsigned cmFtRC_t; ///< Result code type used by all functions in cmFeatFile.h.
typedef cmHandle_t cmFtH_t; // Analyzer handle
typedef cmHandle_t cmFtFileH_t; // Feature file handle.
typedef unsigned cmFtRC_t; // Result code type used by all functions in cmFeatFile.h.
extern cmFtH_t cmFtNullHandle; ///< A NULL handle useful for indicating an uninitialized analyzer.
extern cmFtFileH_t cmFtFileNullHandle; ///< A NULL handle useful for indicating an uninitialized feature file.
extern cmFtH_t cmFtNullHandle; // A NULL handle useful for indicating an uninitialized analyzer.
extern cmFtFileH_t cmFtFileNullHandle; // A NULL handle useful for indicating an uninitialized feature file.
/// Given a feature type id return the associated label.
// Given a feature type id return the associated label.
const char* cmFtFeatIdToLabel( unsigned featId );
/// Given a feature type label return the associated id.
// Given a feature type label return the associated id.
unsigned cmFtFeatLabelToId( const char* label );
/// \name Feature Analyzer Related functions
///@{
// Feature Analyzer Related functions
/// Initialize the feature analyzer. The memory manager and file system must
/// be initialized (cmMdInitialize(), cmFsInitialize()) prior to calling this function.
// Initialize the feature analyzer. The memory manager and file system must
// be initialized (cmMdInitialize(), cmFsInitialize()) prior to calling this function.
cmFtRC_t cmFtInitialize( cmFtH_t* hp, cmCtx_t* ctx );
/// Finalize a feature analyzer.
// Finalize a feature analyzer.
cmFtRC_t cmFtFinalize( cmFtH_t* h );
/// Return true if the handle represents an initialized feature analyzer.
// Return true if the handle represents an initialized feature analyzer.
bool cmFtIsValid( cmFtH_t h );
/// Parse a JSON file containing a set of analysis parameters.
// Parse a JSON file containing a set of analysis parameters.
cmFtRC_t cmFtParse( cmFtH_t h, const char* cfgFn );
/// Run the analyzer.
// Run the analyzer.
cmFtRC_t cmFtAnalyze( cmFtH_t h );
/// If cmFtAnalyze() is being run in a seperate thread this function
/// can be used to access the analyzers progress.
// If cmFtAnalyze() is being run in a seperate thread this function
// can be used to access the analyzers progress.
const char* cmFtAnalyzeProgress( cmFtH_t h, unsigned* passPtr, cmReal_t* percentPtr );
///@}
/// \name Feature File Related Functions
///@{
// Feature File Related Functions
/// Open a feature file.
/// Note that inforPtrPtr is optional and will be ignored if it is set to NULL.
// Open a feature file.
// Note that inforPtrPtr is optional and will be ignored if it is set to NULL.
cmFtRC_t cmFtReaderOpen( cmFtH_t h, cmFtFileH_t* hp, const char* featFn, const cmFtInfo_t** infoPtrPtr );
/// Close a feature file.
// Close a feature file.
cmFtRC_t cmFtReaderClose( cmFtFileH_t* hp );
/// Return true if the handle reprents an open feature file.
// Return true if the handle reprents an open feature file.
bool cmFtReaderIsValid( cmFtFileH_t h );
/// Return the count of features types this file contains.
// Return the count of features types this file contains.
unsigned cmFtReaderFeatCount( cmFtFileH_t h );
/// Return the feature type id associated with the specified index.
// Return the feature type id associated with the specified index.
unsigned cmFtReaderFeatId( cmFtFileH_t h, unsigned index );
/// Reset the current file location to the first frame but do not load it.
/// The next call to cmFtReadAdvance() will load the next frame.
// Reset the current file location to the first frame but do not load it.
// The next call to cmFtReadAdvance() will load the next frame.
cmFtRC_t cmFtReaderRewind( cmFtFileH_t h );
/// Make frmIdx the current file location.
// Make frmIdx the current file location.
cmFtRC_t cmFtReaderSeek( cmFtFileH_t h, unsigned frmIdx );
/// Load the current frame, advance the current file position, and return
/// a pointer to a cmFtFrameDesc_t record for the loaded frame.
/// Returns kEofFtRC upon reaching end of file.
/// The frameDescPtr is optional.
// Load the current frame, advance the current file position, and return
// a pointer to a cmFtFrameDesc_t record for the loaded frame.
// Returns kEofFtRC upon reaching end of file.
// The frameDescPtr is optional.
cmFtRC_t cmFtReaderAdvance( cmFtFileH_t h, cmFtFrameDesc_t* frameDescPtr );
/// Returns a pointer to a data matrix in the feature identified by featId in the current feature frame.
// Returns a pointer to a data matrix in the feature identified by featId in the current feature frame.
cmReal_t* cmFtReaderData( cmFtFileH_t h, unsigned featId, unsigned* cntPtr );
/// Copy the contents of a given set of frames into buf[frmCnt*elePerFrmCnt].
// Copy the contents of a given set of frames into buf[frmCnt*elePerFrmCnt].
cmFtRC_t cmFtReaderCopy( cmFtFileH_t h, unsigned featId, unsigned frmIdx, cmReal_t* buf, unsigned frmCnt, unsigned elePerFrmCnt, unsigned* outEleCntPtr );
/// Data structure used to specify multiple features for use by cmFtReaderMultiSetup().
// Data structure used to specify multiple features for use by cmFtReaderMultiSetup().
typedef struct
{
unsigned featId; ///< Feature id of feature to include in the feature vector
unsigned cnt; ///< Set to count of feat ele's for this feat. Error if greater than avail. Set to -1 to use all avail ele's.
/// returned with actual count used
unsigned featId; // Feature id of feature to include in the feature vector
unsigned cnt; // Set to count of feat ele's for this feat. Error if greater than avail. Set to -1 to use all avail ele's.
// returned with actual count used
unsigned id0; ///< Ignored on input. Used internally by cmFtReaderXXX()
unsigned id1; ///< Ignored on input. Used internally by cmFtReaderXXX()
unsigned id0; // Ignored on input. Used internally by cmFtReaderXXX()
unsigned id1; // Ignored on input. Used internally by cmFtReaderXXX()
} cmFtMulti_t;
/// Setup an array of cmFtMulti_t records. The cmFtMulti_t array
/// used by cmFtReaderMulitData() must be initialized by this function.
// Setup an array of cmFtMulti_t records. The cmFtMulti_t array
// used by cmFtReaderMulitData() must be initialized by this function.
cmFtRC_t cmFtReaderMultiSetup( cmFtFileH_t h, cmFtMulti_t* multiArray, unsigned multiCnt, unsigned* featVectEleCntPtr );
/// Fill outV[outN] with a consecutive data from the features specified in the cmFtMulti_t array.
/// Use cmFtReaderMultiSetup() to configure the cmFtMulti_t array prior to calling this function.
// Fill outV[outN] with a consecutive data from the features specified in the cmFtMulti_t array.
// Use cmFtReaderMultiSetup() to configure the cmFtMulti_t array prior to calling this function.
cmFtRC_t cmFtReaderMultiData( cmFtFileH_t h, const cmFtMulti_t* multiArray, unsigned multiCnt, cmReal_t* outV, unsigned outN );
/// Report summary information for the specified feature.
// Report summary information for the specified feature.
cmFtRC_t cmFtReaderReport( cmFtFileH_t h, unsigned featId );
/// Identical to cmFtReaderReport() except the feature file is identified from a file name rather than an open cmFtFileH_t.
// Identical to cmFtReaderReport() except the feature file is identified from a file name rather than an open cmFtFileH_t.
cmFtRC_t cmFtReaderReportFn( cmFtH_t h, const cmChar_t* fn, unsigned featId );
/// Report feature data for the specified set of feature frames.
// Report feature data for the specified set of feature frames.
cmFtRC_t cmFtReaderReportFeature( cmFtFileH_t h, unsigned featId, unsigned frmIdx, unsigned frmCnt );
/// Write a feature into a binary file.
/// Set 'frmCnt' to the cmInvalidCnt to include all frames past frmIdx.
/// The first three unsigned values in the output file
/// contain the row count, maximum column count, and the count of bytes in each data element (4=float,8=double).
/// Each row of the file begins with the count of elements in the row and is followed by a data array.
// Write a feature into a binary file.
// Set 'frmCnt' to the cmInvalidCnt to include all frames past frmIdx.
// The first three unsigned values in the output file
// contain the row count, maximum column count, and the count of bytes in each data element (4=float,8=double).
// Each row of the file begins with the count of elements in the row and is followed by a data array.
cmFtRC_t cmFtReaderToBinary( cmFtFileH_t h, unsigned featId, unsigned frmIdx, unsigned frmCnt, const cmChar_t* outFn );
/// Identical to cmFtReaderToBinary() except it takes a feature file name instead of a file handle.
// Identical to cmFtReaderToBinary() except it takes a feature file name instead of a file handle.
cmFtRC_t cmFtReaderToBinaryFn( cmFtH_t h, const cmChar_t* fn, unsigned featId, unsigned frmIdx, unsigned frmCnt, const cmChar_t* outFn );
///@}
//)
#ifdef __cplusplus
}

View File

@ -1,3 +1,4 @@
#include "cmPrefix.h"
#include "cmGlobal.h"
#include "cmRpt.h"

View File

@ -1,9 +1,3 @@
//{
//(
// File abstraction class which slightly extends the C standard file handling routines
// to cm style error handling.
//)
//
#ifndef cmFile_h
#define cmFile_h
@ -11,7 +5,13 @@
extern "C" {
#endif
//(
//( { file_desc: "File abstraction class." kw:[file system base]}
//
// The cmFile API extends the C standard file handling routines
// with cm style error handling. All cm file input and output occurs
// through this interface."
//
enum
{
kOkFileRC = cmOkRC,
@ -244,7 +244,6 @@ extern "C" {
cmFileRC_t cmFileSetRC( cmFileH_t h, cmFileRC_t rc );
//)
//}
#ifdef __cplusplus
}

View File

@ -1,6 +1,5 @@
//{
//(
// A collection of file system utility functions.
//( { file_desc:"A collection of file system utility functions." kw:[system file]}
//
// Note that cmFileSysInitialize() creates an internal cmLHeapH_t based
// heap manager from which it allocates memory for some returned objects.
@ -242,7 +241,6 @@ extern "C" {
cmFsRC_t cmFileSysTest( cmCtx_t* ctx );
//)
//}
#ifdef __cplusplus
}

View File

@ -1,16 +1,3 @@
/// \file cmFloatTypes.h
/// \brief Declare the types cmReal_t and cmSample_t and define some useful limits.
///
/// For signal processing functions the cm library uses the types cmSample_t to indicate an audio
/// sample value and cmReal_t to specify a general purpose floating point value. The library
/// is designed in such a way that the actual type, float or double, for these two types may
/// be set at compilation time. Set the preprocessor variable CM_FLOAT_SMP to 1 to indicate
/// that cmSample_t will be of type 'float' otherwise it will be of type 'double'.
/// Set the preprocessor variable CM_FLOAT_REAL to 1 to indicate
/// that cmSample_t will be of type 'float' otherwise it will be of type 'double'.
/// By default cmSample_t is float nad cmReal_t is double.
///
#ifndef cmFloatTypes_h
#define cmFloatTypes_h
@ -19,6 +6,18 @@
extern "C" {
#endif
//( { file_desc:"Declare the types cmReal_t and cmSample_t and define some useful limits." kw:[base]}
//
// For signal processing functions the cm library uses the types cmSample_t to indicate an audio
// sample value and cmReal_t to specify a general purpose floating point value. The library
// is designed in such a way that the actual type, float or double, for these two types may
// be set at compilation time. Set the preprocessor variable CM_FLOAT_SMP to 1 to indicate
// that cmSample_t will be of type 'float' otherwise it will be of type 'double'.
// Set the preprocessor variable CM_FLOAT_REAL to 1 to indicate
// that cmSample_t will be of type 'float' otherwise it will be of type 'double'.
// By default cmSample_t is float nad cmReal_t is double.
//
//-----------------------------------------------------------------
#ifndef CM_FLOAT_SMP
#define CM_FLOAT_SMP 1
@ -26,21 +25,21 @@ extern "C" {
#if CM_FLOAT_SMP == 1
typedef float cmSample_t; ///< cmSample_t is a float
typedef float _Complex cmComplexS_t;///< cmComplexS_t is single precision.
typedef float cmSample_t; // cmSample_t is a float
typedef float _Complex cmComplexS_t;// cmComplexS_t is single precision.
#define cmSample_EPSILON FLT_EPSILON ///< Minimum increment between 1.0 and the next greaterv value. (1E-5)
#define cmSample_MAX FLT_MAX ///< Maximum representable number (1E+37).
#define cmSample_MIN FLT_MIN ///< Minimum representable number (1E-37).
#define cmSample_EPSILON FLT_EPSILON // Minimum increment between 1.0 and the next greaterv value. (1E-5)
#define cmSample_MAX FLT_MAX // Maximum representable number (1E+37).
#define cmSample_MIN FLT_MIN // Minimum representable number (1E-37).
#else
typedef double cmSample_t; ///< cmSample_t is a double
typedef double _Complex cmComplexS_t; ///< cmComplexS_t is doulbe precision.
typedef double cmSample_t; // cmSample_t is a double
typedef double _Complex cmComplexS_t; // cmComplexS_t is doulbe precision.
#define cmSample_EPSILON DBL_EPSILON ///< Minimum increment between 1.0 and the next greaterv value. (1E-9)
#define cmSample_MAX DBL_MAX ///< Maximum representable number (1E+37).
#define cmSample_MIN DBL_MIN ///< Minimum representable number (1E-37).
#define cmSample_EPSILON DBL_EPSILON // Minimum increment between 1.0 and the next greaterv value. (1E-9)
#define cmSample_MAX DBL_MAX // Maximum representable number (1E+37).
#define cmSample_MIN DBL_MIN // Minimum representable number (1E-37).
#endif
@ -54,25 +53,27 @@ extern "C" {
#if CM_FLOAT_REAL == 1
typedef float cmReal_t; ///< cmReal_t is a float
typedef float _Complex cmComplexR_t; ///< cmComplexR_t is single precision.
typedef float cmReal_t; // cmReal_t is a float
typedef float _Complex cmComplexR_t; // cmComplexR_t is single precision.
#define cmReal_EPSILON FLT_EPSILON ///< Minimum increment between 1.0 and the next greaterv value. (1E-5)
#define cmReal_MAX FLT_MAX ///< Maximum representable number (1E+37).
#define cmReal_MIN FLT_MIN ///< Minimum representable number (1E-37).
#define cmReal_EPSILON FLT_EPSILON // Minimum increment between 1.0 and the next greaterv value. (1E-5)
#define cmReal_MAX FLT_MAX // Maximum representable number (1E+37).
#define cmReal_MIN FLT_MIN // Minimum representable number (1E-37).
#else
typedef double cmReal_t; ///< cmReal_t is a double.
typedef double _Complex cmComplexR_t; ///< cmComplexR_t is double precision.
typedef double cmReal_t; // cmReal_t is a double.
typedef double _Complex cmComplexR_t; // cmComplexR_t is double precision.
#define cmReal_EPSILON DBL_EPSILON ///< Minimum increment between 1.0 and the next greaterv value (1E-9).
#define cmReal_MAX DBL_MAX ///< Maximum representable number (1E+37).
#define cmReal_MIN DBL_MIN ///< Minimum representable number (1E-37).
#define cmReal_EPSILON DBL_EPSILON // Minimum increment between 1.0 and the next greaterv value (1E-9).
#define cmReal_MAX DBL_MAX // Maximum representable number (1E+37).
#define cmReal_MIN DBL_MIN // Minimum representable number (1E-37).
#endif
//)
#ifdef __cplusplus
}
#endif

View File

@ -1031,7 +1031,7 @@ cmFfRC_t cmFrameFileFrameCreate( cmFrameFileH_t h, unsigned frameType, unsigned
p->frame.f.mtxCnt = 0;
p->frame.f.streamId = streamId;
p->frame.f.flags = flags;
p->frame.f.time.seconds = 0;
p->frame.f.tm.seconds = 0;
return rc;
}
@ -1327,10 +1327,10 @@ cmFfRC_t cmFrameFileFrameNext( cmFrameFileH_t h, unsigned keyFrameTypeId, unsign
return rc;
if( cmIsFlag(p->frame.f.flags,kSampleIdxTimeFl) )
p->frame.f.time.sampleIdx = sampleIdx;
p->frame.f.tm.sampleIdx = sampleIdx;
if( cmIsFlag(p->frame.f.flags,kSecondsTimeFl) )
p->frame.f.time.seconds = seconds;
p->frame.f.tm.seconds = seconds;
return rc;

View File

@ -1,16 +1,17 @@
#ifndef cmFrameFile_h
#define cmFrameFile_h
/*
file -> cmFfFile_t frame*
frame -> cmFfFrame_t mtx*
mtx -> cmFfMtx_t data*
*/
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"File reader and writer for time series data as used by cmFeatFile" kw:[file audio]}
//
// file -> cmFfFile_t frame*
// frame -> cmFfFrame_t mtx*
// mtx -> cmFfMtx_t data*
//
enum
{
@ -139,7 +140,7 @@ extern "C" {
{
unsigned sampleIdx;
double seconds;
} time;
} tm;
} cmFfFrame_t;
@ -353,6 +354,8 @@ extern "C" {
#define kRealFmtId kDoubleFmtId
#endif
//)
#ifdef __cplusplus
}
#endif

View File

@ -1,15 +1,14 @@
//{
//(
// cmGlobal.h contains the global macros, header files, and
// typedefs availale to all other cm modules.
#ifndef cmGlobal_h
#define cmGlobal_h
//( { file_desc:"This is the globally included prefix file for all 'cm' files." kw:[base] }
//
// All operating system dependencies should be resolved in this file via
// testing for OS_LINUX, OS_OSX, or OS_W32.
//)
#ifndef cmGlobal_h
#define cmGlobal_h
//(
#include "config.h" // created by 'configure'
#include <stdio.h>
@ -150,6 +149,5 @@ extern "C" {
#endif
//)
//}
#endif

View File

@ -1,6 +1,12 @@
#ifndef cmGnuPlot_h
#define cmGnuPlot_h
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Interface to GNU Plot." kw:[plot]}
enum
{
kOkPlRC,
@ -99,4 +105,10 @@ cmRC_t cmPlotDraw();
cmRC_t cmPlotPrint( bool printDataFl );
cmRC_t cmPlotDrawAndPrint( bool printDataFl );
//)
#ifdef __cplusplus
}
#endif
#endif

2
cmGr.h
View File

@ -5,6 +5,7 @@
extern "C" {
#endif
//( { file_desc:"Low level device independent API for descibing interactive graphics objects." kw:[plot] }
enum
{
kAliceBlueGrId = 0xf0f8ff,
@ -867,6 +868,7 @@ extern "C" {
void cmGrReport( cmGrH_t h, cmRpt_t* rpt );
//)
#ifdef __cplusplus
}

View File

@ -4,6 +4,7 @@
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Device independent graphics context object used by cmGr." kw:[plot]}
enum
{
@ -195,6 +196,8 @@ extern "C" {
// Is any of the rectangle visible in this drawing context.
bool cmGrDcRectIsVisible( cmGrDcH_t h, const cmGrPExt_t* r );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Device independent plotting window with one or more plot views." kw:[plot]}
enum
{
kHashMarkGrFl = 0x10,
@ -74,6 +76,10 @@ extern "C" {
const cmChar_t* cmGrPageLabelFuncLabel( cmGrPgH_t h, unsigned id );
void* cmGrPageLabelFuncArg( cmGrPgH_t h, unsigned id );
//----------------------------------------------------------------------------
//)
//( { label:cmGrView file_desc:"Device independent plotting view." kw:[plot]}
//
// Get a view handle from the view index.
cmGrVwH_t cmGrPageViewHandle( cmGrPgH_t h, unsigned vwIdx );
@ -136,6 +142,11 @@ extern "C" {
// Get an axis handle.
cmGrAxH_t cmGrViewAxisHandle( cmGrVwH_t h, cmGrAxisIdx_t axisIdx );
//----------------------------------------------------------------------------
//)
//( { label:cmGrAxis file_desc:"Device independent plotting axis." kw:[plot]}
//
bool cmGrAxisIsValid( cmGrAxH_t h );
// kHashMarkGrFl | kHashLabelGrFl
void cmGrAxisSetCfg( cmGrAxH_t h, unsigned cfgFlags );
@ -161,6 +172,8 @@ extern "C" {
// or cmGrPageLabelFuncIndexToId().
void cmGrAxisSetLabelFunc( cmGrAxH_t h, unsigned pgLabelFuncId );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Device indenpendent, multi-axis, interactive, plotting system based on cmGrPage, cmGrAxis and cmGr." kw:[plot]}
enum
{
kOkGrPlRC,
@ -229,6 +231,7 @@ extern "C" {
// Set the default object callback and arg.
void cmGrPlotSetCb( cmGrPlH_t h, cmGrPlotCbFunc_t func, void* arg );
//)
#ifdef __cplusplus
}

View File

@ -6,12 +6,15 @@
extern "C" {
#endif
//( { file_desc:"Override a cmGrPlotObj to make an efficient audio plot object." kw:[plot audio]}
cmGrPlRC_t cmGrPlotAudioFileObjCreate(
cmGrPlObjH_t oH,
cmAfmFileH_t afH,
unsigned audioChIdx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Hash table for storing arbitary data blobs." kw:[container]}
enum
{
kOkHtRC,
@ -60,6 +62,8 @@ extern "C" {
cmHtRC_t cmHashTblTest( cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,8 +5,8 @@
#ifdef __cplusplus
extern "C" {
#endif
//{
//(
//( { file_desc: "JSON reader and writer" kw:[file] }
//
// Limitations:
//
@ -501,7 +501,6 @@ extern "C" {
cmJsRC_t cmJsonTest( const char* fn, cmCtx_t* ctx );
//)
//}
#ifdef __cplusplus
}

View File

@ -1,6 +1,11 @@
#ifndef cmKeyboard_h
#define cmKeyboard_h
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Query and get keypresses directly from the console." kw:[system] }
enum
{
@ -19,10 +24,6 @@ enum
};
typedef struct
{
unsigned code;
@ -63,4 +64,10 @@ void cmKeyPress( cmKbRecd* p );
// cmSetStdinLineBuffering(org_state)
int cmIsKeyWaiting();
//)
#ifdef __cplusplus
extern "C" {
#endif
#endif

View File

@ -1,11 +1,8 @@
#ifndef cmLex_h
#define cmLex_h
//{
//(
//)
//(
//( { file_desc:"User configurable lexer for tokenizing text files." kw:[text]}
// Predefined Lexer Id's
@ -158,6 +155,5 @@ const cmChar_t* cmLexRcToMsg( unsigned rc );
void cmLexTest( cmRpt_t* rpt );
//)
//}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Manage shared-libraries and query them for known symbols." kw:[system]}
enum
{
kOkLibRC = cmOkRC,
@ -54,7 +56,7 @@ extern "C" {
// Return the libraries file name.
const cmChar_t* cmLibName( cmLibH_t h, unsigned libId );
//)
#ifdef __cplusplus
}

View File

@ -141,7 +141,7 @@ bool _cmLHeapFree( cmLHeap_t* lhp, void* dataPtr )
lbp->nextPtr = (char*)allocPtr; // ... then make it the space to alloc
else
lbp->freeCnt += *allocPtr; // ... otherwise increase the free count
//(freeCnt tracks unused space that is not at the end of the block and therefore cannot be reused.)
// freeCnt tracks unused space that is not at the end of the block and therefore cannot be reused.
// if all the space for this block has been freed then the
// next space to allocate must be at the base

View File

@ -5,8 +5,18 @@
extern "C" {
#endif
//{
//( { file_desc:"Implements a block based memory heap manager." kw:[base]}
//
// There are two advantages to using this memory manager over the cmMallocDebug
// manager. It alleviates memory fragmentation by pre-allocating large blocks of memory
// which are then used to fullfill many small memory requests. Second it can
// act as a garbage collector by releasing all the memory it is managing at once.
// This can reduce code complexity by eliminating for a class instance to release internally
// allocated objects.
//)
//(
typedef cmHandle_t cmLHeapH_t;
extern cmLHeapH_t cmLHeapNullHandle;
@ -84,7 +94,6 @@ extern "C" {
#endif
//)
//}
#ifdef __cplusplus
}

View File

@ -1,3 +1,5 @@
//( { file_desc:"Template 'main.c' for 'libcm' based program" kw:[demo]}
#include "cmGlobal.h"
#include "cmRpt.h"
#include "cmMem.h"
@ -31,3 +33,5 @@ int main(int argc, char* argv[] )
cmMdFinalize();
return 0;
}
//)

View File

@ -1,6 +1,11 @@
//{ { label:cmMd }
//(
// Implements an extended memory allocation and tracking manager.
#ifndef cmMallocDebug_h
#define cmMallocDebug_h
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Implements an extended memory allocation and tracking manager." kw:[base] }
//
// cmMallocDebug is a wrapper to cmMem.h for calls to malloc() and free().
// Most of the cmMdXXX() calls are directly associated with same named
@ -8,15 +13,8 @@
// cmMm object where malloc() and free() are the callback functions
// provided to cmMmInitialize().
//
//)
//
#ifndef cmMallocDebug_h
#define cmMallocDebug_h
#ifdef __cplusplus
extern "C" {
#endif
//(
// Initialize the malloc debug manager. guardByteCnt, alignByteeCnt, flags, and rpt
// are used to initialize an internal cmMm object. See cmMm for their semantics.
cmMmRC_t cmMdInitialize( unsigned guardByteCnt, unsigned alignByteCnt, unsigned flags, cmRpt_t* rptPtr );
@ -165,6 +163,4 @@ extern "C" {
#endif
//}
#endif

View File

@ -1,6 +1,12 @@
#ifndef cmMath_h
#define cmMath_h
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Math utility functions" kw:[math] }
double cmX80ToDouble( unsigned char s[10] );
void cmDoubleToX80( double v, unsigned char s[10] );
@ -117,4 +123,10 @@ bool cmLFSR_Test();
// Returns false if insufficient balanced pairs exist.
bool cmGenGoldCodes( unsigned lfsrN, unsigned poly_coeff0, unsigned poly_coeff1, unsigned goldN, int* yM, unsigned mlsN );
//)
#ifdef __cplusplus
}
#endif
#endif

10
cmMem.h
View File

@ -1,6 +1,4 @@
//{
//(
// The cmMem class implements a memory allocation manager interface.
//( { file_desc: "Implements a memory allocation manager interface." kw:[ base ]}
//
//
// Using cmMem allows memory leaks and some instances of memory corruption
@ -20,12 +18,15 @@
// As part of the configuration the client gives callback functions which implement
// actual memory allocation and release. In practice this means the callback probably
// call malloc() or free().
//
// 2. At some point later when the client needs to allocate a block of memory it calls
// cmMmAllocate() with the size of the requested block. cmMm translates this request
// into a call to the client provided memory allocation callback to get a block of raw
// memory which is slightly larger than the request block.
//
// 3. Given the raw memory block cmMm conditions it in the following ways and returns
// it to the client.
//
// * The base of the blocks data area is shifted such that it is has an arbitrary
// address aligned according to the value set by the alignByteCnt parameter to cmMmInitialize().
// Address aligment is sometimes required by routines which make use of the the SIMD
@ -54,9 +55,11 @@
// writes to freed memory areas. When deferred release is enabled the freeFunc() is not called
// on any blocks until cmMmFinalize(). If the program continually allocates memory over the
// life of the program this may mean that the program will eventually exhaust physical memory.
//
// 2. If tracking is enabled (kTrackMmFl) then the block pointer is looked up in the internal database.
// If the pointer is not found then a kMissingRecdRC is returned indicating an attempt to release
// a non-allocated block.
//
// 3. If tracking is enabled (kTrackMmFl) then the block is marked as released in the
// internal tracking database. At the end of the program all blocks should be marked for release
// otherwise they are considered leaks.
@ -223,7 +226,6 @@ extern "C" {
cmMmRC_t cmMmCheckAllGuards( cmMmH_t h );
//)
//}
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"MIDI utility constants and functions." kw:[midi]}
enum
{
kMidiChCnt = 16,
@ -154,6 +156,8 @@ extern "C" {
// of this range will be returned as kInvalidMidiPitch.
cmMidiByte_t cmSciPitchToMidi( const char* sciPitchStr );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,7 @@
extern "C" {
#endif
//( { file_desc:"MIDI file reader and writer." kw:[midi file]}
// MIDI file timing:
// Messages in the MIDI file are time tagged with a delta offset in 'ticks'
// from the previous message in the same track.
@ -22,9 +23,9 @@ extern "C" {
//
// As part of the file reading process, the status byte of note-on messages
// with velocity=0 are is changed to a note-off message. See _cmMidiFileReadChannelMsg().
//)
//(
typedef cmHandle_t cmMidiFileH_t;
typedef unsigned cmMfRC_t;
@ -175,6 +176,8 @@ extern "C" {
bool cmMidiFileIsNull( cmMidiFileH_t h );
void cmMidiFileTest( const char* fn, cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Device indepenent MIDI file player." kw:[midi]}
typedef cmHandle_t cmMfpH_t;
typedef cmRC_t cmMfpRC_t;
@ -52,6 +54,8 @@ cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx );
cmRC_t cmMfpTest2( const char* midiFn, const char* audioFn, cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Device independent MIDI port related code." kw:[midi]}
typedef unsigned cmMpRC_t;
// Flags used to identify input and output ports on MIDI devices
@ -31,6 +33,8 @@ extern "C" {
typedef void (*cmMpCallback_t)( const cmMidiPacket_t* pktArray, unsigned pktCnt );
//)
//( { label:cmMpParser file_desc:"MIDI event parser converts raw MIDI events into cmMidiPacket_t messages." kw:[midi]}
//===============================================================================================
// MIDI Parser
@ -62,6 +66,8 @@ extern "C" {
// Returns true if the parser uses the given callback.
bool cmMpParserHasCallback( cmMpParserH_t h, cmMpCallback_t cbFunc, void* cbDataPtr );
//)
//( { label:cmMidiPort file_desc:"Device independent MIDI port." kw:[midi]}
//===============================================================================================
// MIDI Device Interface
@ -92,6 +98,7 @@ extern "C" {
void cmMpReport( cmRpt_t* rpt );
void cmMpTest( cmCtx_t* ctx );
//)
#ifdef __cplusplus
}

View File

@ -7,6 +7,7 @@
extern "C" {
#endif
//( { file_desc:"Global constants and data structures for transmiting messages between threads and network nodes.", kw:[real_time]}
#define cmAudDspSys_FILENAME "aud_dsp.js"
@ -134,6 +135,8 @@ extern "C" {
cmMsgRC_t cmMsgPeekInstId( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
cmMsgRC_t cmMsgPeekInstVarId( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
//)
#ifdef __cplusplus
}
#endif

View File

@ -1,8 +1,8 @@
#ifndef cmPgmOpts_h
#define cmPgmOpts_h
//{
//(
//( { file_desc:"Command line argument description and parsing API." kw:[base]}
//
// Command line program option syntax:
//
//
@ -206,7 +206,6 @@ extern "C" {
void cmPgmOptPrintParms( cmPgmOptH_t h, cmRpt_t* rpt );
//)
//}
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Manage persistent application preferences." kw:[base] }
typedef unsigned cmPrRC_t;
typedef cmHandle_t cmPrH_t;
@ -188,6 +190,7 @@ extern "C" {
void cmPrefsTest( cmCtx_t* ctx, const char* ifn, const char* ofn );
//)
#ifdef __cplusplus
}

244
cmProc.h
View File

@ -5,7 +5,10 @@
extern "C" {
#endif
//------------------------------------------------------------------------------------------------------------
//( { file_desc:"Processor Library 1" kw:[proclib]}
//)
//( { label:cmAudioFileRd file_desc:"Audio file reader based on cmAudioFile" kw:[proc] }
typedef struct
{
cmObj obj;
@ -23,28 +26,30 @@ extern "C" {
cmMtxFile* mfp;
} cmAudioFileRd;
/// set p to NULL to dynamically allocate the object
/// fn and chIdx are optional - set fn to NULL to allocate the reader without opening a file.
/// If fn is valid then chIdx must also be valid.
/// Set 'endSmpIdx' to cmInvalidIdx to return the entire signal in cmAudioFileRdRead().
/// Set 'endSmpIdx' to 0 to return all samples between 0 and the end of the file.
// set p to NULL to dynamically allocate the object
// fn and chIdx are optional - set fn to NULL to allocate the reader without opening a file.
// If fn is valid then chIdx must also be valid.
// Set 'endSmpIdx' to cmInvalidIdx to return the entire signal in cmAudioFileRdRead().
// Set 'endSmpIdx' to 0 to return all samples between 0 and the end of the file.
cmAudioFileRd* cmAudioFileRdAlloc( cmCtx* c, cmAudioFileRd* p, unsigned procSmpCnt, const char* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx );
cmRC_t cmAudioFileRdFree( cmAudioFileRd** p );
cmRC_t cmAudioFileRdOpen( cmAudioFileRd* p, unsigned procSmpCnt, const cmChar_t* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx );
cmRC_t cmAudioFileRdClose( cmAudioFileRd* p );
/// Returns cmEofRC if the end of file is encountered.
// Returns cmEofRC if the end of file is encountered.
cmRC_t cmAudioFileRdRead( cmAudioFileRd* p );
cmRC_t cmAudioFileRdSeek( cmAudioFileRd* p, unsigned frmIdx );
/// Find the overall minimum, maximum, and mean sample values without changing the current file location.
// Find the overall minimum, maximum, and mean sample values without changing the current file location.
cmRC_t cmAudioFileRdMinMaxMean( cmAudioFileRd* p, unsigned chIdx, cmSample_t* minPtr, cmSample_t* maxPtr, cmSample_t* meanPtr );
//)
//( { label:cmShiftBuf file_desc:"Audio shift buffer processor" kw:[proc] }
//------------------------------------------------------------------------------------------------------------
/// The buffer is intended to synchronize sample block rates between processes and to provide an overlapped
/// input buffer.
// The buffer is intended to synchronize sample block rates between processes and to provide an overlapped
// input buffer.
typedef struct cmShiftBuf_str
{
cmObj obj;
@ -61,89 +66,36 @@ extern "C" {
/// Set p to NULL to dynamically allocate the object. hopSmpCnt must be <= wndSmpCnt.
// Set p to NULL to dynamically allocate the object. hopSmpCnt must be <= wndSmpCnt.
cmShiftBuf* cmShiftBufAlloc( cmCtx* c, cmShiftBuf* p, unsigned procSmpCnt, unsigned wndSmpCnt, unsigned hopSmpCnt );
cmRC_t cmShiftBufFree( cmShiftBuf** p );
cmRC_t cmShiftBufInit( cmShiftBuf* p, unsigned procSmpCnt, unsigned wndSmpCnt, unsigned hopSmpCnt );
cmRC_t cmShiftBufFinal( cmShiftBuf* p );
/// Returns true if a new hop is ready to be read otherwise returns false.
/// In general cmShiftBufExec() should be called in a loop until it returns false.
/// Note that 'sp' and 'sn' are ignored except for the first call after the function returns false.
/// This means that when called in a loop 'sp' and 'sn' are only used on the first time through the loop.
/// When procSmpCnt is less than hopSmpCnt the loop will only execute when at least wndSmpCnt
/// new samples have been buffered.
/// When procSmpCnt is greater than hopSmpCnt the loop will execute multiple times until less
// Returns true if a new hop is ready to be read otherwise returns false.
// In general cmShiftBufExec() should be called in a loop until it returns false.
// Note that 'sp' and 'sn' are ignored except for the first call after the function returns false.
// This means that when called in a loop 'sp' and 'sn' are only used on the first time through the loop.
// When procSmpCnt is less than hopSmpCnt the loop will only execute when at least wndSmpCnt
// new samples have been buffered.
// When procSmpCnt is greater than hopSmpCnt the loop will execute multiple times until less
// than wndSmpCnt new samples are available.
/// Note that 'sn' must always be less than or equal to procSmpCnt.
///
/// Example:
/// while( fill(sp,sn) ) // fill sp[] with sn samples
/// {
/// // shift by hopSmpCnt samples on all passes - insert new samples on first pass
/// while( cmShiftBufExec(p,sp,sn) )
/// proc(p->outV,p->outN); // process p->outV[wndSmpCnt]
/// }
// Note that 'sn' must always be less than or equal to procSmpCnt.
//
// Example:
// while( fill(sp,sn) ) // fill sp[] with sn samples
// {
// // shift by hopSmpCnt samples on all passes - insert new samples on first pass
// while( cmShiftBufExec(p,sp,sn) )
// proc(p->outV,p->outN); // process p->outV[wndSmpCnt]
// }
bool cmShiftBufExec( cmShiftBuf* p, const cmSample_t* sp, unsigned sn );
void cmShiftBufTest( cmCtx* c );
//------------------------------------------------------------------------------------------------------------
/*
typedef struct
{
cmComplexS_t* complexV;
cmSample_t* outV;
cmFftPlanS_t plan;
} cmIFftObjS;
//)
typedef struct
{
cmComplexR_t* complexV;
cmReal_t* outV;
cmFftPlanR_t plan;
} cmIFftObjR;
typedef struct
{
cmObj obj;
unsigned binCnt;
unsigned outN;
union
{
cmIFftObjS sr;
cmIFftObjR rr;
}u;
} cmIFft;
cmIFft* cmIFftAllocS( cmCtx* c, cmIFft* p, unsigned binCnt );
cmIFft* cmIFftAllocR( cmCtx* c, cmIFft* p, unsigned binCnt );
cmRC_t cmIFftFreeS( cmIFft** pp );
cmRC_t cmIFftFreeR( cmIFft** pp );
cmRC_t cmIFftInitS( cmIFft* p, unsigned binCnt );
cmRC_t cmIFftInitR( cmIFft* p, unsigned binCnt );
cmRC_t cmIFftFinalS( cmIFft* p );
cmRC_t cmIFftFinalR( cmIFft* p );
// x must contain 'binCnt' elements.
cmRC_t cmIFftExecS( cmIFft* p, cmComplexS_t* x );
cmRC_t cmIFftExecR( cmIFft* p, cmComplexR_t* x );
cmRC_t cmIFftExecPolarS( cmIFft* p, const cmReal_t* magV, const cmReal_t* phsV );
cmRC_t cmIFftExecPolarR( cmIFft* p, const cmReal_t* magV, const cmReal_t* phsV );
cmRC_t cmIFftExecRectS( cmIFft* p, const cmReal_t* rV, const cmReal_t* iV );
cmRC_t cmIFftExecPolarR( cmIFft* p, const cmReal_t* magV, const cmReal_t* phsV );
void cmIFftTest( cmRpt_t* rptFuncPtr );
*/
//------------------------------------------------------------------------------------------------------------
//( { label:cmWindowFunc file_desc:"Fourier Transform window function generator." kw:[proc]}
enum
{
@ -174,8 +126,8 @@ extern "C" {
cmMtxFile* mfp;
} cmWndFunc;
/// Set p to NULL to dynamically allocate the object
/// if wndId is set to a valid value this function will internally call cmWndFuncInit()
// Set p to NULL to dynamically allocate the object
// if wndId is set to a valid value this function will internally call cmWndFuncInit()
cmWndFunc* cmWndFuncAlloc( cmCtx* c, cmWndFunc* p, unsigned wndId, unsigned wndSmpCnt, double kaierSideLobeRejectDb );
cmRC_t cmWndFuncFree( cmWndFunc** pp );
cmRC_t cmWndFuncInit( cmWndFunc* p, unsigned wndId, unsigned wndSmpCnt, double kaiserSideLobeRejectDb );
@ -184,9 +136,11 @@ extern "C" {
void cmWndFuncTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
//------------------------------------------------------------------------------------------------------------
/// Spectral frame delay. A circular buffer for spectral (or other fixed length) vectors.
//)
//( { label:cmSpecDelay file_desc:"Spectral frame delay. A circular buffer for spectral (or other fixed length) vectors." kw:[proc]}
typedef struct
{
cmObj obj;
@ -197,24 +151,25 @@ extern "C" {
} cmSpecDelay;
/// Set p to NULL to dynamically allocate the object.
/// Allocate a spectral frame delay capable of delaying for 'maxDelayCnt' hops and
/// where each vector contains 'binCnt' elements.
// Set p to NULL to dynamically allocate the object.
// Allocate a spectral frame delay capable of delaying for 'maxDelayCnt' hops and
// where each vector contains 'binCnt' elements.
cmSpecDelay* cmSpecDelayAlloc( cmCtx* c, cmSpecDelay* p, unsigned maxDelayCnt, unsigned binCnt );
cmRC_t cmSpecDelayFree( cmSpecDelay** p );
cmRC_t cmSpecDelayInit( cmSpecDelay* p, unsigned maxDelayCnt, unsigned binCnt );
cmRC_t cmSpecDelayFinal(cmSpecDelay* p );
/// Give an input vector to the delay. 'sn' must <= binCnt
// Give an input vector to the delay. 'sn' must <= binCnt
cmRC_t cmSpecDelayExec( cmSpecDelay* p, const cmSample_t* sp, unsigned sn );
/// Get a pointer to a delayed vector. 'delayCnt' indicates the length of the delay in hops.
/// (e.g. 1 is the previous hop, 2 is two hops previous, ... )
// Get a pointer to a delayed vector. 'delayCnt' indicates the length of the delay in hops.
// (e.g. 1 is the previous hop, 2 is two hops previous, ... )
const cmSample_t* cmSpecDelayOutPtr(cmSpecDelay* p, unsigned delayCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmFilter file_desc:"General purpose, LTI, Octave compatible, filter." kw:[proc] }
typedef struct cmFilter_str
{
cmObj obj;
@ -257,9 +212,10 @@ extern "C" {
void cmFilterTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
void cmFilterFilterTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmComplexDetect file_desc:"Complex domain onset detection function." kw:[proc] }
typedef struct
{
cmObj obj;
@ -271,14 +227,16 @@ extern "C" {
//unsigned cdfSpRegId;
} cmComplexDetect;
/// Set p to NULL to dynamically allocate the object.
// Set p to NULL to dynamically allocate the object.
cmComplexDetect* cmComplexDetectAlloc(cmCtx* c, cmComplexDetect* p, unsigned binCnt );
cmRC_t cmComplexDetectFree( cmComplexDetect** pp);
cmRC_t cmComplexDetectInit( cmComplexDetect* p, unsigned binCnt );
cmRC_t cmComplexDetectFinal(cmComplexDetect* p);
cmRC_t cmComplexDetectExec( cmComplexDetect* p, const cmSample_t* magV, const cmSample_t* phsV, unsigned binCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmComplexOnset file_desc:"Complex onset detection function" kw:[proc]}
typedef struct
{
cmObj obj;
@ -298,8 +256,10 @@ extern "C" {
cmRC_t cmComplexOnsetFinal( cmComplexOnset* p);
cmRC_t cmComplexOnsetExec( cmComplexOnset* p, cmSample_t cdf );
cmRC_t cmComplexOnsetCalc( cmComplexOnset* p );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmMfcc file_desc:"Mel Frequency Cepstral Coefficient (MFCC) measurement function." kw:[proc] }
typedef struct
{
cmObj obj;
@ -321,8 +281,10 @@ extern "C" {
cmRC_t cmMfccExecPower( cmMfcc* p, const cmReal_t* magPowV, unsigned binCnt );
cmRC_t cmMfccExecAmplitude( cmMfcc* p, const cmReal_t* magAmpV, unsigned binCnt );
void cmMfccTest();
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmSones file_desc:"Sones measurement function." kw:[proc] }
typedef struct
{
cmObj obj;
@ -350,8 +312,10 @@ extern "C" {
cmRC_t cmSonesExec( cmSones* p, const cmReal_t* magPowV, unsigned binCnt );
void cmSonesTest();
//------------------------------------------------------------------------------------------------------------
//)
//( { label: cmAudioOffsetScale file_desc:"Audio signal pre-processing normalizer." kw:[proc] }
typedef struct
{
cmObj obj;
@ -371,15 +335,15 @@ extern "C" {
} cmAudioOffsetScale;
/// This processor adds an offset to an audio signal and scales into dB (SPL) using one of two techniques
/// 1) Measures the effective sound pressure (via RMS) and then scales the signal to the reference dB (SPL)
/// In this case dBref is commonly set to 70. See Timony, 2004, Implementing Loudness Models in Matlab.
///
/// 2) treats the dBref as the maximum dB (SPL) and scales the signal by this amount without regard
/// measured signal level. In this case dBref is commonly set to 96 (max. dB (SPL) value for 16 bits)
/// and rmsWndSecs is ignored.
///
/// Note that setting rmsWndSecs to zero has the effect of using procSmpCnt as the window length.
// This processor adds an offset to an audio signal and scales into dB (SPL) using one of two techniques
// 1) Measures the effective sound pressure (via RMS) and then scales the signal to the reference dB (SPL)
// In this case dBref is commonly set to 70. See Timony, 2004, Implementing Loudness Models in Matlab.
//
// 2) treats the dBref as the maximum dB (SPL) and scales the signal by this amount without regard
// measured signal level. In this case dBref is commonly set to 96 (max. dB (SPL) value for 16 bits)
// and rmsWndSecs is ignored.
//
// Note that setting rmsWndSecs to zero has the effect of using procSmpCnt as the window length.
enum { kNoAudioScaleFl=0x01, kRmsAudioScaleFl=0x02, kFixedAudioScaleFl=0x04 };
@ -388,8 +352,10 @@ extern "C" {
cmRC_t cmAudioOffsetScaleInit( cmAudioOffsetScale* p, unsigned procSmpCnt, double srate, cmSample_t offset, double rmsWndSecs, double dBref, unsigned flags );
cmRC_t cmAudioOffsetScaleFinal( cmAudioOffsetScale* p );
cmRC_t cmAudioOffsetScaleExec( cmAudioOffsetScale* p, const cmSample_t* sp, unsigned sn );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmSpecMeas file_desc:"Measure a signals RMS, High-Frequency Content, Spectral Centroid, and Spectral Spread." kw:[proc]}
typedef struct
{
cmObj obj;
@ -422,10 +388,10 @@ extern "C" {
unsigned ssSpRegId;
} cmSpecMeas;
/// Set wndFrmCnt to the number of spectral frames to take the measurement over.
/// Setting wndFrmCnt to 1 has the effect of calculating the value on the current frame only.
/// Set flags = kWholeSigSpecMeasFl to ignore wndFrmCnt and calculate the result on the entire signal.
/// In effect this treats the entire signal as the length of the measurement window.
// Set wndFrmCnt to the number of spectral frames to take the measurement over.
// Setting wndFrmCnt to 1 has the effect of calculating the value on the current frame only.
// Set flags = kWholeSigSpecMeasFl to ignore wndFrmCnt and calculate the result on the entire signal.
// In effect this treats the entire signal as the length of the measurement window.
enum { kWholeSigSpecMeasFl=0x00, kUseWndSpecMeasFl=0x01 };
cmSpecMeas* cmSpecMeasAlloc( cmCtx* c, cmSpecMeas* p, double srate, unsigned binCnt, unsigned wndFrmCnt, unsigned flags );
@ -433,8 +399,10 @@ extern "C" {
cmRC_t cmSpecMeasInit( cmSpecMeas* p, double srate, unsigned binCnt, unsigned wndFrmCnt, unsigned flags );
cmRC_t cmSpecMeasFinal( cmSpecMeas* p );
cmRC_t cmSpecMeasExec( cmSpecMeas* p, const cmReal_t* magPowV, unsigned binCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmSigMeas file_desc:"Measure a time domain signals zero crossing rate." kw:[proc]}
typedef struct
{
cmObj obj;
@ -456,8 +424,10 @@ extern "C" {
cmRC_t cmSigMeasInit( cmSigMeas* p, double srate, unsigned procSmpCnt, unsigned measSmpCnt );
cmRC_t cmSigMeasFinal( cmSigMeas* p );
cmRC_t cmSigMeasExec( cmSigMeas* p, const cmSample_t* sigV, unsigned smpCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmSRC file_desc:"Sample rate converter" kw:[proc] }
typedef struct
{
cmObj obj;
@ -476,7 +446,7 @@ extern "C" {
} cmSRC;
/// The srate paramater is the sample rate of the source signal provided via cmSRCExec()
// The srate paramater is the sample rate of the source signal provided via cmSRCExec()
cmSRC* cmSRCAlloc( cmCtx* c, cmSRC* p, double srate, unsigned procSmpCnt, unsigned upFact, unsigned dnFact );
cmRC_t cmSRCFree( cmSRC** pp );
cmRC_t cmSRCInit( cmSRC* p, double srate, unsigned procSmpCnt, unsigned upFact, unsigned dnFact );
@ -484,8 +454,10 @@ extern "C" {
cmRC_t cmSRCExec( cmSRC* p, const cmSample_t* sp, unsigned sn );
void cmSRCTest();
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmConstQ file_desc:"Contant-Q transform." kw:[proc] }
typedef struct
{
cmObj obj;
@ -510,9 +482,10 @@ extern "C" {
cmRC_t cmConstQInit( cmConstQ* p, double srate, unsigned minMidiPitch, unsigned maxMidiPitch, unsigned binsPerOctave, double thresh );
cmRC_t cmConstQFinal( cmConstQ* p );
cmRC_t cmConstQExec( cmConstQ* p, const cmComplexR_t* ftV, unsigned binCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmTuneHpcp file_desc:"Generate a tuned chromagram." kw:[proc]}
typedef struct
{
cmObj obj;
@ -545,10 +518,10 @@ extern "C" {
cmRC_t cmTunedHpcpFinal( cmHpcp* p );
cmRC_t cmTunedHpcpExec( cmHpcp* p, const cmComplexR_t* constQBinPtr, unsigned constQBinCnt );
cmRC_t cmTunedHpcpTuneAndFilter( cmHpcp* p);
//------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmBeatHist file_desc:"Generate a beat candidate histogram." kw:[proc]}
struct cmFftRR_str;
struct cmIFftRR_str;
@ -579,9 +552,11 @@ extern "C" {
cmRC_t cmBeatHistFinal( cmBeatHist* p );
cmRC_t cmBeatHistExec( cmBeatHist* p, cmSample_t df );
cmRC_t cmBeatHistCalc( cmBeatHist* p );
//------------------------------------------------------------------------------------------------------------
// Gaussian Mixture Model containing N Gaussian PDF's each of dimension D
//)
//( { label:cmGmm file_desc"Gaussian Mixture Model containing N Gaussian PDF's each of dimension D." kw:[proc model]}
typedef struct
{
cmObj obj;
@ -639,9 +614,11 @@ extern "C" {
void cmGmmPrint( cmGmm_t* p, bool detailsFl );
void cmGmmTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
//------------------------------------------------------------------------------------------------------------
// Continuous Hidden Markov Model
//)
//( { label:cmChmm file_desc:"Continuous Hidden Markov Model" kw:[proc model]}
typedef struct
{
cmObj obj;
@ -652,9 +629,7 @@ extern "C" {
cmReal_t* aM; // aM[ N x N] transition probability mtx
cmGmm_t** bV; // bV[ N ] observation probability mtx (array of pointers to GMM's)
cmReal_t* bM; // bM[ N,T] state-observation probability matrix
cmMtxFile* mfp;
} cmChmm_t;
// Continuous HMM consisting of stateN states where the observations
@ -706,10 +681,11 @@ extern "C" {
void cmChmmPrint( cmChmm_t* p );
void cmChmmTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
//------------------------------------------------------------------------------------------------------------
// Chord recognizer
//)
//( { label:cmChord file_desc:"HMM based chord recognizer." kw:[proc]}
typedef struct
{
@ -746,6 +722,8 @@ extern "C" {
cmRC_t cmChordFinal( cmChord* p );
void cmChordTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
//------------------------------------------------------------------------------------------------------------
//)
#ifdef __cplusplus
}

116
cmProc2.h
View File

@ -5,7 +5,11 @@
extern "C" {
#endif
//------------------------------------------------------------------------------------------------------------
//( { file_desc:"Processor Library 2" kw:[proclib]}
//)
//( { label:cmArray file_desc:"Expandable array designed to work easily with the cmProcObj model" kw:[proc]}
// cmArray is an expandable array designed to work easily with the alloc/init/final/free model
// used by this library. The arrays can be safely used by using the cmArrayAllocXXX macros
// with static cmArray member fields during object allocation. cmArrayResizeXXX macros are then
@ -53,8 +57,10 @@ extern "C" {
#define cmArrayPtr( type, p ) (type*)(p)->ptr
#define cmArrayCount( p ) (p)->eleCnt
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmAudioFileWr file_desc:"Audio file writer" kw:[proc]}
typedef struct
{
cmObj obj;
@ -72,8 +78,10 @@ extern "C" {
cmRC_t cmAudioFileWrFinal( cmAudioFileWr* p );
cmRC_t cmAudioFileWrExec( cmAudioFileWr* p, unsigned chIdx, const cmSample_t* sp, unsigned sn );
void cmAudioFileWrTest();
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmMatrixBuf file_desc:"Store and recall real values in matrix form." kw:[proc]}
typedef struct
{
cmObj obj;
@ -98,6 +106,9 @@ extern "C" {
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmSigGen file_desc:"Generate periodic and noise signals." kw:[proc]}
enum
{
@ -139,6 +150,9 @@ extern "C" {
cmRC_t cmSigGenExec( cmSigGen* p );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDelay file_desc:"Fixed length audio delay." kw:[proc]}
typedef struct
{
cmObj* obj;
@ -160,8 +174,10 @@ extern "C" {
cmRC_t cmDelayAdvance( cmDelay* p, unsigned sn );
cmRC_t cmDelayExec( cmDelay* p, const cmSample_t* sp, unsigned sn, bool bypassFl );
void cmDelayTest();
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmFIR file_desc:"Finite impulse response filter." kw:[proc]}
typedef struct
{
cmObj obj;
@ -194,8 +210,9 @@ extern "C" {
void cmFIRTest1( cmCtx* ctx );
//------------------------------------------------------------------------------------------------------------
// Apply a generic function to a windowed signal with a one sample hop size.
//)
//( { label:cmFuncFilter file_desc:"Apply a generic function to a windowed signal with a one sample hop size.." kw:[proc]}
typedef cmSample_t (*cmFuncFiltPtr_t)( const cmSample_t* sp, unsigned sn, void* userPtr );
typedef struct
@ -217,8 +234,10 @@ extern "C" {
cmRC_t cmFuncFilterFinal( cmFuncFilter* p );
cmRC_t cmFuncFilterExec( cmFuncFilter* p, const cmSample_t* sp, unsigned sn );
void cmFuncFilterTest();
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDhmm file_desc:"Discrete observation HMM" kw:[proc]}
typedef struct
{
cmObj obj;
@ -245,6 +264,9 @@ extern "C" {
void cmDhmmTest();
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmConvolve file_desc:"Convolve a signal with an impulse response." kw:[proc]}
typedef struct
{
cmObj obj;
@ -285,6 +307,9 @@ extern "C" {
cmRC_t cmConvolveTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmBfcc file_desc:"Generate Bark Frequency Cepstral Coefficients from STFT frames." kw:[proc]}
typedef struct
{
cmObj obj;
@ -304,6 +329,8 @@ extern "C" {
void cmBfccTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmCepstrum file_desc:"Generate Cepstral Coefficients from STFT frames." kw:[proc]}
typedef struct
{
cmObj obj;
@ -324,7 +351,10 @@ extern "C" {
cmRC_t cmCepsFinal( cmCeps* p );
cmRC_t cmCepsExec( cmCeps* p, const cmReal_t* magV, const cmReal_t* phsV, unsigned binCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmOla file_desc:"Generate a signal from an via overlap-add." kw:[proc]}
//------------------------------------------------------------------------------------------------------------
typedef struct
{
@ -355,9 +385,10 @@ extern "C" {
cmRC_t cmOlaExecS( cmOla* p, const cmSample_t* xV, unsigned xN );
cmRC_t cmOlaExecR( cmOla* p, const cmReal_t* xV, unsigned xN );
const cmSample_t* cmOlaExecOut(cmOla* p );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmPhsToFrq file_desc:"Given STFT phase spectrum frames return the instantaneous frequency." kw:[proc]}
//------------------------------------------------------------------------------------------------------------
typedef struct
@ -380,8 +411,10 @@ extern "C" {
cmRC_t cmPhsToFrqFinal(cmPhsToFrq* p );
cmRC_t cmPhsToFrqExec( cmPhsToFrq* p, const cmReal_t* phsV );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmPvAnl file_desc:"Perform the phase-vocoder analysis stage." kw:[proc]}
enum
{
@ -420,6 +453,8 @@ extern "C" {
bool cmPvAnlExec( cmPvAnl* p, const cmSample_t* x, unsigned xN );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmPvSyn file_desc:"Perform the phase-vocoder synthesis stage." kw:[proc]}
typedef struct
{
@ -451,11 +486,10 @@ extern "C" {
cmRC_t cmPvSynExec( cmPvSyn* p, const cmReal_t* magV, const cmReal_t* phsV );
const cmSample_t* cmPvSynExecOut(cmPvSyn* p );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmMidiSynth file_desc:"Synthesis independent MIDI synthesizer control structure." kw:[proc]}
// callback selector values
enum
{
@ -532,8 +566,10 @@ extern "C" {
cmRC_t cmMidiSynthOnMidi(cmMidiSynth* p, const cmMidiPacket_t* pktArray, unsigned pktCnt );
cmRC_t cmMidiSynthExec( cmMidiSynth* p, cmSample_t** outChArray, unsigned outChCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmWtVoice file_desc:"Wavetable oscillator implementation for use with cmMidiSyn." kw:[proc]}
// state id's
enum
@ -568,6 +604,8 @@ extern "C" {
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmWtVoiceBank file_desc:"A bank of cmWtVoice oscillator for use with cmMidiSynth." kw:[proc]}
typedef struct
{
@ -596,8 +634,9 @@ extern "C" {
int cmWtVoiceBankExec( cmWtVoiceBank* p, struct cmMidiVoice_str* voicePtr, unsigned sel, cmSample_t* chArray[], unsigned chCnt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmAudioFileBuf file_desc:"Generate a signal by caching all or part of an audio file." kw:[proc]}
typedef struct
{
@ -620,8 +659,10 @@ extern "C" {
// If less than outN samples are available then the remaining samples are set to 0.
unsigned cmAudioFileBufExec( cmAudioFileBuf* p, unsigned smpIdx, cmSample_t* outV, unsigned outN, bool sumIntoOutFl );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmMDelay file_desc:"Multi-tap audio delay with feedback." kw:[proc]}
// Multi-delay. Each of the taps of this delay operates as a independent delay with feedback.
// Delay line specification.
@ -657,6 +698,9 @@ extern "C" {
void cmMDelayReport( cmMDelay* p, cmRpt_t* rpt );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmAudioSegPlayer file_desc:"Buffer and playback an arbitrary number of audio signals." kw:[proc]}
enum
{
kEnableAspFl = 0x01,
@ -696,9 +740,9 @@ extern "C" {
cmRC_t cmAudioSegPlayerEnable( cmAudioSegPlayer* p, unsigned id, bool enableFl, unsigned outSmpIdx );
cmRC_t cmAudioSegPlayerReset( cmAudioSegPlayer* p );
cmRC_t cmAudioSegPlayerExec( cmAudioSegPlayer* p, cmSample_t** outChPtr, unsigned chCnt, unsigned outSmpCnt );
//------------------------------------------------------------------------------------------------------------
//)
/*
cmReal_t (*cmCluster0DistFunc_t)( void* userPtr, const cmReal_t* v0, const cmReal_t* v1, unsigned binCnt );
@ -729,7 +773,7 @@ extern "C" {
cmRC_t cmCluster0Exec( cmCluster0* p, const cmReal_t* v, unsigned vn );
*/
//------------------------------------------------------------------------------------------------------------
//( { label:cmNmf file_desc:"Non-negative matrix factorization implementation." kw:[proc]}
typedef struct
{
cmObj obj;
@ -770,8 +814,10 @@ extern "C" {
//
cmRC_t cmNmfExec( cmNmf_t* p, const cmReal_t* v, unsigned cn );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmVectArray file_desc:"Store and recall arrays of arbitrary length numeric vectors." kw:[proc]}
// cmVectArray buffers row vectors of arbitrary length in memory.
// The buffers may then be access using the cmVectArrayGetXXX() functions.
// The entire contents of the file may be written to a file using atVectArrayWrite().
@ -943,7 +989,10 @@ extern "C" {
cmRC_t cmVectArrayFormVectColU( cmVectArray_t* p, unsigned groupIdx, unsigned groupCnt, unsigned colIdx, unsigned** vRef, unsigned* vnRef );
cmRC_t cmVectArrayTest( cmCtx* ctx, const char* fn, bool genFl );
//-----------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmWhFilt file_desc:"Spectral whitening filter." kw:[proc]}
// Spectral whitening filter.
// Based on: Klapuri, A., 2006: Multiple fundamental frequency estimation by summing
// harmonic amplitudes.
@ -967,6 +1016,9 @@ extern "C" {
cmRC_t cmWhFiltExec( cmWhFilt* p, const cmReal_t* xV, cmReal_t* yV, unsigned xyN );
//-----------------------------------------------------------------------------------------------------------------------
//)
//( { label:cmFrqTrk file_desc:"Track sinusoids from STFT frame data." kw:[proc]}
typedef enum
{
kNoStateFrqTrkId,
@ -1089,8 +1141,10 @@ extern "C" {
cmRC_t cmFrqTrkExec( cmFrqTrk* p, const cmReal_t* magV, const cmReal_t* phsV, const cmReal_t* hzV );
void cmFrqTrkPrint( cmFrqTrk* p );
//------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------
//)
//( { label:cmFbCtl file_desc:"Perform acoustic feedback control by attenuating loud sinusoid signals." kw:[proc]}
typedef struct
{
double srate;
@ -1122,7 +1176,10 @@ extern "C" {
cmRC_t cmFbCtlFinal(cmFbCtl_t* p );
cmRC_t cmFbCtlExec( cmFbCtl_t* p, const cmReal_t* xV );
//-----------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmExpander file_desc:"Expander implementation for audio dynamics processing." kw:[proc]}
typedef struct
{
@ -1148,7 +1205,11 @@ extern "C" {
cmRC_t cmExpanderFinal( cmExpander* p );
cmRC_t cmExpanderExec( cmExpander* p, cmSample_t* x, cmSample_t* y, unsigned xyN );
cmRC_t cmExpanderExecD( cmExpander* p, double* x, double* y, unsigned xyN );
//-----------------------------------------------------------------------------------------------------------------------
//)
//( { label:cmExpanderBank file_desc:"Bank of audio dynamics expanders based on cmExpander." kw:[proc]}
typedef struct
{
cmObj obj;
@ -1166,8 +1227,10 @@ extern "C" {
cmRC_t cmExpanderBankExec( cmExpanderBank* p, cmSample_t* x, unsigned bandN );
cmRC_t cmExpanderBankExecD( cmExpanderBank* p, double* x, unsigned bandN );
//-----------------------------------------------------------------------------------------------------------------------
//)
//------------------------------------------------------------------------------------------------------------
//( { label:cmSpecDist file_desc:"Spectral distortion algorithm based on non-linear transform." kw:[proc]}
enum
{
@ -1248,8 +1311,11 @@ extern "C" {
cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn );
const cmSample_t* cmSpecDistOut( cmSpecDist_t* p );
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmBinMtxFile file_desc:"Write a binary matrix which can be read by readBinFile.m." kw:[proc]}
// Write a binary matrix file in the format acceppted by the octave function readBinFile.m
typedef struct cmBinMtxFile_str
@ -1291,7 +1357,7 @@ extern "C" {
// Use cmBinMtxFileSize() to determine the buffer size prior to calling this function.
// colCntV[colCnt] is optional.
cmRC_t cmBinMtxFileRead( cmCtx_t* ctx, const cmChar_t* fn, unsigned rowCnt, unsigned colCnt, unsigned eleByteCnt, void* buf, unsigned* colCntV );
//)

View File

@ -4,6 +4,10 @@
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Processor Library 3" kw:[proclib]}
//)
//( { label:cmPitchShift file_desc:"Time-domain pitch shifter based on sample rate conversion." kw:[proc]}
typedef struct
{
@ -45,7 +49,9 @@ extern "C" {
cmRC_t cmPitchShiftFinal(cmPitchShift* p );
cmRC_t cmPitchShiftExec( cmPitchShift* p, const cmSample_t* x, cmSample_t* y, unsigned n, double shiftRatio, bool bypassFl );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmLoopRecord file_desc:"Audio interactive loop recorder." kw:[proc]}
typedef struct
{
@ -90,7 +96,9 @@ extern "C" {
cmRC_t cmLoopRecordExec( cmLoopRecord* p, const cmSample_t* x, cmSample_t* y, unsigned xn, bool bypassFl, bool recdFl, bool playFl, double ratio, double pgain, double rgain );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmGateDetector file_desc:"Detect when a signal onsets and offsets." kw:[proc]}
typedef struct
{
cmObj obj;
@ -115,8 +123,9 @@ extern "C" {
cmRC_t cmGateDetectFinal(cmGateDetect* p );
cmRC_t cmGateDetectExec( cmGateDetect* p, const cmSample_t* x, unsigned xn );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmGateDetector2 file_desc:"Improved gate detector to detect when a signal onsets and offsets." kw:[proc]}
typedef struct
{
unsigned medCnt; // length of the median filter
@ -171,7 +180,10 @@ extern "C" {
void cmGateDetectSetOnThreshDb2( cmGateDetect2* p, cmReal_t db );
void cmGateDetectSetOffThreshDb2( cmGateDetect2* p, cmReal_t db );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmAutoGain file_desc:"Automatically balance a set of audio signals by adjusting their level." kw:[proc fluxo]}
//
// Calculate a set of automatic gain adjustments for a set of audio channels.
@ -230,7 +242,10 @@ extern "C" {
void cmAutoGainPrint( cmAutoGain* p, cmRpt_t* rpt );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmChCfg file_desc:"Configure a 'fluxo' pickup channel." kw:[proc fluxo]}
typedef struct
{
unsigned ch;
@ -262,7 +277,10 @@ extern "C" {
unsigned cmChCfgChannelCount( cmCtx_t* ctx, const cmChar_t* fn, unsigned* nsChCntPtr );
unsigned cmChCfgChannelIndex( cmCtx_t* ctx, const cmChar_t* fn, unsigned chIdx );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmChordDetector file_desc:"Chord detector based on evaluating signals from cmGateDetector2." kw:[proc]}
typedef struct
{
@ -293,7 +311,10 @@ extern "C" {
cmRC_t cmChordDetectExec( cmChordDetect* p, unsigned procSmpCnt, const bool* gateV, const cmReal_t* rmsV, unsigned chCnt );
cmRC_t cmChordDetectSetSpanMs( cmChordDetect* p, cmReal_t maxTimeSpanMs );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmXfader file_desc:"Audio cross fade controller." kw:[proc]}
// This object is not really a cross-fader. It is really just a multichannel
// fader - which just calculates the fade gain but does not actually apply it
// to the audio signal - unless you use cmXfaderExecAudio()
@ -335,7 +356,10 @@ extern "C" {
void cmXfaderAllOff( cmXfader* p );
void cmXfaderJumpToDestinationGain( cmXfader* p ); // jump to dest. gain based on gate state
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmFader file_desc:"Fade in/out an audio signal based on the state of a gate control signal." kw:[proc]}
// This fader object accepts a gate signal. When the gate is high it increments
// the gain until it reaches 1.0. When the gate is low it decrements the gain
// until it reaches 0.0. The fade time is the lenght of time the gain will take
@ -355,7 +379,10 @@ extern "C" {
cmRC_t cmFaderExec( cmFader* p, unsigned procSmpCnt, bool gateFl, bool mixFl, const cmSample_t* x, cmSample_t* y );
void cmFaderSetFadeTime( cmFader* p, cmReal_t fadeTimeMs );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmCombFilt file_desc:"Comb and Inverse Comb filter algorithm with a variable fractional delay." kw:[proc]}
struct cmIDelay_str;
typedef struct
{
@ -384,7 +411,10 @@ extern "C" {
void cmCombFiltSetAlpha( cmCombFilt* p, cmReal_t alpha );
cmRC_t cmCombFiltSetHz( cmCombFilt* p, cmReal_t hz );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDcFilt file_desc:"DC Filter algorithm." kw:[proc]}
typedef struct
{
@ -402,9 +432,10 @@ extern "C" {
cmRC_t cmDcFiltFinal( cmDcFilt* p );
cmRC_t cmDcFiltExec( cmDcFilt* p, const cmSample_t* x, cmSample_t* y, unsigned n );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
// interpolating delay - used by the comb filter
//( { label:cmIDelay file_desc:"Variable interpolating fractional audio delay line." kw:[proc]}
typedef struct cmIDelay_str
{
@ -429,7 +460,10 @@ extern "C" {
cmRC_t cmIDelaySetTapMs( cmIDelay* p, unsigned tapIdx, cmReal_t tapMs );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmGroupSel file_desc:"Assign channel to dynamic groups under gate control." kw:[proc]}
// This object sequentially assigns channels to groups when their gates go high.
// 'chsPerGroup' channels will be assigned to each group. No channel will be
@ -481,7 +515,10 @@ extern "C" {
// and groups that will be removed on the next cycle have their 'releaseFl' set.
cmRC_t cmGroupSelExec( cmGroupSel* p );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmAudioNofM file_desc:"Route N of M possible input channels to N output channels under gate control." kw:[proc]}
// Route N of M input channels to N output channels.
// The N channels are selected from the first N gates to go high.
@ -526,7 +563,10 @@ extern "C" {
cmRC_t cmAudioNofMSetFadeMs( cmAudioNofM* p, cmReal_t fadeTimeMs );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmAdsr file_desc:"ADSR audio evelope generator." kw:[proc]}
enum { kDlyAdsrId, kAtkAdsrId, kDcyAdsrId, kSusAdsrId, kRlsAdsrId, kDoneAdsrId };
@ -546,9 +586,6 @@ extern "C" {
cmReal_t susLevel;
int rlsSmp;
unsigned state; // current state
int durSmp; // time in current state
cmReal_t level; // current level
@ -575,7 +612,10 @@ extern "C" {
void cmAdsrSetLevel( cmAdsr* p, cmReal_t level, unsigned id );
void cmAdsrReport( cmAdsr* p, cmRpt_t* rpt );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmCompressor file_desc:"Audio dynamics compressor algorithm." kw:[proc]}
enum { kAtkCompId, kRlsCompId };
typedef struct
@ -616,7 +656,11 @@ extern "C" {
void cmCompressorSetThreshDb( cmCompressor* p, cmReal_t thresh );
void cmCompressorSetRmsWndMs( cmCompressor* p, cmReal_t ms );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmBiQuad file_desc:"General purpose Biquad filter algorithm." kw:[proc]}
// BiQuad Audio Eq's based on Robert Bristow-Johnson's recipes.
// http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
@ -660,7 +704,10 @@ extern "C" {
void cmBiQuadEqSet( cmBiQuadEq* p, unsigned mode, cmReal_t f0Hz, cmReal_t Q, cmReal_t gainDb );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDistDs file_desc:"Guitar style distortion effect." kw:[proc]}
typedef struct
{
cmObj obj;
@ -686,6 +733,9 @@ extern "C" {
cmRC_t cmDistDsInit( cmDistDs* p, cmReal_t srate, cmReal_t inGain, cmReal_t downSrate, cmReal_t bits, bool rectFl, bool fullFl, cmReal_t clipDb, cmReal_t outGain, bool bypassFl );
cmRC_t cmDistDsFinal( cmDistDs* p );
cmRC_t cmDistDsExec( cmDistDs* p, const cmSample_t* x, cmSample_t* y, unsigned n );
//------------------------------------------------------------------------------------------------------------
//)
//=======================================================================================================================
/*

View File

@ -5,11 +5,12 @@
extern "C" {
#endif
//( { file_desc:"Processor Library 4" kw:[proclib]}
//)
//( { label:cmEditDist file_desc:"Simplified string alignment function based on Levenshtein edit distance." kw:[proc] }
//=======================================================================================================================
//
// Simplified string alignment function based on Levenshtein edit distance.
//
enum { kEdMinIdx, kEdSubIdx, kEdDelIdx, kEdInsIdx, kEdCnt };
typedef struct
@ -87,7 +88,10 @@ extern "C" {
// Main test function.
void ed_main();
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmScoreMatch file_desc:"Event oriented local score matching algorithm based on edit distance." kw:[proc] }
enum
{
kSmMinIdx, //
@ -200,9 +204,10 @@ extern "C" {
// necessarily an error.
cmRC_t cmScMatchExec( cmScMatch* p, unsigned locIdx, unsigned locN, const cmScMatchMidi_t* midiV, unsigned midiN, double min_cost );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmScoreMatcher file_desc:"MIDI score following algorithm based cmScoreMatch." kw:[proc] }
typedef struct
{
unsigned locIdx; // index into cmScMatch_t.loc[]
@ -246,8 +251,6 @@ extern "C" {
bool printFl;
} cmScMatcher;
cmScMatcher* cmScMatcherAlloc(
cmCtx* c, // Program context.
cmScMatcher* p, // Existing cmScMatcher to reallocate or NULL to allocate a new cmScMatcher.
@ -310,7 +313,10 @@ extern "C" {
void cmScMatcherPrint( cmScMatcher* p );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmScMeas file_desc:"Measure and report some differences between the score and the performance." kw:[proc] }
typedef struct
{
@ -391,7 +397,10 @@ extern "C" {
// notes in each marker region and the score.
void cmScAlignScanMarkers( cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmScMod file_desc:"Store and recall parameter information under score follower control." kw:[proc] }
/*
Syntax: <loc> <mod> <var> <type> <params>
<loc> - score location
@ -523,7 +532,10 @@ extern "C" {
cmRC_t cmScModulatorExec( cmScModulator* p, unsigned scLocIdx );
cmRC_t cmScModulatorDump( cmScModulator* p );
//=======================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmRecdPlay file_desc:"Record fragments of audio, store them,and play them back at a later time." kw:[proc] }
//
// Record fragments of audio, store them, and play them back at a later time.
//
@ -594,6 +606,8 @@ extern "C" {
cmRC_t cmRecdPlayBeginFade( cmRecdPlay* p, unsigned labelSymId, double fadeDbPerSec );
cmRC_t cmRecdPlayExec( cmRecdPlay* p, const cmSample_t** iChs, cmSample_t** oChs, unsigned chCnt, unsigned smpCnt );
//)
#ifdef __cplusplus
}

View File

@ -5,10 +5,11 @@
extern "C" {
#endif
//( { file_desc:"Process Library 5", kw:[proclib]}
//)
//=======================================================================================================================
// Goertzel Filter
//
//( { label:cmGoertzel file_desc:"Goertzel tone detection filter." kw:[proc]}
typedef struct
{
@ -38,10 +39,10 @@ extern "C" {
cmRC_t cmGoertzelSetFcHz( cmGoertzel* p, unsigned chIdx, double hz );
cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* in, unsigned procSmpCnt, double* outV, unsigned chCnt );
//------------------------------------------------------------------------------------------------------------
//)
//=======================================================================================================================
// Gold Code Signal Generator
//
//( { label:cmGoldCode file_desc:"Gold code random generator." kw:[proc]}
typedef struct
{
@ -110,9 +111,10 @@ extern "C" {
cmRC_t cmGoldSigTest( cmCtx* ctx );
//=======================================================================================================================
// Phase aligned transform generalized cross correlator
//
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmPhat file_desc:"Phase-aligned transform for generalized cross correlator." kw:[proc]}
// Flags for use with the 'flags' argument to cmPhatAlloc()
enum
@ -192,9 +194,10 @@ extern "C" {
cmRC_t cmPhatWrite( cmPhat_t* p, const char* dirStr );
//=======================================================================================================================
//
//
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmReflectCal file_desc:"Calculate the time of flight of Gold code acoustic reflections." kw:[proc]}
typedef struct
@ -225,9 +228,11 @@ extern "C" {
cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t* xV, cmSample_t* yV, unsigned xyN );
cmRC_t cmReflectCalcWrite( cmReflectCalc_t* p, const char* dirStr );
//=======================================================================================================================
//
//
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmNlms file_desc:"Normalized least mean squares echo canceller." kw:[proc]}
typedef struct
{
cmObj obj;
@ -260,6 +265,7 @@ extern "C" {
void cmNlmsEcSetMu( cmNlmsEc_t* p, float mu );
void cmNlmsEcSetDelayN( cmNlmsEc_t* p, unsigned delayN );
void cmNlmsEcSetIrN( cmNlmsEc_t* p, unsigned irN );
//)
#ifdef __cplusplus

View File

@ -5,7 +5,7 @@
extern "C" {
#endif
/*
/*( { file_desc:"Base class for all 'proc' objects." kw:[proclib] }
The first field in all objects must be an cmObj record.
@ -164,6 +164,7 @@ extern "C" {
#define cmMtxFileRealExecN(f,p,n,s) cmMtxFileDoubleExec((f),(p),(n),(s))
#endif
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,7 @@
extern "C" {
#endif
//( { file_desc:"Restricted Bolzmann Machine object." kw:[model] }
enum
{
kOkRbmRC = cmOkRC,
@ -38,6 +39,8 @@ enum
void cmRbmBinaryTest(cmCtx_t* ctx);
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,12 +5,10 @@
#ifdef __cplusplus
extern "C" {
#endif
//{
//(
//( { file_desc: "The cmRpt class provides console style output for all objects in the cm system." kw:[base]}
//
// The cmRpt class provides console style output for all objects in the cm system.
//
// The cmRpt class provides console output style output, like stdout and stderr
// for most of the classes in the cm library.
@ -51,7 +49,6 @@ extern "C" {
void cmRptVErrorf( cmRpt_t* rpt, const cmChar_t* fmt, va_list vl );
void cmRptErrorf( cmRpt_t* rpt, const cmChar_t* fmt, ... );
//)
//}
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"rtSys networking component." kw:[rtsys network] }
/*
Nodes and Endpoints:
---------------------
@ -202,6 +204,7 @@ extern "C" {
4) The symbol -=- in the flow chart implies a network transmission.
*/
//)
#ifdef __cplusplus
}

View File

@ -1,5 +1,4 @@
// cmRtSys.h
// Implements a real-time audio processing engine.
//( { file_desc:"Improved real-time audio processing engine." kw:[rtsys] }
//
// The audio system is composed a collection of independent sub-systems.
// Each sub-system maintains a thread which runs asynchrounsly
@ -48,10 +47,7 @@
// Messages arriving while the mutex is locked are queued and
// delivered to the DSP procedure at the end of the DSP execution
// procedure.
//
// Usage example and testing code:
// See cmRtSysTest().
// \snippet cmRtSys.c cmRtSysTest
//)
#ifndef cmRtSys_h
#define cmRtSys_h
@ -60,6 +56,7 @@
extern "C" {
#endif
//(
// Audio system result codes
enum
{
@ -329,7 +326,7 @@ extern "C" {
cmRtRC_t cmRtSysNetReport( cmRtSysH_t h );
cmRtRC_t cmRtSysNetReportSyncEnable( cmRtSysH_t h, bool enableFl );
cmRtRC_t cmRtSysNetGetHandle( cmRtSysH_t h, unsigned rtSubIdx, cmRtNetH_t* hp );
//)
#ifdef __cplusplus
}

View File

@ -4,6 +4,7 @@
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"rtSys message contants and data structures." kw:[rtsys] }
// Reserved DSP message selector id's (second field of all
// host<->audio system messages)
@ -105,6 +106,7 @@ extern "C" {
// char msg[ msgByteCnt ]
} cmRtNetMsg_t;
//)
#ifdef __cplusplus
}

View File

@ -5,14 +5,8 @@
extern "C" {
#endif
//{
//(
// cmSerialize is an API for serializing data structures into
// byte streams and then deserializing them back into data structures.
//
//)
//( { file_desc:" An API for serializing data structures into byte streams and then deserializing them back into data structures." kw:[base]}
//(
// Result codes
enum
@ -299,7 +293,6 @@ extern "C" {
cmSrRC_t cmSrTest( cmCtx_t* ctx );
//)
//}
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Push-down stack data structure for binary blobs." kw:[container] }
enum
{
kOkStRC = cmOkRC,
@ -62,6 +64,7 @@ extern "C" {
#define cmStackEle(h,t,i) (*(t*)cmStackGet(h,i))
//)
#ifdef __cplusplus
}

View File

@ -6,6 +6,8 @@
extern "C" {
#endif
//( { file_desc:"String stream text sink." kw:[text] }
enum
{
kOkSsRC = cmOkRC,
@ -34,6 +36,8 @@ extern "C" {
void* cmOStrStreamAllocBuf( cmStrStreamH_t h );
cmChar_t* cmOStrStreamAllocText( cmStrStreamH_t h );
//)
#ifdef __cplusplus
}
#endif

View File

@ -4,13 +4,8 @@
#ifdef __cplusplus
extern "C" {
#endif
//{
//(
// Symbol table component.
//)
//( { file_desc:"Symbol table object." kw:[base] }
//(
typedef cmHandle_t cmSymTblH_t;
extern cmSymTblH_t cmSymTblNullHandle;
@ -61,7 +56,6 @@ extern "C" {
void cmSymTblTest(cmCtx_t* ctx);
//)
//}
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Read a 'ctags' output file." kw:[file] }
// Read a ctags file generated by:
//
// ctags --c-kinds=+p --fields=+n file.h
@ -61,6 +63,8 @@ extern "C" {
cmTfRC_t cmTfTest( cmCtx_t* ctx, const cmChar_t* fn );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,7 +5,8 @@
extern "C" {
#endif
/*
/*( { file_desc:"Task manager for controlling and monitoring tasks running in independent thread." kw:[parallel]}
Usage:
1) Use cmTaskMgrInstall() to register a worker function
(cmTaskMgrFunc_t) with the task manager.
@ -353,6 +354,7 @@ extern "C" {
cmTmWorkerRC_t cmTaskMgrWorkerMsgSend( cmTaskMgrFuncArg_t* a, const void* buf, unsigned bufByteCnt );
cmTmRC_t cmTaskMgrTest(cmCtx_t* ctx);
//)
#ifdef __cplusplus
}

View File

@ -5,8 +5,8 @@
extern "C" {
#endif
//{
//(
//( { file_desc:"Text processing functions." kw:[text]}
//
// The cmText API supports two basic tasks: the generation of
// formatted text into dynamic arrays and text to number parsing.
//
@ -297,7 +297,6 @@ extern "C" {
//)
//}
#ifdef __cplusplus
}

View File

@ -1,7 +1,11 @@
#ifndef cmTextTemplate_h
#define cmTextTemplate_h
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Generate text using templates with replaceable variables." kw:[text] }
enum
{
kOkTtRC = cmOkRC,
@ -43,13 +47,15 @@ cmTtRC_t cmTextTemplateWrite( cmTtH_t h, const cmChar_t* fn );
// Apply a template value JSON file to this template
cmTtRC_t cmTextTemplateApply( cmTtH_t h, const cmChar_t* fn );
// Print an annotated template tree.
void cmTtPrintTree( cmTtH_t h, cmRpt_t* rpt );
cmTtRC_t cmTextTemplateTest( cmCtx_t* ctx, const cmChar_t* fn );
//)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -4,6 +4,7 @@
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"Threads and thread safe containers." kw:[parallel] }
typedef cmHandle_t cmThreadH_t;
typedef unsigned cmThRC_t;
@ -85,8 +86,10 @@ extern "C" {
void cmThreadSetWaitTimeOutMicros( cmThreadH_t h, unsigned usecs );
void cmThreadTest( cmRpt_t* rpt );
//)
//( { label:cmThreadMutex file_desc:"Thread mutex object." kw[parallel]}
//============================================================================
typedef struct
{
void* h;
@ -109,6 +112,9 @@ extern "C" {
cmThRC_t cmThreadMutexSignalCondVar( cmThreadMutexH_t h );
//)
//( { label:cmTsQueue file_desc:"Thread safe message queue." kw[parallel]}
//============================================================================
// cmThread safe message queue.
//
@ -190,6 +196,9 @@ extern "C" {
bool cmTsQueueIsValid( cmTsQueueH_t h);
//)
//( { label:cmTs1p1c file_desc:"Single producer/Single consumer non-blocking thread safe queue." kw[parallel]}
//============================================================================
// Single producer / Single consumer thread-safe queue.
// These functions have identical semantics and return values
@ -221,6 +230,9 @@ extern "C" {
bool cmTs1p1cIsValid( cmTs1p1cH_t h );
//)
//( { label:cmThCAS file_desc:"Non-blocking primitive operations." kw[parallel]}
//============================================================================
// Thread safe compare-and-swap (actualy compare-and-test).
// Returns true if the *addr==new when the function returns
@ -241,6 +253,9 @@ extern "C" {
void cmThUIntDecr( unsigned* addr, unsigned decr );
void cmThFloatDecr(float* addr, float decr );
//)
//( { label:cmMp1c file_desc:"Multiple producer, single consumer non-blocking thread-safe queue." kw[parallel]}
//============================================================================
// Multiple producer / Single consumer thread-safe queue.
// These functions have identical semantics and return values
// to the same named cmTsQueueXXXX() calls above.
@ -272,15 +287,17 @@ extern "C" {
bool cmTsMp1cIsValid( cmTsMp1cH_t h );
// Sleep functions
void cmSleepUs( unsigned microseconds );
void cmSleepMs( unsigned milliseconds );
void cmTsQueueTest( cmRpt_t* rpt );
void cmTs1p1cTest( cmRpt_t* rpt );
void cmTsMp1cTest( cmRpt_t* rpt );
//)
//( { label:cmSleep file_desc:"Sleep related functions." kw:[time] }
// Sleep functions
void cmSleepUs( unsigned microseconds );
void cmSleepMs( unsigned milliseconds );
//)
#ifdef __cplusplus
}
#endif

View File

@ -1,8 +1,7 @@
//{ { label:cmTime
// kw: [ time ] }
//( { file_desc:"Time cand clock related functions." kw: [ time system ] }
//
//
//(
// This interface is used to read the systems high resolution timer and
// calculate elapsed time.
//)
@ -16,12 +15,9 @@ extern "C" {
#endif
//(
typedef struct timespec cmTimeSpec_t;
/*
get the time
*/
// Get the time
void cmTimeGet( cmTimeSpec_t* t );
// Return the elapsed time (t1 - t0) in microseconds
@ -51,7 +47,6 @@ extern "C" {
void cmTimeSetZero( cmTimeSpec_t* t0 );
//)
//}
#ifdef __cplusplus
}

View File

@ -5,7 +5,7 @@
extern "C" {
#endif
/*
/*( { file_desc:"UDP based network object." kw:[network] }
A cmUdpNet is a wrapper around a single cmUdpPort. This object
maintains an array of remote nodes which map application defined
node label/id's to IP address/port. This allows the application
@ -136,6 +136,8 @@ void cmUdpNetReport( cmUdpNetH_t h, cmRpt_t* rpt );
cmRC_t cmUdpNetTest( cmCtx_t* ctx, int argc, const char* argv[] );
//)
#ifdef __cplusplus
}
#endif

View File

@ -4,6 +4,7 @@
#ifdef __cplusplus
extern "C" {
#endif
//( { file_desc:"UDP socket interface class." kw:[network] }
#include <netinet/in.h>
@ -140,6 +141,8 @@ extern "C" {
cmUdpRC_t cmUdpTest( cmCtx_t* ctx, const char* remoteIpAddr, cmUdpPort_t port );
cmUdpRC_t cmUdpTestV( cmCtx_t* ctx, unsigned argc, const char* argv[]);
//)
#ifdef __cplusplus
}
#endif

6
cmUi.h
View File

@ -4,7 +4,8 @@
#ifdef __cplusplus
extern "C" {
#endif
/*
/*( { file_desc:"UI control manager for rtSys." kw:[rtSys]}
cmUI implements a platform independent UI control manager
for multiple simultaneous applications. In this context
an 'application' can be seen as a plug-in style program.
@ -109,7 +110,9 @@ extern "C" {
value of a control.
*/
//)
//(
typedef cmHandle_t cmUiH_t;
@ -384,6 +387,7 @@ extern "C" {
cmUiRC_t cmUiLastRC( cmUiH_t uiH );
cmUiRC_t cmUiSetRC( cmUiH_t uiH, cmUiRC_t rc );
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( {file_desc:"UI independent driver used by an rtSys application to communicate with the UI." kw:[rtsys]}
typedef unsigned cmUiRC_t;
// cmUi result codes
@ -170,6 +172,7 @@ extern "C" {
double cmUiDriverArgGetDouble( const cmUiDriverArg_t* a );
const cmChar_t* cmUiDriverArgGetString( const cmUiDriverArg_t* a );
//)
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"Application side API for communicating with the UI audio master controls and meters." kw:[rtsys]}
enum
{
kOkAmRC = cmOkRC,
@ -33,6 +35,8 @@ extern "C" {
// Clear the status indicators.
void cmUiRtSysMstrClearStatus( cmUiRtMstrH_t h );
//)
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,7 @@
extern "C" {
#endif
//( { file_desc:"Wrapper object for cmUdpNet to handle UDP network communications." kw:[network]}
enum
{
kOkVnRC = cmOkRC,
@ -66,6 +67,8 @@ extern "C" {
cmVnRC_t cmVnTest( cmCtx_t* ctx );
//)
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"'snap' unit processor interface." kw:[snap] }
typedef unsigned cmDspRC_t;
enum
@ -416,6 +418,7 @@ extern "C" {
cmDspRC_t cmDspUiMsgListCreate(cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned height, unsigned listVarId, unsigned selVarId );
//)
#ifdef __cplusplus
}

View File

@ -1,3 +1,5 @@
//( { file_desc:"'snap' audio effects processor units." kw:[snap]}
#include "cmPrefix.h"
#include "cmGlobal.h"
#include "cmFloatTypes.h"
@ -40,7 +42,9 @@
#include "cmDspSys.h"
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspDelay file_desc:"Simple audio delay with feedback." kw:[sunit] }
enum
{
kBypassDyId,
@ -155,7 +159,7 @@ cmDspRC_t _cmDspDelayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmDelayClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmDelayClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmDelayDC,ctx,"Delay",
NULL,
@ -170,7 +174,9 @@ struct cmDspClass_str* cmDelayClassCons( cmDspCtx_t* ctx )
return &_cmDelayDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspMtDelay file_desc:"Multi-tap audio delay with feedback." kw:[sunit] }
enum
{
kBypassMtId,
@ -345,7 +351,7 @@ cmDspRC_t _cmDspMtDelayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return rc;
}
cmDspRC_t _cmDspMtDelayRecvFunc( cmDspCtx_t* ctx, struct cmDspInst_str* inst, unsigned attrSymId, const cmDspValue_t* value )
cmDspRC_t _cmDspMtDelayRecvFunc( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned attrSymId, const cmDspValue_t* value )
{
cmDspRC_t rc = kOkDspRC;
cmDspMtDelay_t* p = (cmDspMtDelay_t*)inst;
@ -364,7 +370,7 @@ cmDspRC_t _cmDspMtDelayRecvFunc( cmDspCtx_t* ctx, struct cmDspInst_str* inst,
}
struct cmDspClass_str* cmMtDelayClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmMtDelayClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmMtDelayDC,ctx,"MtDelay",
NULL,
@ -380,7 +386,9 @@ struct cmDspClass_str* cmMtDelayClassCons( cmDspCtx_t* ctx )
return &_cmMtDelayDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspPShift file_desc:"Time-domain pitch shifter." kw:[sunit] }
enum
{
kBypassPsId,
@ -468,7 +476,7 @@ cmDspRC_t _cmDspPShiftRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return cmDspSetEvent(ctx,inst,evt);
}
struct cmDspClass_str* cmPShiftClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmPShiftClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmPShiftDC,ctx,"PShift",
NULL,
@ -483,7 +491,9 @@ struct cmDspClass_str* cmPShiftClassCons( cmDspCtx_t* ctx )
return &_cmPShiftDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspLoopRecd file_desc:"Loop recorder." kw:[sunit] }
enum
{
kTimeLrId,
@ -616,7 +626,7 @@ cmDspRC_t _cmDspLoopRecdRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmLoopRecdClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmLoopRecdClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmLoopRecdDC,ctx,"LoopRecd",
NULL,
@ -631,7 +641,9 @@ struct cmDspClass_str* cmLoopRecdClassCons( cmDspCtx_t* ctx )
return &_cmLoopRecdDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspRectify file_desc:"Full-wave rectifier." kw:[sunit] }
enum
{
kBypassRcId,
@ -715,7 +727,7 @@ cmDspRC_t _cmDspRectifyRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return cmDspSetEvent(ctx,inst,evt);
}
struct cmDspClass_str* cmRectifyClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmRectifyClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmRectifyDC,ctx,"Rectify",
NULL,
@ -731,7 +743,9 @@ struct cmDspClass_str* cmRectifyClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspGateDetect file_desc:"Track the onset and offset of an incoming signal." kw:[sunit] }
enum
{
kWndMsGdId,
@ -862,7 +876,7 @@ cmDspRC_t _cmDspGateDetectRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
return rc;
}
struct cmDspClass_str* cmGateDetectClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmGateDetectClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmGateDetectDC,ctx,"GateDetect",
NULL,
@ -878,62 +892,62 @@ struct cmDspClass_str* cmGateDetectClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
/*
The purpose of this object is to calculate, store and retrieve gain coefficents
for a set of audio channels. The gain coefficients are designed to balance the
volume of each channel relative to the others. During gain calibration
a sample of each channel is taken and it's average volume is determined.
After an example of all channels has been received a new set of gain coefficients
is calculated which decreases the volume of loud channels and increases the
volume of quiet channels.
The gain coefficents are made available via a set of 'gain-###' output ports.
This object acts as an interface to the cmAutoGain processor.
As input it takes a channel configuration JSON file of the form:
{
ch_array :
[ ["ch","ssi","pitch","midi","gain"]
[ 0, 0, "C4", 60, 1.0 ]
....
[ n 0, "C5", 72, 1.0 ]
]
}
Each array in 'ch_array' gives the configuration of a channel.
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspAutoGain file_desc:"Normalize a set of audio input signals to acheive a consistent level." kw:[sunit] }
// The purpose of this object is to calculate, store and retrieve gain coefficents
// for a set of audio channels. The gain coefficients are designed to balance the
// volume of each channel relative to the others. During gain calibration
// a sample of each channel is taken and it's average volume is determined.
// After an example of all channels has been received a new set of gain coefficients
// is calculated which decreases the volume of loud channels and increases the
// volume of quiet channels.
//
// The gain coefficents are made available via a set of 'gain-###' output ports.
//
// This object acts as an interface to the cmAutoGain processor.
//
// As input it takes a channel configuration JSON file of the form:
// {
// ch_array :
// [ ["ch","ssi","pitch","midi","gain"]
// [ 0, 0, "C4", 60, 1.0 ]
// ....
// [ n 0, "C5", 72, 1.0 ]
// ]
// }
//
// Each array in 'ch_array' gives the configuration of a channel.
//
//
// It also requires a JSON resource object of the form
// gdParms:
// {
// medCnt: 5
// avgCnt: 9
// suprCnt: 6
// offCnt: 3
// suprCoeff: 1.400000
// onThreshDb: -53.000000
// offThreshDb: -80.000000
// }
//
// These arguments are used to configure the cmAutoGain Proessor gate detector function.
//
// During runtime the object accepts the following action selector symbol id's:
// a. start - begin a new calibration session
// b. proc - end a calibration session and calculate new gain coeff's
// c. cancel - cancel a calibration session
// d. write - write the channel configuration file
// e. print - print the current auto gain calibration state
//
// After a 'start' msg the object accepts channel id's throught its 'id' input port.
// Each 'id' identifies the channel which it will process next.
// Upon reception of a channel id the object routes subsequent audio to its
// internal cmAutoGain processor until it receives the next channel id
// or a 'proc' or 'cancel' symbol.
It also requires a JSON resource object of the form
gdParms:
{
medCnt: 5
avgCnt: 9
suprCnt: 6
offCnt: 3
suprCoeff: 1.400000
onThreshDb: -53.000000
offThreshDb: -80.000000
}
These arguments are used to configure the cmAutoGain Proessor gate detector function.
During runtime the object accepts the following action selector symbol id's:
a. start - begin a new calibration session
b. proc - end a calibration session and calculate new gain coeff's
c. cancel - cancel a calibration session
d. write - write the channel configuration file
e. print - print the current auto gain calibration state
After a 'start' msg the object accepts channel id's throught its 'id' input port.
Each 'id' identifies the channel which it will process next.
Upon reception of a channel id the object routes subsequent audio to its
internal cmAutoGain processor until it receives the next channel id
or a 'proc' or 'cancel' symbol.
*/
//==========================================================================================================================================
enum
{
@ -1202,7 +1216,7 @@ cmDspRC_t _cmDspAutoGainRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmAutoGainClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmAutoGainClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmAutoGainDC,ctx,"AutoGain",
NULL,
@ -1217,7 +1231,9 @@ struct cmDspClass_str* cmAutoGainClassCons( cmDspCtx_t* ctx )
return &_cmAutoGainDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspEnvFollow file_desc:"Generate a control signal from by analyzing the power envelope of an incoming audio signal." kw:[sunit] }
enum
{
kHopMsEfId, // RMS window length in milliseconds
@ -1388,7 +1404,7 @@ cmDspRC_t _cmDspEnvFollowRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
return rc;
}
struct cmDspClass_str* cmEnvFollowClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmEnvFollowClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmEnvFollowDC,ctx,"EnvFollow",
NULL,
@ -1403,7 +1419,9 @@ struct cmDspClass_str* cmEnvFollowClassCons( cmDspCtx_t* ctx )
return &_cmEnvFollowDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspXfader file_desc:"Gate controlled fader bank." kw:[sunit] }
// Fade in and out an arbitrary number of audio signals based on gate signals.
// When the gate is high the signal fades in and when the gate is low the signal fades out.
// Constructor Args:
@ -1646,7 +1664,7 @@ cmDspRC_t _cmDspXfaderRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmXfaderClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmXfaderClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmXfaderDC,ctx,"Xfader",
NULL,
@ -1662,7 +1680,9 @@ struct cmDspClass_str* cmXfaderClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspChCfg file_desc:"Configure a 'fluxo' channel." kw:[sunit] }
enum
{
@ -1864,7 +1884,7 @@ cmDspRC_t _cmDspChCfgRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmChCfgClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmChCfgClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmChCfgDC,ctx,"ChCfg",
NULL,
@ -1879,7 +1899,9 @@ struct cmDspClass_str* cmChCfgClassCons( cmDspCtx_t* ctx )
return &_cmChCfgDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspChordDetect file_desc:"Detect a predefined chord based on signal gates." kw:[sunit] }
enum
{
kRsrcCdId,
@ -2062,7 +2084,7 @@ cmDspRC_t _cmDspChordDetectRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspE
return rc;
}
struct cmDspClass_str* cmChordDetectClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmChordDetectClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmChordDetectDC,ctx,"ChordDetect",
NULL,
@ -2077,7 +2099,10 @@ struct cmDspClass_str* cmChordDetectClassCons( cmDspCtx_t* ctx )
return &_cmChordDetectDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspFader file_desc:"Single channel gate controlled fader." kw:[sunit] }
enum
{
kTimeFaId,
@ -2168,7 +2193,7 @@ cmDspRC_t _cmDspFaderRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmFaderClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmFaderClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmFaderDC,ctx,"Fader",
NULL,
@ -2183,7 +2208,9 @@ struct cmDspClass_str* cmFaderClassCons( cmDspCtx_t* ctx )
return &_cmFaderDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspNoteSelect file_desc:"'fluxo' gate based logic controller." kw:[sunit fluxo] }
enum
{
kChCntNsId,
@ -2421,7 +2448,7 @@ cmDspRC_t _cmDspNoteSelectRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
return rc;
}
struct cmDspClass_str* cmNoteSelectClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmNoteSelectClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmNoteSelectDC,ctx,"NoteSelect",
NULL,
@ -2436,7 +2463,9 @@ struct cmDspClass_str* cmNoteSelectClassCons( cmDspCtx_t* ctx )
return &_cmNoteSelectDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspNetNoteSelect file_desc:"'fluxo' transmit gate information over the UDP network." kw:[sunit fluxo] }
enum
{
@ -2708,7 +2737,7 @@ cmDspRC_t _cmDspNetNoteSelectRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDs
return rc;
}
struct cmDspClass_str* cmNetNoteSelectClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmNetNoteSelectClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmNetNoteSelectDC,ctx,"NetNoteSelect",
NULL,
@ -2724,7 +2753,9 @@ struct cmDspClass_str* cmNetNoteSelectClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspCombFilt file_desc:"Comb and Inverse comb filter." kw:[sunit] }
enum
{
kBypassCfId,
@ -2840,7 +2871,7 @@ cmDspRC_t _cmDspCombFiltRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmCombFiltClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmCombFiltClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmCombFiltDC,ctx,"CombFilt",
NULL,
@ -2855,7 +2886,9 @@ struct cmDspClass_str* cmCombFiltClassCons( cmDspCtx_t* ctx )
return &_cmCombFiltDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspScalarOp file_desc:"Perform arithmetic functions on scalar values." kw:[sunit] }
enum
{
kPortCntSoId,
@ -3012,7 +3045,7 @@ cmDspRC_t _cmDspScalarOpRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmScalarOpClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmScalarOpClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmScalarOpDC,ctx,"ScalarOp",
NULL,
@ -3027,7 +3060,9 @@ struct cmDspClass_str* cmScalarOpClassCons( cmDspCtx_t* ctx )
return &_cmScalarOpDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspGroupSel file_desc:"Select one group of audio channels from a set of audio channel groups." kw:[sunit] }
enum
{
@ -3182,7 +3217,7 @@ cmDspRC_t _cmDspGroupSelRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmGroupSelClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmGroupSelClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmGroupSelDC,ctx,"GroupSel",
NULL,
@ -3198,7 +3233,9 @@ struct cmDspClass_str* cmGroupSelClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspNofM file_desc:"Select N channels from a set of M channels based on their current gate states." kw:[sunit] }
enum
{
@ -3348,7 +3385,7 @@ cmDspRC_t _cmDspAudioNofM_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
return rc;
}
struct cmDspClass_str* cmAudioNofMClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmAudioNofMClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmAudioNofM_DC,ctx,"AudioNofM",
NULL,
@ -3365,7 +3402,9 @@ struct cmDspClass_str* cmAudioNofMClassCons( cmDspCtx_t* ctx )
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspRingMod file_desc:"Ring modulator." kw:[sunit] }
enum
{
kInChCntRmId,
@ -3467,7 +3506,7 @@ cmDspRC_t _cmDspRingModRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return cmDspSetEvent(ctx,inst,evt);
}
struct cmDspClass_str* cmRingModClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmRingModClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmRingModDC,ctx,"RingMod",
NULL,
@ -3482,7 +3521,9 @@ struct cmDspClass_str* cmRingModClassCons( cmDspCtx_t* ctx )
return &_cmRingModDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspMsgDelay file_desc:"Delay an arbitrary value." kw:[sunit] }
enum
{
kMaxCntMdId,
@ -3703,7 +3744,7 @@ cmDspRC_t _cmDspMsgDelayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmMsgDelayClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmMsgDelayClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmMsgDelayDC,ctx,"MsgDelay",
NULL,
@ -3718,7 +3759,9 @@ struct cmDspClass_str* cmMsgDelayClassCons( cmDspCtx_t* ctx )
return &_cmMsgDelayDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspLine file_desc:"Programmable line generator." kw:[sunit] }
enum
{
kBegLnId,
@ -3874,7 +3917,7 @@ cmDspRC_t _cmDspLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* e
return rc;
}
struct cmDspClass_str* cmLineClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmLineClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmLineDC,ctx,"Line",
NULL,
@ -3890,7 +3933,10 @@ struct cmDspClass_str* cmLineClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspAdsr file_desc:"ADSR envelope generator." kw:[sunit] }
enum
{
kTrigModeAdId,
@ -4007,14 +4053,12 @@ cmDspRC_t _cmDspAdsrExec( cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
// HACK HACK HACK HACK
//
/*
double db = rms<0.00001 ? -100.0 : 20.0*log10(rms);
double dbMax = -15.0;
double dbMin = -58.0;
db = cmMin(dbMax,cmMax(dbMin,db));
double scale = (db - dbMin) / (dbMax-dbMin);
*/
// double db = rms<0.00001 ? -100.0 : 20.0*log10(rms);
// double dbMax = -15.0;
// double dbMin = -58.0;
//
// db = cmMin(dbMax,cmMax(dbMin,db));
// double scale = (db - dbMin) / (dbMax-dbMin);
cmReal_t out = cmAdsrExec( p->p, cmDspSamplesPerCycle(ctx), gateFl, tscale, ascale );
@ -4083,7 +4127,7 @@ cmDspRC_t _cmDspAdsrRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* e
return rc;
}
struct cmDspClass_str* cmAdsrClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmAdsrClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmAdsrDC,ctx,"Adsr",
NULL,
@ -4098,7 +4142,9 @@ struct cmDspClass_str* cmAdsrClassCons( cmDspCtx_t* ctx )
return &_cmAdsrDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspAdsr file_desc:"Audio dynamics compressor." kw:[sunit] }
enum
{
kBypassCmId,
@ -4251,7 +4297,7 @@ cmDspRC_t _cmDspCompressorRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
return rc;
}
struct cmDspClass_str* cmCompressorClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmCompressorClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmCompressorDC,ctx,"Compressor",
NULL,
@ -4266,7 +4312,9 @@ struct cmDspClass_str* cmCompressorClassCons( cmDspCtx_t* ctx )
return &_cmCompressorDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspBiquad file_desc:"Programmable Biquad EQ filter." kw:[sunit] }
enum
{
kBypassBqId,
@ -4435,7 +4483,7 @@ cmDspRC_t _cmDspBiQuadEqRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmBiQuadEqClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmBiQuadEqClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmBiQuadEqDC,ctx,"BiQuadEq",
NULL,
@ -4450,7 +4498,10 @@ struct cmDspClass_str* cmBiQuadEqClassCons( cmDspCtx_t* ctx )
return &_cmBiQuadEqDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspDistDs file_desc:"Guitar style distortion effect." kw:[sunit] }
enum
{
kBypassDsId,
@ -4593,7 +4644,7 @@ cmDspRC_t _cmDspDistDsRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmDistDsClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmDistDsClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmDistDsDC,ctx,"DistDs",
NULL,
@ -4608,7 +4659,9 @@ struct cmDspClass_str* cmDistDsClassCons( cmDspCtx_t* ctx )
return &_cmDistDsDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspDbToLin file_desc:"Convert decibel units to linear units." kw:[sunit] }
enum
{
kInDlId,
@ -4660,7 +4713,7 @@ cmDspRC_t _cmDspDbToLinRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return rc;
}
struct cmDspClass_str* cmDbToLinClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmDbToLinClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmDbToLinDC,ctx,"DbToLin",
NULL,
@ -4675,7 +4728,10 @@ struct cmDspClass_str* cmDbToLinClassCons( cmDspCtx_t* ctx )
return &_cmDbToLinDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspNofM2 file_desc:"Pass an N of M possible inputs to the output." kw:[sunit] }
// Pass any N of M inputs
enum
{
@ -5055,7 +5111,7 @@ cmDspRC_t _cmDspNofM_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmNofMClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmNofMClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmNofM_DC,ctx,"NofM",
NULL,
@ -5071,7 +5127,9 @@ struct cmDspClass_str* cmNofMClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDsp1ofN file_desc:"Pass 1 or N possible inputs to the output." kw:[sunit] }
enum
{
@ -5247,7 +5305,7 @@ cmDspRC_t _cmDsp1ofN_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cm1ofNClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cm1ofNClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cm1ofN_DC,ctx,"1ofN",
NULL,
@ -5262,7 +5320,10 @@ struct cmDspClass_str* cm1ofNClassCons( cmDspCtx_t* ctx )
return &_cm1ofN_DC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDsp1Up file_desc:"Send 'true' on the selected channel and 'false' on the deselected channel." kw:[sunit] }
// Send a 'true' out on the selected channel.
// Send a 'false' out on the deselected channel.
enum
@ -5358,7 +5419,7 @@ cmDspRC_t _cmDsp1Up_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* e
return rc;
}
struct cmDspClass_str* cm1UpClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cm1UpClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cm1Up_DC,ctx,"1Up",
NULL,
@ -5373,8 +5434,10 @@ struct cmDspClass_str* cm1UpClassCons( cmDspCtx_t* ctx )
return &_cm1Up_DC;
}
//==========================================================================================================================================
// Convert a 'true'/'false' gate to an 'on'/'off' symbol
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspGateToSym file_desc:"Convert a 'true'/'false' gate to an 'on'/'off' symbol." kw:[sunit] }
//
enum
{
kOnSymGsId,
@ -5456,7 +5519,7 @@ cmDspRC_t _cmDspGateToSym_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
return rc;
}
struct cmDspClass_str* cmGateToSymClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmGateToSymClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmGateToSym_DC,ctx,"GateToSym",
NULL,
@ -5471,7 +5534,9 @@ struct cmDspClass_str* cmGateToSymClassCons( cmDspCtx_t* ctx )
return &_cmGateToSym_DC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspPortToSym file_desc:"Send a pre-defined symbol every time a message arrives a given input port." kw:[sunit] }
enum
{
kOutPtsId,
@ -5571,7 +5636,7 @@ cmDspRC_t _cmDspPortToSym_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
return rc;
}
struct cmDspClass_str* cmPortToSymClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmPortToSymClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmPortToSym_DC,ctx,"PortToSym",
NULL,
@ -5586,7 +5651,9 @@ struct cmDspClass_str* cmPortToSymClassCons( cmDspCtx_t* ctx )
return &_cmPortToSym_DC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspRouter file_desc:"Route the input value to one of multiple output ports." kw:[sunit] }
enum
{
@ -5729,13 +5796,11 @@ cmDspRC_t _cmDspRouter_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return kOkDspRC;
}
/*
if( evt->dstVarId == kOutChIdxRtId && cmDsvGetUInt(evt->valuePtr) < p->oChCnt )
{
const cmChar_t* symLbl = cmSymTblLabel(ctx->stH,inst->symId);
cmDspInstErr(ctx,inst,kOkDspRC,"Router: ch:%i %s\n",cmDsvGetUInt(evt->valuePtr),symLbl==NULL?"":symLbl);
}
*/
// if( evt->dstVarId == kOutChIdxRtId && cmDsvGetUInt(evt->valuePtr) < p->oChCnt )
// {
// const cmChar_t* symLbl = cmSymTblLabel(ctx->stH,inst->symId);
// cmDspInstErr(ctx,inst,kOkDspRC,"Router: ch:%i %s\n",cmDsvGetUInt(evt->valuePtr),symLbl==NULL?"":symLbl);
// }
// store the incoming value
if( evt->dstVarId < p->baseBaseOutRtId )
@ -5763,7 +5828,7 @@ cmDspRC_t _cmDspRouter_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return rc;
}
struct cmDspClass_str* cmRouterClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmRouterClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmRouter_DC,ctx,"Router",
NULL,
@ -5778,7 +5843,10 @@ struct cmDspClass_str* cmRouterClassCons( cmDspCtx_t* ctx )
return &_cmRouter_DC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspAvailCh file_desc:"Track active an inactive processing channels." kw:[sunit] }
//
// Purpose: AvailCh can be used to implement a channel switching circuit.
//
// Inputs:
@ -6061,7 +6129,7 @@ cmDspRC_t _cmDspAvailCh_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmAvailChClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmAvailChClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmAvailCh_DC,ctx,"AvailCh",
NULL,
@ -6077,7 +6145,9 @@ struct cmDspClass_str* cmAvailChClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspPreset file_desc:"Store and recall preset. Show a preset list user interface unit." kw:[sunit] }
enum
{
@ -6333,7 +6403,7 @@ cmDspRC_t _cmDspPreset_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return rc;
}
struct cmDspClass_str* cmPresetClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmPresetClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmPreset_DC,ctx,"Preset",
NULL,
@ -6349,7 +6419,9 @@ struct cmDspClass_str* cmPresetClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspBcastSym file_desc:"Broadcast a symbol/value to all units registered to listen for the symbol." kw:[sunit] }
enum
{
@ -6412,7 +6484,7 @@ cmDspRC_t _cmDspBcastSym_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
return rc;
}
struct cmDspClass_str* cmBcastSymClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmBcastSymClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmBcastSym_DC,ctx,"BcastSym",
NULL,
@ -6427,7 +6499,9 @@ struct cmDspClass_str* cmBcastSymClassCons( cmDspCtx_t* ctx )
return &_cmBcastSym_DC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspSegLine file_desc:"Line segment generator." kw:[sunit] }
enum
{
kRsrcSlId,
@ -6545,7 +6619,7 @@ cmDspRC_t _cmDspSegLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return rc;
}
struct cmDspClass_str* cmSegLineClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmSegLineClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmSegLineDC,ctx,"SegLine",
NULL,
@ -6560,3 +6634,4 @@ struct cmDspClass_str* cmSegLineClassCons( cmDspCtx_t* ctx )
return &_cmSegLineDC;
}
//)

View File

@ -18,6 +18,8 @@
#include "cmThread.h"
#include "cmUdpPort.h"
#include "cmUdpNet.h"
//( { file_desc:"'snap' audio effects performance analysis units." kw:[snap]}
#include "cmTime.h"
#include "cmAudioSys.h"
#include "cmDspCtx.h"
@ -45,6 +47,10 @@
#include "cmSyncRecd.h"
#include "cmTakeSeqBldr.h"
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspKr file_desc:"Spectral non-linear distortion effect." kw:[sunit] }
enum
{
kWndSmpCntKrId,
@ -71,8 +77,6 @@ typedef struct
cmDspClass_t _cmKrDC;
//==========================================================================================================================================
cmDspInst_t* _cmDspKrAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
{
cmDspVarArg_t args[] =
@ -262,7 +266,7 @@ cmDspRC_t _cmDspKrRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt
return rc;
}
struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmKrClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmKrDC,ctx,"Kr",
NULL,
@ -277,9 +281,9 @@ struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx )
return &_cmKrDC;
}
//==========================================================================================================================================
// Time Line UI Object
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspTimeLine file_desc:"Time line user interface unit." kw:[sunit] }
enum
{
@ -446,7 +450,7 @@ cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return kOkDspRC;
}
struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmTimeLineClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmTimeLineDC,ctx,"TimeLine",
NULL,
@ -461,8 +465,9 @@ struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx )
return &_cmTimeLineDC;
}
//==========================================================================================================================================
// Score UI Object
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspScore file_desc:"Musical score user interface unit." kw:[sunit] }
enum
{
@ -637,7 +642,7 @@ cmDspRC_t _cmDspScoreRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return kOkDspRC;
}
struct cmDspClass_str* cmScoreClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmScoreClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmScoreDC,ctx,"Score",
NULL,
@ -652,8 +657,9 @@ struct cmDspClass_str* cmScoreClassCons( cmDspCtx_t* ctx )
return &_cmScoreDC;
}
//==========================================================================================================================================
// MIDI File Player
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspMidiFilePlay file_desc:"MIDI file player." kw:[sunit] }
enum
{
@ -684,14 +690,12 @@ typedef struct
bool errFl;
} cmDspMidiFilePlay_t;
/*
'bsi' and 'esi' give the starting and ending sample for MIDI file playback.
These indexes are relative to the start of the file.
When the player recieves a 'start' msg it sets the current sample index
'si' to 'bsi' and begins scanning for the next note to play.
On each call to the _cmDspMidiFilePlayExec() msgs that fall in the interval
si:si+sPc-1 will be transmitted. (where sPc are the number of samples per DSP cycle).
*/
// 'bsi' and 'esi' give the starting and ending sample for MIDI file playback.
// These indexes are relative to the start of the file.
// When the player recieves a 'start' msg it sets the current sample index
// 'si' to 'bsi' and begins scanning for the next note to play.
// On each call to the _cmDspMidiFilePlayExec() msgs that fall in the interval
// si:si+sPc-1 will be transmitted. (where sPc are the number of samples per DSP cycle).
cmDspInst_t* _cmDspMidiFilePlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
{
@ -866,7 +870,7 @@ cmDspRC_t _cmDspMidiFilePlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDsp
return kOkDspRC;
}
struct cmDspClass_str* cmMidiFilePlayClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmMidiFilePlayClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmMidiFilePlayDC,ctx,"MidiFilePlay",
NULL,
@ -881,7 +885,10 @@ struct cmDspClass_str* cmMidiFilePlayClassCons( cmDspCtx_t* ctx )
return &_cmMidiFilePlayDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspScFol file_desc:"MIDI performance score follower." kw:[sunit] }
enum
{
kFnSfId,
@ -1003,27 +1010,25 @@ void _cmScFolMatcherCb( cmScMatcher* p, void* arg, cmScMatcherResult_t* rp )
if(ap->sfp->smp->set[i].value != DBL_MAX )
{
/*
switch( ap->sfp->smp->set[i].sp->varId )
{
case kEvenVarScId:
cmDspSetDouble(ap->ctx,inst,kEvenSfId,ap->sfp->smp->set[i].value);
break;
case kDynVarScId:
cmDspSetDouble(ap->ctx,inst,kDynSfId,ap->sfp->smp->set[i].value);
break;
case kTempoVarScId:
cmDspSetDouble(ap->ctx,inst,kTempoSfId,ap->sfp->smp->set[i].value);
break;
default:
{ assert(0); }
}
cmDspSetDouble(ap->ctx,inst,kCostSfId,ap->sfp->smp->set[i].match_cost);
*/
// switch( ap->sfp->smp->set[i].sp->varId )
// {
// case kEvenVarScId:
// cmDspSetDouble(ap->ctx,inst,kEvenSfId,ap->sfp->smp->set[i].value);
// break;
//
// case kDynVarScId:
// cmDspSetDouble(ap->ctx,inst,kDynSfId,ap->sfp->smp->set[i].value);
// break;
//
// case kTempoVarScId:
// cmDspSetDouble(ap->ctx,inst,kTempoSfId,ap->sfp->smp->set[i].value);
// break;
//
// default:
// { assert(0); }
// }
//
// cmDspSetDouble(ap->ctx,inst,kCostSfId,ap->sfp->smp->set[i].match_cost);
// Set the values in the global variable storage
cmDspValue_t vv,cv;
@ -1051,15 +1056,13 @@ void _cmScFolMatcherCb( cmScMatcher* p, void* arg, cmScMatcherResult_t* rp )
}
/*
// trigger 'section' starts
for(i=ap->sfp->smp->vsli; i<ap->sfp->smp->nsli; ++i)
{
const cmScoreLoc_t* locPtr = cmScoreLoc(ap->sfp->smp->mp->scH,i);
if( locPtr->begSectPtr != NULL )
cmDspSetUInt(ap->ctx,inst,kSectIndexSfId,locPtr->begSectPtr->index);
}
*/
// // trigger 'section' starts
// for(i=ap->sfp->smp->vsli; i<ap->sfp->smp->nsli; ++i)
// {
// const cmScoreLoc_t* locPtr = cmScoreLoc(ap->sfp->smp->mp->scH,i);
// if( locPtr->begSectPtr != NULL )
// cmDspSetUInt(ap->ctx,inst,kSectIndexSfId,locPtr->begSectPtr->index);
// }
}
}
@ -1184,7 +1187,7 @@ cmDspRC_t _cmDspScFolRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmScFolClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmScFolClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmScFolDC,ctx,"ScFol",
NULL,
@ -1199,7 +1202,9 @@ struct cmDspClass_str* cmScFolClassCons( cmDspCtx_t* ctx )
return &_cmScFolDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspScMod file_desc:"Score driven parameter automation." kw:[sunit] }
enum
{
@ -1385,7 +1390,7 @@ cmDspRC_t _cmDspScModExec(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return rc;
}
struct cmDspClass_str* cmScModClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmScModClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmModulatorDC,ctx,"ScMod",
NULL,
@ -1400,7 +1405,9 @@ struct cmDspClass_str* cmScModClassCons( cmDspCtx_t* ctx )
return &_cmModulatorDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspGSwitch file_desc:"Route all inputs to one of a group of outputs." kw:[sunit] }
enum
{
@ -1583,7 +1590,7 @@ cmDspRC_t _cmDspGSwitchRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
}
struct cmDspClass_str* cmGSwitchClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmGSwitchClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmGSwitchDC,ctx,"GSwitch",
NULL,
@ -1599,7 +1606,9 @@ struct cmDspClass_str* cmGSwitchClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspScaleRange file_desc:"Offset and scale a scalar value." kw:[sunit] }
enum
{
@ -1684,7 +1693,7 @@ cmDspRC_t _cmDspScaleRangeRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
}
struct cmDspClass_str* cmScaleRangeClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmScaleRangeClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmScaleRangeDC,ctx,"ScaleRange",
NULL,
@ -1700,7 +1709,9 @@ struct cmDspClass_str* cmScaleRangeClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspActiveMeas file_desc:"Issue stored parameter values at specified score locations." kw:[sunit] }
enum
{
@ -1730,12 +1741,10 @@ typedef struct cmDspAmRecd_str
} cmDspAmRecd_t;
/*
int cmDspActiveMeasRecdCompare(const void * p0, const void * p1)
{
return ((int)((cmDspActiveMeasRecd_t*)p0)->loc) - (int)(((cmDspActiveMeasRecd_t*)p1)->loc);
}
*/
//int cmDspActiveMeasRecdCompare(const void * p0, const void * p1)
//{
// return ((int)((cmDspActiveMeasRecd_t*)p0)->loc) - (int)(((cmDspActiveMeasRecd_t*)p1)->loc);
//}
typedef struct
{
@ -1985,96 +1994,94 @@ cmDspRC_t _cmDspActiveMeasRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
}
/*
switch( evt->dstVarId )
{
case kSflocAmId:
if( p->nextFullIdx != cmInvalidIdx )
{
// get the recv'd score location
unsigned sflocIdx = cmDspUInt(inst,kSflocAmId);
unsigned prvLoc = cmInvalidIdx;
// for each remaining avail record
for(; p->nextFullIdx < p->nextEmptyIdx; p->nextFullIdx++)
{
cmDspActiveMeasRecd_t* r = p->array + p->nextFullIdx;
// if this records score location is after the recv'd score loc then we're done
if( r->loc > sflocIdx )
break;
// deterimine the records type
unsigned varId = cmInvalidId;
switch( r->type )
{
case kEvenVarScId: varId = kEvenAmId; break;
case kDynVarScId: varId = kDynAmId; break;
case kTempoVarScId: varId = kTempoAmId; break;
default:
{ assert(0); }
}
// if this score location has not yet been sent then send it now
if( prvLoc != r->loc )
cmDspSetUInt(ctx,inst,kScLocAmId,r->loc);
// transmit the records value and cost
cmDspSetDouble(ctx,inst,varId,r->value);
cmDspSetDouble(ctx,inst,kCostAmId,r->cost);
prvLoc = r->loc;
}
}
break;
case kCmdAmId:
{
unsigned cmdSymId = cmDspSymbol(inst,kCmdAmId);
if( cmdSymId == p->addSymId )
{
if( p->nextEmptyIdx >= p->cnt )
cmDspInstErr(ctx,inst,kProcFailDspRC,"The active measurement list is full cnt=%i.",p->cnt);
else
{
cmDspActiveMeasRecd_t* r = p->array + p->nextEmptyIdx;
r->loc = cmDspUInt( inst,kLocAmId);
r->type = cmDspUInt( inst,kTypeAmId);
r->value = cmDspDouble(inst,kValueAmId);
r->cost = cmDspDouble(inst,kCstAmId);
p->nextEmptyIdx += 1;
qsort(p->array,p->nextEmptyIdx,sizeof(p->array[0]),cmDspActiveMeasRecdCompare);
if( p->nextEmptyIdx == 1 && p->nextFullIdx == cmInvalidIdx )
p->nextFullIdx = 0;
}
}
if( cmdSymId == p->clearSymId )
rc = _cmDspActiveMeasClear(ctx,p);
else
if( cmdSymId == p->printSymId )
rc = _cmDspActiveMeasPrint(ctx,p);
else
if(cmdSymId == p->rewindSymId )
p->nextFullIdx = 0;
}
break;
}
*/
// switch( evt->dstVarId )
// {
// case kSflocAmId:
// if( p->nextFullIdx != cmInvalidIdx )
// {
// // get the recv'd score location
// unsigned sflocIdx = cmDspUInt(inst,kSflocAmId);
//
// unsigned prvLoc = cmInvalidIdx;
//
// // for each remaining avail record
// for(; p->nextFullIdx < p->nextEmptyIdx; p->nextFullIdx++)
// {
// cmDspActiveMeasRecd_t* r = p->array + p->nextFullIdx;
//
// // if this records score location is after the recv'd score loc then we're done
// if( r->loc > sflocIdx )
// break;
//
// // deterimine the records type
// unsigned varId = cmInvalidId;
// switch( r->type )
// {
// case kEvenVarScId: varId = kEvenAmId; break;
// case kDynVarScId: varId = kDynAmId; break;
// case kTempoVarScId: varId = kTempoAmId; break;
// default:
// { assert(0); }
// }
//
// // if this score location has not yet been sent then send it now
// if( prvLoc != r->loc )
// cmDspSetUInt(ctx,inst,kScLocAmId,r->loc);
//
// // transmit the records value and cost
// cmDspSetDouble(ctx,inst,varId,r->value);
// cmDspSetDouble(ctx,inst,kCostAmId,r->cost);
//
// prvLoc = r->loc;
// }
//
//
// }
// break;
//
// case kCmdAmId:
// {
// unsigned cmdSymId = cmDspSymbol(inst,kCmdAmId);
//
// if( cmdSymId == p->addSymId )
// {
// if( p->nextEmptyIdx >= p->cnt )
// cmDspInstErr(ctx,inst,kProcFailDspRC,"The active measurement list is full cnt=%i.",p->cnt);
// else
// {
// cmDspActiveMeasRecd_t* r = p->array + p->nextEmptyIdx;
// r->loc = cmDspUInt( inst,kLocAmId);
// r->type = cmDspUInt( inst,kTypeAmId);
// r->value = cmDspDouble(inst,kValueAmId);
// r->cost = cmDspDouble(inst,kCstAmId);
// p->nextEmptyIdx += 1;
//
// qsort(p->array,p->nextEmptyIdx,sizeof(p->array[0]),cmDspActiveMeasRecdCompare);
//
// if( p->nextEmptyIdx == 1 && p->nextFullIdx == cmInvalidIdx )
// p->nextFullIdx = 0;
//
// }
// }
//
// if( cmdSymId == p->clearSymId )
// rc = _cmDspActiveMeasClear(ctx,p);
// else
// if( cmdSymId == p->printSymId )
// rc = _cmDspActiveMeasPrint(ctx,p);
// else
// if(cmdSymId == p->rewindSymId )
// p->nextFullIdx = 0;
// }
// break;
//
// }
return rc;
}
struct cmDspClass_str* cmActiveMeasClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmActiveMeasClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmActiveMeasDC,ctx,"ActiveMeas",
NULL,
@ -2089,33 +2096,35 @@ struct cmDspClass_str* cmActiveMeasClassCons( cmDspCtx_t* ctx )
return &_cmActiveMeasDC;
}
//==========================================================================================================================================
// Audio MIDI Sync
/*
Usage:
1) In the program resource file setup a list of sync points.
'asmp' refers to a sample offset into the audio file 'af'
which should match to the midi event index 'mid' in the
midi file 'mf'.
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspAmSync file_desc:"Calculate MIDI to Audio latency offsets." kw:[sunit] }
//
//
// Usage:
// 1) In the program resource file setup a list of sync points.
// 'asmp' refers to a sample offset into the audio file 'af'
// which should match to the midi event index 'mid' in the
// midi file 'mf'.
//
// amSync :
// [
// { af:"af-16" asmp:34735276 mf:"mf-10" mid:350 }
// { af:"af-16" asmp:71802194 mf:"mf-10" mid:787 }
// ]
//
// 2) Feed the 'fidx' output from a wave table loaded with 'af' into the 'asmp' input port of this amSync object.
// Feed the 'id' output from the MIDI file player loaded with 'mf' into the 'mid' input port of this amSync object.
//
// 3) Run the players.
// 4) When the run is complete send any message to the 'sel' port of this amSync object.
// The 'frm:' field of the printed output gives the difference in samples between
// MIDI and audio sync points.
//
// If the value is positive then the MIDI point is after the Audio point.
// If the value is negative then the MIDI point is before the audio point.
//
amSync :
[
{ af:"af-16" asmp:34735276 mf:"mf-10" mid:350 }
{ af:"af-16" asmp:71802194 mf:"mf-10" mid:787 }
]
2) Feed the 'fidx' output from a wave table loaded with 'af' into the 'asmp' input port of this amSync object.
Feed the 'id' output from the MIDI file player loaded with 'mf' into the 'mid' input port of this amSync object.
3) Run the players.
4) When the run is complete send any message to the 'sel' port of this amSync object.
The 'frm:' field of the printed output gives the difference in samples between
MIDI and audio sync points.
If the value is positive then the MIDI point is after the Audio point.
If the value is negative then the MIDI point is before the audio point.
*/
enum
{
@ -2350,7 +2359,7 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
return kOkDspRC;
}
struct cmDspClass_str* cmAmSyncClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmAmSyncClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmAmSyncDC,ctx,"AmSync",
NULL,
@ -2365,7 +2374,10 @@ struct cmDspClass_str* cmAmSyncClassCons( cmDspCtx_t* ctx )
return &_cmAmSyncDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspNanoMap file_desc:"Control a MIDI synth." kw:[sunit] }
enum
{
kPgmNmId,
@ -2474,7 +2486,7 @@ cmDspRC_t _cmDspNanoMapRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
return kOkDspRC;
}
struct cmDspClass_str* cmNanoMapClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmNanoMapClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmNanoMapDC,ctx,"NanoMap",
NULL,
@ -2490,7 +2502,10 @@ struct cmDspClass_str* cmNanoMapClassCons( cmDspCtx_t* ctx )
return &_cmNanoMapDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspRecdPlay file_desc:"Record audio segments from a live perfromance and play them back at a later time" kw:[sunit] }
enum
{
kChCntPrId,
@ -2850,7 +2865,7 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return kOkDspRC;
}
struct cmDspClass_str* cmRecdPlayClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmRecdPlayClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmRecdPlayDC,ctx,"RecdPlay",
NULL,
@ -2866,7 +2881,9 @@ struct cmDspClass_str* cmRecdPlayClassCons( cmDspCtx_t* ctx )
return &_cmRecdPlayDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspGoertzel file_desc:"Goertzel tone detection filter" kw:[sunit] }
enum
{
kHopFactGrId,
@ -3025,7 +3042,7 @@ cmDspRC_t _cmDspGoertzelRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return kOkDspRC;
}
struct cmDspClass_str* cmGoertzelClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmGoertzelClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmGoertzelDC,ctx,"Goertzel",
NULL,
@ -3041,7 +3058,10 @@ struct cmDspClass_str* cmGoertzelClassCons( cmDspCtx_t* ctx )
return &_cmGoertzelDC;
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspSyncRecd file_desc:"Time align a MIDI and associated audio recording" kw:[sunit] }
enum
{
kRecdDirSrId,
@ -3226,7 +3246,7 @@ cmDspRC_t _cmDspSyncRecdRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
return rc;
}
struct cmDspClass_str* cmSyncRecdClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmSyncRecdClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmSyncRecdDC,ctx,"SyncRecd",
NULL,
@ -3243,7 +3263,10 @@ struct cmDspClass_str* cmSyncRecdClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspTakeSeqBldr file_desc:"User interface unit for creating a single sequence from multiple, score aligned, MIDI fragments." kw:[sunit] }
enum
{
kFnTsbId,
@ -3355,7 +3378,7 @@ cmDspRC_t _cmDspTakeSeqBldrRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspE
return kOkDspRC;
}
struct cmDspClass_str* cmTakeSeqBldrClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmTakeSeqBldrClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmTakeSeqBldrDC,ctx,"TakeSeqBldr",
NULL,
@ -3374,7 +3397,9 @@ struct cmDspClass_str* cmTakeSeqBldrClassCons( cmDspCtx_t* ctx )
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspTakeSeqRend file_desc:"User interface unit for graphically rendering the MIDI sequences created by cmDspTakeSeqBldr." kw:[sunit] }
enum
{
kBldrTsrId,
@ -3576,7 +3601,7 @@ cmDspRC_t _cmDspTakeSeqRendRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspE
return kOkDspRC;
}
struct cmDspClass_str* cmTakeSeqRendClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmTakeSeqRendClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmTakeSeqRendDC,ctx,"TakeSeqRend",
NULL,
@ -3593,7 +3618,9 @@ struct cmDspClass_str* cmTakeSeqRendClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspReflectCalc file_desc:"Estimate the time-of-flight of from an acoustic signal from a speaker to a microphone." kw:[sunit] }
enum
{
kLfsrN_RcId,
@ -3622,13 +3649,11 @@ typedef struct
cmDspInst_t* _cmDspReflectCalcAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
{
/*
if( va_cnt !=3 )
{
cmDspClassErr(ctx,classPtr,kVarArgParseFailDspRC,"The 'ReflectCalc' constructor must have two arguments: a channel count and frequency array.");
return NULL;
}
*/
// if( va_cnt !=3 )
// {
// cmDspClassErr(ctx,classPtr,kVarArgParseFailDspRC,"The 'ReflectCalc' constructor must have two arguments: a channel count and frequency array.");
// return NULL;
// }
cmDspReflectCalc_t* p = cmDspInstAllocV(cmDspReflectCalc_t,ctx,classPtr,instSymId,id,storeSymId,va_cnt,vl,
1, "lfsrN", kLfsrN_RcId, 0,0, kInDsvFl | kUIntDsvFl, "Gold code generator LFSR length",
@ -3734,7 +3759,7 @@ cmDspRC_t _cmDspReflectCalcRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspE
return kOkDspRC;
}
struct cmDspClass_str* cmReflectCalcClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmReflectCalcClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmReflectCalcDC,ctx,"ReflectCalc",
NULL,
@ -3751,7 +3776,9 @@ struct cmDspClass_str* cmReflectCalcClassCons( cmDspCtx_t* ctx )
}
//==========================================================================================================================================
//------------------------------------------------------------------------------------------------------------
//)
//( { label:cmDspEchoCancel file_desc:"Normalized least mean squares echo canceller." kw:[sunit] }
enum
{
kMuEcId,
@ -3775,13 +3802,11 @@ typedef struct
cmDspInst_t* _cmDspEchoCancelAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
{
/*
if( va_cnt !=3 )
{
cmDspClassErr(ctx,classPtr,kVarArgParseFailDspRC,"The 'EchoCancel' constructor must have two arguments: a channel count and frequency array.");
return NULL;
}
*/
// if( va_cnt !=3 )
// {
// cmDspClassErr(ctx,classPtr,kVarArgParseFailDspRC,"The 'EchoCancel' constructor must have two arguments: a channel count and frequency array.");
// return NULL;
// }
cmDspEchoCancel_t* p = cmDspInstAllocV(cmDspEchoCancel_t,ctx,classPtr,instSymId,id,storeSymId,va_cnt,vl,
1, "mu", kMuEcId, 0,0, kInDsvFl | kDoubleDsvFl, "NLSM mu coefficient.",
@ -3905,7 +3930,7 @@ cmDspRC_t _cmDspEchoCancelRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
return kOkDspRC;
}
struct cmDspClass_str* cmEchoCancelClassCons( cmDspCtx_t* ctx )
cmDspClass_t* cmEchoCancelClassCons( cmDspCtx_t* ctx )
{
cmDspClassSetup(&_cmEchoCancelDC,ctx,"EchoCancel",
NULL,
@ -3920,3 +3945,4 @@ struct cmDspClass_str* cmEchoCancelClassCons( cmDspCtx_t* ctx )
return &_cmEchoCancelDC;
}
//)

View File

@ -5,6 +5,8 @@
extern "C" {
#endif
//( { file_desc:"'snap' distributed host UDP networking implementation." kw:[snap]}
#define cmDspSys_PARENT_SYM_TBL_BASE_ID 10000
#define cmDspSys_AsSubIdx_Zero (0)
@ -115,6 +117,8 @@ extern "C" {
cmDspRC_t _cmDspSysNetSendEvent( cmDspSysH_t h, unsigned dstNetNodeId, unsigned dstId, const cmDspEvt_t* evt );
//)
#ifdef __cplusplus
}
#endif

View File

@ -1,3 +1,4 @@
//( { file_desc:"'snap' programs." kw:[snap] }
#include "cmPrefix.h"
#include "cmGlobal.h"
#include "cmFloatTypes.h"
@ -25,7 +26,8 @@
#include "cmDspPgm.h"
#include "cmDspPgmPP.h"
#include "cmDspPgmKr.h"
//)
//( { label:cmDspPgm_ReflecCalc file_desc:"Acoustic time-of-flight measurement program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_ReflectCalc( cmDspSysH_t h, void** userPtrPtr )
{
@ -71,6 +73,10 @@ cmDspRC_t _cmDspSysPgm_ReflectCalc( cmDspSysH_t h, void** userPtrPtr )
return kOkDspRC;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_SyncRecd file_desc:"Generate MIDI / Audio synchronization data with cmDspSyncRecd." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_SyncRecd( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -115,6 +121,9 @@ cmDspRC_t _cmDspSysPgm_SyncRecd( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_MidiFilePlay file_desc:"MIDI file player example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_MidiFilePlay( cmDspSysH_t h, void** userPtrPtr )
{
@ -198,7 +207,9 @@ cmDspRC_t _cmDspSysPgm_MidiFilePlay( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Midi_Test file_desc:"MIDI input/output example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Test_Midi( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -250,6 +261,9 @@ cmDspRC_t _cmDspSysPgm_Test_Midi( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Stereo_Through file_desc:"Stereo audio through example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
{
@ -299,6 +313,9 @@ cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
return kOkDspRC;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Stereo_Fx file_desc:"Stereo audio effects example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Stereo_Fx( cmDspSysH_t h, void** userPtrPtr )
{
bool useBuiltInFl = true;
@ -367,6 +384,9 @@ cmDspRC_t _cmDspSysPgm_Stereo_Fx( cmDspSysH_t h, void** userPtrPtr )
return kOkDspRC;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_PlaySine file_desc:"Play a sine signal." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_PlaySine( cmDspSysH_t h, void** userPtrPtr )
{
bool useBuiltInFl = true;
@ -424,6 +444,9 @@ cmDspRC_t _cmDspSysPgm_PlayFile( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_MultiOut file_desc:"Play to multiple output channels example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_MultiOut( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -486,6 +509,9 @@ cmDspRC_t _cmDspSysPgm_MultiOut( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_MultiIn file_desc:"Multiple audio inputs example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_MultiIn(cmDspSysH_t h, void** userPtrPtr)
{
int chCnt = 8;
@ -516,6 +542,9 @@ cmDspRC_t _cmDspSysPgm_MultiIn(cmDspSysH_t h, void** userPtrPtr)
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_GateDetect file_desc:"Gate detector example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_GateDetect( cmDspSysH_t h, void** userPtrPtr )
{
bool useBuiltInFl = true;
@ -556,6 +585,9 @@ cmDspRC_t _cmDspSysPgm_GateDetect( cmDspSysH_t h, void** userPtrPtr )
return kOkDspRC;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Record file_desc:"Record audio to an audio file." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Record(cmDspSysH_t h, void** userPtrPtr)
{
int chCnt = 8;
@ -593,6 +625,9 @@ cmDspRC_t _cmDspSysPgm_Record(cmDspSysH_t h, void** userPtrPtr)
return kOkDspRC;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_PitchShift file_desc:"Pitch-shifter example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_PitchShiftFile( cmDspSysH_t h, void** userPtrPtr )
{
bool useBuiltInFl = true;
@ -634,6 +669,9 @@ cmDspRC_t _cmDspSysPgm_PitchShiftFile( cmDspSysH_t h, void** userPtrPtr )
return kOkDspRC;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_LoopRecd file_desc:"Loop-recorder example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_LoopRecd( cmDspSysH_t h, void** userPtrPtr )
{
bool useBuiltInFl = true;
@ -670,6 +708,9 @@ cmDspRC_t _cmDspSysPgm_LoopRecd( cmDspSysH_t h, void** userPtrPtr )
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_UiTest file_desc:"User Interface example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_UiTest(cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -716,6 +757,9 @@ cmDspRC_t _cmDspSysPgm_UiTest(cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Xfade file_desc:"Cross fader example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Xfade( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -779,6 +823,9 @@ cmDspRC_t _cmDspSysPgm_Xfade( cmDspSysH_t h, void** userPtrPtr )
return cmDspSysLastRC(h);
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Pgm6 file_desc:"Stereo strectral non-linear distortion example." kw:[spgm] }
cmDspRC_t _cmDspSysPgm6( cmDspSysH_t h, void* audioDir )
{
cmDspRC_t rc = kOkDspRC;
@ -917,6 +964,9 @@ cmDspRC_t _cmDspSysPgm6( cmDspSysH_t h, void* audioDir )
return cmDspSysLastRC(h);
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Guitar file_desc:"Similiar to Pgm6." kw:[spgm] }
cmDspRC_t _cmDspSysPgmGuitar( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -1056,6 +1106,9 @@ cmDspRC_t _cmDspSysPgmGuitar( cmDspSysH_t h, void** userPtrPtr )
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Pickups0 file_desc:"'fluxo' with loop-record, echo, rectify, and pitch-shift." kw:[spgm fluxo] }
cmDspRC_t _cmDspSysPgm_Pickups0( cmDspSysH_t h, void** userPtrPtr )
{
@ -1169,6 +1222,10 @@ cmDspRC_t _cmDspSysPgm_Pickups0( cmDspSysH_t h, void** userPtrPtr )
return kOkDspRC;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_AutoGain file_desc:"'fluxo' channel calibration program." kw:[spgm fluxo] }
#include "cmAudioFile.h"
#include "cmProcObj.h"
#include "cmProc.h"
@ -1414,6 +1471,9 @@ cmDspRC_t _cmDspSysPgm_AutoGain( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_PickupFxFile file_desc:"'fluxo' noise shapers." kw:[spgm fluxo] }
cmDspRC_t _cmDspSysPgm_PickupFxFile( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -1509,6 +1569,9 @@ cmDspRC_t _cmDspSysPgm_PickupFxFile( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_NoiseTails file_desc:"'fluxo' noise shapers." kw:[spgm fluxo] }
cmDspRC_t _cmDspSysPgm_NoiseTails( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -1609,6 +1672,9 @@ cmDspRC_t _cmDspSysPgm_NoiseTails( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_NoiseTails2 file_desc:"'fluxo' noise shapers." kw:[spgm fluxo] }
cmDspRC_t _cmDspSysPgm_NoiseTails2( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -1781,6 +1847,9 @@ cmDspRC_t _cmDspSysPgm_NoiseTails2( cmDspSysH_t h, void** userPtrPtr )
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_CombFilt file_desc:"Comb filter example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_CombFilt( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -1808,6 +1877,9 @@ cmDspRC_t _cmDspSysPgm_CombFilt( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_ScalarOp file_desc:"Scalar operations example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_ScalarOp( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -1839,6 +1911,9 @@ cmDspRC_t _cmDspSysPgm_ScalarOp( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_RingMod file_desc:"Ring modulation example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_RingMod( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -1948,6 +2023,9 @@ cmDspRC_t _cmDspSysPgm_RingMod( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_RingMod2 file_desc:"Ring modulation example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_RingMod2( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2037,6 +2115,9 @@ cmDspRC_t _cmDspSysPgm_RingMod2( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_MsgDelay file_desc:"Message delay example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_MsgDelay( cmDspSysH_t h, void** userPtrPtr )
{
@ -2059,6 +2140,9 @@ cmDspRC_t _cmDspSysPgm_MsgDelay( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Adsr file_desc:"ADSR envelope generator example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Adsr( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2108,6 +2192,10 @@ cmDspRC_t _cmDspSysPgm_Adsr( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Adsr file_desc:"Dynamics compressor example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Compressor( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2170,6 +2258,9 @@ cmDspRC_t _cmDspSysPgm_Compressor( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_BiQuadEq file_desc:"Biquad EQ example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_BiQuadEq( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2218,6 +2309,9 @@ cmDspRC_t _cmDspSysPgm_BiQuadEq( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_DistDs file_desc:"Guitar distortion example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_DistDs( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2274,6 +2368,9 @@ cmDspRC_t _cmDspSysPgm_DistDs( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Seq file_desc:"Message list 'seq' mode example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Seq( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2300,6 +2397,9 @@ cmDspRC_t _cmDspSysPgm_Seq( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_ThunkNet file_desc:"UDP network receiver example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_ThunkNet( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2318,6 +2418,9 @@ cmDspRC_t _cmDspSysPgm_ThunkNet( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_WhirlNet file_desc:"UDP network sender example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_WhirlNet( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2335,6 +2438,9 @@ cmDspRC_t _cmDspSysPgm_WhirlNet( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_NofM file_desc:"Select NofM example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_NofM( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2403,6 +2509,9 @@ cmDspRC_t _cmDspSysPgm_NofM( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_1ofM file_desc:"Select 1 of N example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_1ofN( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2438,6 +2547,9 @@ cmDspRC_t _cmDspSysPgm_1ofN( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Router file_desc:"Router example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Router( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2476,6 +2588,9 @@ cmDspRC_t _cmDspSysPgm_Router( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Preset file_desc:"Preset save/restore example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Preset( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2516,6 +2631,9 @@ cmDspRC_t _cmDspSysPgm_Preset( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_RsrcWr file_desc:"Set a resource value example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_RsrcWr( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2545,6 +2663,9 @@ cmDspRC_t _cmDspSysPgm_RsrcWr( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_1Up file_desc:"1Up example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_1Up( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2572,6 +2693,9 @@ cmDspRC_t _cmDspSysPgm_1Up( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_PortToSym file_desc:"PortToSym example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_PortToSym( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2606,6 +2730,9 @@ cmDspRC_t _cmDspSysPgm_PortToSym( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Line file_desc:"Line generator example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Line( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2637,6 +2764,9 @@ cmDspRC_t _cmDspSysPgm_Line( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Array file_desc:"Array and pitch converter example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Array( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2683,6 +2813,9 @@ cmDspRC_t _cmDspSysPgm_SegLine( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_AvailCh file_desc:"AvailCh and XFader example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_AvailCh( cmDspSysH_t h, void** userPtrPtr )
{
double frqHz = 440.0;
@ -2741,6 +2874,9 @@ cmDspRC_t _cmDspSysPgm_AvailCh( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Goertzel file_desc:"Goertzel detector example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Goertzel( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc;
@ -2801,6 +2937,9 @@ cmDspRC_t _cmDspSysPgm_Goertzel( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_TakeSeqBldr file_desc:"Take sequence builder example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_TakeSeqBldr( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2859,6 +2998,9 @@ cmDspRC_t _cmDspSysPgm_TakeSeqBldr( cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_TwoD file_desc:"Two dimensional controller example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_TwoD( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2878,6 +3020,9 @@ cmDspRC_t _cmDspSysPgm_TwoD( cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_BinEnc file_desc:"HRTF binaural encoder example program." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_BinEnc( cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2950,8 +3095,8 @@ cmDspRC_t _cmDspSysPgm_BinEnc( cmDspSysH_t h, void** userPtrPtr )
errLabel:
return rc;
}
//)
//(
_cmDspSysPgm_t _cmDspSysPgmArray[] =
{
{ "reflect", _cmDspSysPgm_ReflectCalc, NULL, NULL },
@ -3015,3 +3160,4 @@ _cmDspSysPgm_t* _cmDspSysPgmArrayBase()
}
//)

View File

@ -1,3 +1,5 @@
//( { file_desc:"'snap' Performance analysis related programs." kw:[snap]}
#include "cmPrefix.h"
#include "cmGlobal.h"
#include "cmFloatTypes.h"
@ -376,6 +378,10 @@ void _cmDspSys_TlXformChain( cmDspSysH_t h, cmDspTlXform_t* c, unsigned preGrpS
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_TimeLine file_desc:"Audio/MIDI sequencer for analyzing the score vs. the performance and generating related audio transforms." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -1199,6 +1205,9 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_Tksb file_desc:"Audio/MIDI sequencer for analyzing the score vs. the performance from user selected MIDI fragments and generating related audio transforms." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_Tksb(cmDspSysH_t h, void** userPtrPtr )
{
cmDspRC_t rc = kOkDspRC;
@ -2038,6 +2047,9 @@ cmDspRC_t _cmDspSysPgm_Tksb(cmDspSysH_t h, void** userPtrPtr )
}
//------------------------------------------------------------------------------
//)
//( { label:cmDspPgm_TksbLIst file_desc:"A simplified version of cmDspSysPgm_Tksb." kw:[spgm] }
cmDspRC_t _cmDspSysPgm_TksbLite(cmDspSysH_t h, void** userPtrPtr )
{
@ -2343,3 +2355,4 @@ cmDspRC_t _cmDspSysPgm_TksbLite(cmDspSysH_t h, void** userPtrPtr )
return rc;
}
//)

Some files were not shown because too many files have changed in this diff Show More