complex_midi.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _COMPLEX_H_MIDI
00016 #define _COMPLEX_H_MIDI
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 struct Complex
00034 {
00035 float r, i;
00036 };
00037
00038 extern struct Complex Czero;
00039
00040
00041
00042
00043 #define MAKEC(real, imag, result) {result.r = real; result.i = imag;}
00044 #define SETTOCONJ(dest, source) {dest.r = source.r; dest.i = -source.i;}
00045
00046
00047
00048
00049 struct Complex Addc(struct Complex, struct Complex);
00050 struct Complex Subtractc(struct Complex, struct Complex);
00051 struct Complex Multiplyc(struct Complex z1, struct Complex z2);
00052 struct Complex Dividec(struct Complex z1, struct Complex z2);
00053
00054
00055 void AddCptr(struct Complex *result, struct Complex *z1, struct Complex *z2);
00056 void SubtractCptr(struct Complex *result, struct Complex *z1, struct Complex *z2);
00057 void MultiplyCptr(struct Complex *result, struct Complex *z1, struct Complex *z2);
00058 void MultiplyConjPtr(struct Complex *result, struct Complex *z1, struct Complex *z2);
00059
00060 struct Complex Scalec(struct Complex z, float scale);
00061 struct Complex Unitc(struct Complex z);
00062 float Cmag(struct Complex);
00063 float Cmag2(struct Complex);
00064 void GetEtoJtimes(float, struct Complex *);
00065 void GetScaledEtoJtimes(float Angle, struct Complex *Result, float scale);
00066 void RotateBy(float, struct Complex *);
00067
00068
00069
00070 struct Complex Csqrt(struct Complex);
00071 void GetExpc(struct Complex *Result, struct Complex z);
00072 struct Complex jtimes(struct Complex z);
00073
00074
00075 void printC(struct Complex z);
00076 float Arg(struct Complex z);
00077
00078
00079 #endif
00080