I am a C++ beginner but know the basics i.e writing simple code compiling and build. I have DevC++ also Visual Studio 2008.

I'm big in to audio sequencers, and would like to set up a simple delay effect in C++.

Now, I have the code (open source from a website!) but I'm not quite sure how to set up as .exe. I think I need to set up a ".H" folder in my Cdrive so I can open the code below but not sure! I have also heard I may need "TurboC"??

Thank you anyone who can help. See code below...

#ifndef STK_DELAY_H
#define STK_DELAY_H

#include "Filter.h"

namespace stk {

/***************************************************/
/***************************************************/

class Delay : public Filter
{
public:

Delay( unsigned long delay = 0, unsigned long maxDelay = 4095 );

~Delay();


void setMaximumDelay( unsigned long delay );


void setDelay( unsigned long delay );

unsigned long getDelay( void ) const { return delay_; };


StkFloat contentsAt( unsigned long tapDelay );

StkFloat lastOut( void ) const { return lastFrame_[0]; };


StkFloat nextOut( void ) { return inputs_[outPoint_]; };

StkFloat energy( void ) const;

StkFloat tick( StkFloat input );


StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );


StkFrames& tick( StkFrames& iFrames, StkFrames &oFrames, unsigned int iChannel = 0, unsigned int oChannel = 0 );

protected:

unsigned long inPoint_;
unsigned long outPoint_;
unsigned long delay_;
};

inline StkFloat Delay :: tick( StkFloat input )
{
inputs_[inPoint_++] = input * gain_;

// Check for end condition
if ( inPoint_ == inputs_.size() )
inPoint_ = 0;

// Read out next value
lastFrame_[0] = inputs_[outPoint_++];

if ( outPoint_ == inputs_.size() )
outPoint_ = 0;

return lastFrame_[0];
}

inline StkFrames& Delay :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

StkFloat *samples = &frames[channel];
unsigned int hop = frames.channels();
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
inputs_[inPoint_++] = *samples * gain_;
if ( inPoint_ == inputs_.size() ) inPoint_ = 0;
*samples = inputs_[outPoint_++];
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;
}

lastFrame_[0] = *(samples-hop);
return frames;
}

inline StkFrames& Delay :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned int iChannel, unsigned int oChannel )
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
#endif

StkFloat *iSamples = &iFrames[iChannel];
StkFloat *oSamples = &oFrames[oChannel];
unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();
inputs_[inPoint_++] = *iSamples * gain_;
if ( inPoint_ == inputs_.size() ) inPoint_ = 0;
*oSamples = inputs_[outPoint_++];
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;
}
lastFrame_[0] = *(oSamples-oHop);
return iFrames;
}

} // stk namespace

#endif