props.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright (c) 1983-2013 Richard Dobson and Composers Desktop Project Ltd
  3. * http://people.bath.ac.uk/masrwd
  4. * http://www.composersdesktop.com
  5. * This file is part of the CDP System.
  6. * The CDP System is free software; you can redistribute it
  7. * and/or modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  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.
  14. * See the 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 02111-1307 USA
  18. *
  19. */
  20. //props.h
  21. // latest stab at complete sfprops def including new 32bit float sound format
  22. // needs linking with sfsys97.lib for that to happen...
  23. // RWD SEP97: c++ version
  24. #ifndef __PROPS_INCLUDED__
  25. #define __PROPS_INCLUDED__
  26. //RWD: NB this does not include a TEXT filetype TW-style...
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include <sfsys.h>
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #ifndef __AFX_H__
  35. # ifndef FALSE
  36. # define FALSE false
  37. # endif
  38. # ifndef TRUE
  39. # define TRUE true
  40. # endif
  41. # ifndef BOOL
  42. # define BOOL bool
  43. # endif
  44. #endif
  45. //typedef enum {wave,analysis,formant,transposition,pitch} wavetype;
  46. //typedef enum {SHORT8,SHORT16,FLOAT32} sampletype;
  47. //typedef enum format {WAVE,AIFF} fileformat;
  48. typedef enum {
  49. UNKNOWN = 0, //RWD added
  50. TEXTFILE, //(1)
  51. SNDFILE, //(2)
  52. ANALFILE, //(3)
  53. PITCHFILE, //(4)
  54. TRANSPOSFILE, //(5)
  55. FORMANTFILE //(6)
  56. } tw_filetype; //TW version used in SPEC, GSPEC
  57. #ifdef NOTDEF
  58. typedef struct sfprops
  59. {
  60. long srate;
  61. long chans;
  62. wavetype type;
  63. sampletype samptype; //RWD 07:97
  64. fileformat format; //RWD.04.98
  65. long origsize;
  66. long origrate;
  67. long origchans; /* pitch, formant,transpos only */
  68. int specenvcnt; /* formants only */
  69. float arate;
  70. int winlen; // aka Mlen
  71. int decfac; // aka Dfac
  72. //double chan_width; //see, for example, spechoru.c
  73. //double half_chan_width;
  74. } SFPROPS;
  75. #endif
  76. // must be decleared elsewhere for Cpp progs!
  77. //TW version from specg2.h
  78. #ifdef __cplusplus
  79. struct fileprops { // may not need this anywhere else...
  80. long srate;
  81. long channels;
  82. tw_filetype filetype;
  83. long stype;
  84. long origstype; /* float files ony from here downwars */
  85. long origrate;
  86. long origchans; /* pitch, formant,transpos only */
  87. int specenvcnt; /* formants only */
  88. float arate;
  89. int Mlen;
  90. int Dfac;
  91. fileprops(); //constructor from spec.cpp
  92. virtual ~fileprops();
  93. const fileprops& operator=(const fileprops &);
  94. int operator==(const fileprops &) const;
  95. };
  96. typedef struct fileprops *fileptr; // probably embed whole struct (or class?)
  97. //these are only semi_object-oriented...should be derived from sffile class...
  98. //TODO: reconvert read funcs to use pointer to props
  99. BOOL sfheadread(int fd,SFPROPS &props);
  100. BOOL sndheadread(int fd,SFPROPS &props);
  101. BOOL sfwave_headwrite(int fd,const SFPROPS &props); //const...
  102. #endif
  103. extern char *props_errstr;
  104. #endif