PageRenderTime 39ms CodeModel.GetById 24ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 1ms

/external/pydirac225/source/Dirac.h

http://echo-nest-remix.googlecode.com/
C++ Header | 175 lines | 75 code | 39 blank | 61 comment | 0 complexity | 36a82d29f7f2f4bd145bc2ef7d7e3429 MD5 | raw file
  1/*--------------------------------------------------------------------------------
  2
  3 	Dirac.h
  4	
  5	Copyright (C) 2005-2010 The DSP Dimension,
  6	Stephan M. Bernsee (SMB)
  7	All rights reserved
  8
  9	CONFIDENTIAL: This document contains confidential information. 
 10	Do not disclose any information contained in this document to any
 11	third-party without the prior written consent of Stephan M. Bernsee/
 12	The DSP Dimension.
 13
 14    SMB 12-03-05        1.0.0     First source code distribution
 15    SMB 26-06-05        1.1.0     Fixed dynamic ts/ps (vh ref 0506261500)
 16    SMB 25-07-05        1.2.0     Implemented pitch correction (vh ref 0507251330)
 17    SMB 03-08-05        1.2.1     Optimized better and best quality modes (vh ref 0508031930)
 18    SMB 16-09-05        1.2.2     Reinstated formant handling (vh ref 0509161300)
 19                                  Extended ranges for pitch, time and formant handling to 10x/0.1x
 20	SMB 27-09-05		1.2.3	  Cleaned up code and reinstated package flags (vh ref 0509270830)
 21	SMB 19-10-05		1.2.4	  Removed obsolete code and fixed memory leaks (vh ref 0510191830)
 22	SMB 25-10-05		1.2.5	  Fixed interlaced channel callback on Windows (vh ref 0510251300)
 23	SMB 23-11-05		1.2.6	  Fixed quality problem in kDiracLambda1 for kDiracQualityBest
 24                                  Optimized formant handling
 25								  Formant correction now works correctly in kDiracLambda1 and
 26								  kDiracLambdaPreview (vh ref 0511231200)
 27    SMB 20-04-06        1.2.7     Several minor fixes for interlaced mode and memory allocation (vh ref 0604201500)
 28    SMB 24-04-06		1.2.8	  Fixed glitch at the beginning of the audio signal. DiracReset() should
 29    							  now be working more consistently (vh ref 0604241400)
 30    SMB 24-04-06		1.2.8r1	  Fixed glitch in sample rate converter and DiracReset() (vh ref 0604241700)
 31    SMB 25-04-06		1.2.9	  DiracReset() now has an option to clear its state buffers. Other minor fixes (vh ref 0604251000)
 32    SMB 06-08-08		1.3.0	  many minor bug fixes (vh ref 0711130830)
 33    SMB 06-08-08		1.4.0     many minor bug fixes, added Linux compatibility (vh ref 0808060830)
 34	SMB 17-05-09		1.5.0     bug fixes, increased precision, made calls ANSI C compatible  (vh ref 0905171330)
 35
 36	SMB 06-10-09		2.0.0     First release of 2.0.0. See Changelog for details (vh ref 0909291600)
 37	SMB 08-10-09		2.0.1     fixed problem with disfunctional iPhone lib (vh ref 0910081200)
 38	SMB 08-10-09		2.0.2     fixed buffer overrun (vh ref 0910081500)
 39	SMB 03-11-09		2.1.0	  fixed formant correction. Fixed accumulating sample offset when pitch shifting. Added back in
 40								  pitch correction code. Numerous minor bug fixes (vh ref 0911061600)
 41	SMB 08-12-09		2.2.0	  Fixed volume offset for certain quality/lambda settings. Fixed excessive bass and DC response 
 42								  for frequencies < 20Hz, Fixed bug that caused the formant scaling to be always reciprocal to pitch in STUDIO
 43								  Optimized kDiracLambda1 (voice mode), (vh ref 0912080900)
 44	SMB 06-04-10		2.2.5	  Fixed bug that caused crash when using very low stretch ratios. Fixed bug in DiracReset() (vh ref 1004061715)
 45
 46--------------------------------------------------------------------------------*/
 47
 48// This file contains all the constants and prototypes for the "real" DIRAC calls
 49// that you will need in your project.
 50
 51
 52#ifndef __DIRAC__
 53#define __DIRAC__
 54
 55	
 56
 57// Windows DLL definitions
 58// ----------------------------------------------------------------------------
 59
 60#ifndef TARGET_API_MAC_CARBON
 61
 62	#ifdef DIRAC_AS_DLL
 63		#define DLL_DEF_TYPE __declspec(dllexport)
 64	#else
 65		#define DLL_DEF_TYPE
 66	#endif
 67
 68#else
 69	#define DLL_DEF_TYPE __attribute__((visibility("default")))
 70#endif
 71
 72// Function prototypes
 73// ----------------------------------------------------------------------------
 74#ifdef __cplusplus
 75extern "C" {
 76#endif
 77	
 78	DLL_DEF_TYPE const char *DiracVersion(void);
 79	DLL_DEF_TYPE void *DiracCreate(long lambda, long quality, long numChannels, float sampleRate, long (*readFromChannelsCallback)(float **data, long numFrames, void *userData));
 80	DLL_DEF_TYPE void *DiracCreateInterleaved(long lambda, long quality, long numChannels, float sampleRate, long (*readFromInterleavedChannelsCallback)(float *data, long numFrames, void *userData));
 81	DLL_DEF_TYPE long DiracSetProperty(long selector, long double value, void *dirac);
 82	DLL_DEF_TYPE long double DiracGetProperty(long selector, void *dirac);
 83	DLL_DEF_TYPE void DiracReset(bool clear, void *dirac);
 84	DLL_DEF_TYPE long DiracProcess(float **audioOut, long numFrames, void *userData, void *dirac);
 85	DLL_DEF_TYPE long DiracProcessInterleaved(float *audioOut, long numFrames, void *userData, void *dirac);
 86	DLL_DEF_TYPE void DiracDestroy(void *dirac);
 87	DLL_DEF_TYPE long DiracGetInputBufferSizeInFrames(void *dirac);
 88	DLL_DEF_TYPE long double DiracValidateStretchFactor(long double factor);
 89	
 90	// available in PRO only	
 91	DLL_DEF_TYPE long DiracSetTuningTable(float *frequencyTable, long numFrequencies, void *dirac);
 92	
 93	
 94#ifdef __cplusplus
 95}
 96#endif
 97
 98
 99// Property enums
