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