aRts audio server
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.

cachedwav.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. Copyright (C) 2000 Stefan Westerfeld
  3. stefan@space.twc.de
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #ifndef CACHEDWAV_H
  18. #define CACHEDWAV_H
  19. #include "arts_export.h"
  20. #ifdef HAVE_LIBAUDIOFILE
  21. #include "cache.h"
  22. #include <sys/stat.h>
  23. #include <unistd.h>
  24. /*
  25. * BC - Status (2002-03-08): CachedWav.
  26. *
  27. * At the current point in time, there are NO GUARANTEES, so only use this
  28. * in apps part of official KDE releases (such as tdemultimedia apps), which
  29. * know what is happening here. Especially, in SOME kde versions this class
  30. * might not even exist, as it gets conditionally compiled.
  31. */
  32. namespace Arts {
  33. class ARTS_EXPORT CachedWav : public CachedObject
  34. {
  35. protected:
  36. struct stat oldstat;
  37. std::string filename;
  38. bool initOk;
  39. CachedWav(Cache *cache, std::string filename);
  40. ~CachedWav();
  41. typedef unsigned char uchar;
  42. public:
  43. double samplingRate;
  44. long bufferSize;
  45. int channelCount;
  46. int sampleWidth;
  47. unsigned char *buffer;
  48. static CachedWav *load(Cache *cache, std::string filename);
  49. /**
  50. * validity test for the cache - returns false if the object is having
  51. * reflecting the correct contents anymore (e.g. if the file on the
  52. * disk has changed), and there is no point in keeping it in the cache any
  53. * longer
  54. */
  55. bool isValid();
  56. /**
  57. * memory usage for the cache
  58. */
  59. int memoryUsage();
  60. std::string mediaName() const { return filename; }
  61. };
  62. }
  63. #endif /* HAVE_LIBAUDIOFILE */
  64. #endif /* CACHEDWAV_H */