100// ----------------------------------------------------------------------------
101
102enum
103{
104	kDiracPropertyPitchFactor = 100,
105	kDiracPropertyTimeFactor,
106	kDiracPropertyFormantFactor,
107	kDiracPropertyCompactSupport,
108	kDiracPropertyCacheGranularity,
109	kDiracPropertyDoPitchCorrection,
110	kDiracPropertyPitchCorrectionBasicTuningHz,
111	kDiracPropertyPitchCorrectionSlurSpeed,
112	kDiracPropertyPitchCorrectionDoFormantCorrection,
113	kDiracPropertyPitchCorrectionFundamentalFrequency, /* experimental feature, use with caution */
114	
115	kDiracPropertyNumProperties
116};
117
118
119
120// Lambda enums
121// ----------------------------------------------------------------------------
122
123enum
124{
125	kDiracLambdaPreview = 200,
126	kDiracLambda1,
127	kDiracLambda2,
128	kDiracLambda3,
129	kDiracLambda4,
130	kDiracLambda5,
131	
132	kDiracPropertyNumLambdas
133};
134
135
136
137
138// Quality enums
139// ----------------------------------------------------------------------------
140
141enum
142{
143	kDiracQualityPreview = 300,	
144	kDiracQualityGood,
145	kDiracQualityBetter,
146	kDiracQualityBest,
147	
148	kDiracPropertyNumQualities
149};
150
151
152
153
154// Error enums
155// ----------------------------------------------------------------------------
156enum
157{
158	kDiracErrorNoErr		= 0,	
159	kDiracErrorParamErr		= -1,
160	kDiracErrorUnknownErr	= -2,
161	kDiracErrorInvalidCb	= -3,
162	kDiracErrorCacheErr		= -4,
163	kDiracErrorNotInited	= -5,
164	kDiracErrorMultipleInits	= -6,
165	kDiracErrorFeatureNotSupported	= -7,
166	kDiracErrorMemErr		= -108,
167	
168	kDiracErrorNumErrs
169};
170
171
172
173
174
175#endif /* __DIRAC__ */