You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4KB

  1. /*
  2. Copyright (C) 2006-2011 Nasca Octavian Paul
  3. Author: Nasca Octavian Paul
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of version 2 of the GNU General Public License
  6. as published by the Free Software Foundation.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License (version 2) for more details.
  11. You should have received a copy of the GNU General Public License (version 2)
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef INPUTS_H
  16. #define INPUTS_H
  17. #include "../globals.h"
  18. class InputS{
  19. public:
  20. InputS(){
  21. skipbufsize=1024;
  22. skipbuf=new short int[skipbufsize*4];
  23. };
  24. virtual ~InputS(){
  25. delete [] skipbuf;
  26. };
  27. virtual bool open(std::string filename)=0;
  28. virtual void close()=0;
  29. virtual int read(int nsmps,short int *smps)=0;
  30. void skip(int nsmps){
  31. while ((nsmps>0)&&(!eof)){
  32. int readsize=(nsmps<skipbufsize)?nsmps:skipbufsize;
  33. read(readsize,skipbuf);
  34. nsmps-=readsize;
  35. };
  36. };
  37. virtual void seek(double pos)=0;//0=start,1.0=end
  38. struct {
  39. int nsamples;
  40. int nchannels;
  41. int samplerate;
  42. int currentsample;
  43. } info;
  44. bool eof;
  45. private:
  46. int skipbufsize;
  47. short int *skipbuf;
  48. };
  49. #endif