otherfile.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /*
  2. * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
  3. * http://www.trevorwishart.co.uk
  4. * http://www.composersdesktop.com
  5. *
  6. This file is part of the CDP System.
  7. The CDP System is free software; you can redistribute it
  8. and/or modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The CDP System is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the CDP System; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18. 02111-1307 USA
  19. *
  20. */
  21. Type of further main files required:
  22. 3rd item sent back from CDPARAMS......
  23. #define FILES_NONE (0)
  24. #define FILES_SND (1)
  25. #define FILES_SND_MONO (2)
  26. #define FILES_SND_SAME_CHANS (3)
  27. #define FILES_SND_MONO_ANY_SRATE (4)
  28. #define FILES_SND_ANY_SRATE (5)
  29. #define FILES_ANAL (6)
  30. #define FILES_A_AND_PCH (7)
  31. #define FILES_A_AND_TRNS (8)
  32. #define FILES_A_AND_FMNT (9)
  33. #define FILES_P_AND_FMNT (10)
  34. #define FILES_ENV (11)
  35. #define FILES_BRK (12)
  36. #define FILES_DB_BRK (13)
  37. #define FILES_TRNS_OR_BRK_TRNS (14)
  38. #define FILES_PCH_OR_BRK_PCH (15)
  39. Filetype data (originally sent from CDPARSE)
  40. which you have stored for each file on the user interface.
  41. #define SNDFILE (10)
  42. #define ANALFILE (11)
  43. #define PITCHFILE (12)
  44. #define TRANSPOSFILE (13)
  45. #define FORMANTFILE (14)
  46. #define ENVFILE (15)
  47. #define TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (16)
  48. #define TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST (17)
  49. #define TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (18)
  50. #define TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST (19)
  51. #define TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (20)
  52. #define TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST (21)
  53. #define NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (22)
  54. #define NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST (23)
  55. #define DB_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (24)
  56. #define DB_BRKFILE_OR_NUMLIST_OR_WORDLIST (25)
  57. #define PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (26)
  58. #define PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST (27)
  59. #define UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (28)
  60. #define UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST (29)
  61. #define NUMLIST_OR_LINELIST_OR_WORDLIST (30)
  62. #define NUMLIST_OR_WORDLIST (31)
  63. #define SNDLIST_OR_SYNCLIST_LINELIST_OR_WORDLIST (32)
  64. #define SNDLIST_OR_SYNCLIST_OR_WORDLIST (33)
  65. #define SNDLIST_OR_LINELIST_OR_WORDLIST (34)
  66. #define SNDLIST_OR_WORDLIST (35)
  67. #define MIXLIST_OR_LINELIST_OR_WORDLIST (36)
  68. #define MIXLIST_OR_WORDLIST (37)
  69. #define SYNCLIST_OR_LINELIST_OR_WORDLIST (38)
  70. #define SYNCLIST_OR_WORDLIST (39)
  71. #define LINELIST_OR_WORDLIST (40)
  72. #define WORDLIST (41)
  73. HOW THIS WORKS.........
  74. -----------------------
  75. case(FILES_NONE):
  76. break;
  77. case(FILES_SND):
  78. filetype of further file(s) = SNDFILE;
  79. srate ==
  80. break;
  81. case(FILES_SND_MONO):
  82. filetype of further file(s) = SNDFILE;
  83. srate ==
  84. channels = 1;
  85. break;
  86. case(FILES_SND_SAME_CHANS):
  87. filetype of further file(s) = SNDFILE;
  88. srate ==
  89. channels ==
  90. break;
  91. case(FILES_SND_MONO_ANY_SRATE):
  92. filetype of further file(s) = SNDFILE;
  93. channels = 1;
  94. break;
  95. case(FILES_SND_ANY_SRATE):
  96. filetype of further file(s) = SNDFILE;
  97. break;
  98. case(FILES_ANAL):
  99. filetype of further file(s) = ANALFILE;
  100. srate ==
  101. channels ==
  102. arate flteq()
  103. origstype ==
  104. origrate ==
  105. Mlen ==
  106. Dfac ==
  107. break;
  108. case(FILES_A_AND_PCH):
  109. filetype of further file(s) = PITCHFILE;
  110. srate ==
  111. channels(file1) == origchans(file2) <<<----- NB:!!!!***
  112. arate flteq()
  113. origstype ==
  114. origrate ==
  115. Mlen ==
  116. Dfac ==
  117. break;
  118. case(FILES_A_AND_TRNS):
  119. filetype of further file(s) = TRANSPOSFILE;
  120. srate ==
  121. channels(file1) == origchans(file2) <<<----- NB:!!!!***
  122. arate flteq()
  123. origstype ==
  124. origrate ==
  125. Mlen ==
  126. Dfac ==
  127. break;
  128. case(FILES_A_AND_FMNT):
  129. filetype of further file(s) = FORMANTFILE;
  130. srate ==
  131. channels(file1) == origchans(file2) <<<----- NB:!!!!***
  132. arate flteq()
  133. origstype ==
  134. origrate ==
  135. Mlen ==
  136. Dfac ==
  137. break;
  138. case(FILES_P_AND_FMNT):
  139. filetype of further file(s) = FORMANTFILE;
  140. srate ==
  141. origchans(file1) == origchans(file2) <<<----- NB: DIFFERENT AGAIN !!!!***
  142. arate flteq()
  143. origstype ==
  144. origrate ==
  145. Mlen ==
  146. Dfac ==
  147. break;
  148. case(FILES_ENV):
  149. filetype of further file(s) = ENVFILE;
  150. break;
  151. case(FILES_BRK):
  152. filetype of further file(s) =
  153. TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  154. || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST
  155. || NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  156. || NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST;
  157. break;
  158. case(FILES_DB_BRK):
  159. filetype of further file(s) = DB_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  160. || DB_BRKFILE_OR_NUMLIST_OR_WORDLIST;
  161. break;
  162. case(FILES_TRNS_OR_BRK_TRNS):
  163. filetype of further file(s) =
  164. TRANSPOSFILE
  165. || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  166. || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST
  167. || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  168. || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST
  169. || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  170. || PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  171. || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST
  172. || PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST;
  173. break;
  174. case(FILES_PCH_OR_BRK_PCH):
  175. filetype of further file(s) =
  176. PITCHFILE
  177. || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  178. || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST
  179. || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  180. || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST
  181. || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  182. || PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
  183. || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST
  184. || PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST;
  185. break;
  186. }
  187. /**************************** FLTEQ *******************************/
  188. #define FLTERR (0.000002)
  189. #define FALSE (0)
  190. #define TRUE (1)
  191. int flteq(double f1,double f2)
  192. {
  193. double upperbnd, lowerbnd;
  194. upperbnd = f2 + FLTERR;
  195. lowerbnd = f2 - FLTERR;
  196. if((f1>upperbnd) || (f1<lowerbnd))
  197. return(FALSE);
  198. return(TRUE);
  199. }