Click here to Skip to main content
15,895,746 members
Articles / Desktop Programming / MFC

Sound Generator – How to create alien sounds using mathematic formulas

Rate me:
Please Sign up or sign in to vote.
4.91/5 (47 votes)
20 Jun 20046 min read 242.2K   10.3K   112  
An article on sine waves generation using math formulas.
#ifndef _MATEXCEPTION_INCLUDED
#define _MATEXCEPTION_INCLUDED


#include <vector>
#include <tchar.h>

// Throw a first exception, without parent exception
#define EXCEP(/*const wchar_t * */ desc, /*const wchar_t * */ from) throw( MATExceptions(__LINE__,  _T(__FILE__), 0, from, desc) );

// Throw an exception with its parents exceptions: chain of exceptions
#define REEXCEP(/*const wchar_t * */ desc, /*const wchar_t * */ from, /*MATExceptions*/ e) e.add(__LINE__,  __FILE__, 0, from, desc); throw(e);


class MATException
{
	long m_line;
	long m_level;
	std::wstring m_file;
	std::wstring m_from;
	std::wstring m_desc;

public:

	MATException(long line, const wchar_t *file, long level, const wchar_t *from, const wchar_t *desc);
	MATException( const MATException &obj );
	MATException& operator=(const MATException &obj);

	long getLine()const{ return m_line; } 
	long getLevel()const{ return m_level; } 
	std::wstring getFile()const{ return m_file; }
	std::wstring getFrom()const{ return m_from; }
	std::wstring getDesc()const{ return m_desc; }	
};

class MATExceptions
{
	std::vector<MATException> m_exceptions;

public:

	MATExceptions();
	MATExceptions(long line, const wchar_t *file, long level, const wchar_t *from, const wchar_t *desc);
	MATExceptions( const MATExceptions &obj );
	MATExceptions& operator=(const MATExceptions &obj );

	void add( long line, const wchar_t *file, long level, const wchar_t *from, const wchar_t *desc);
	void add( const MATExceptions &e );
	int size()const;
	const MATException* getException(int pos)const;
	std::wstring getAllExceptionStr();
};



#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Canada Canada
Software Engineer working at a fun and smart startup company

Comments and Discussions