virtual_audio.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. XCC Utilities and Library
  3. Copyright (C) 2001 Olaf van der Spek <[email protected]>
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program 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
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #pragma once
  16. #include "virtual_file.h"
  17. class Cvirtual_audio
  18. {
  19. public:
  20. void load(Cvirtual_file f, int c_samples, int samplerate, int cb_sample, int c_channels);
  21. Cvirtual_file save_as_aud() const;
  22. int save_as_aud(string fname) const;
  23. Cvirtual_file save_as_wav_ima_adpcm() const;
  24. int save_as_wav_ima_adpcm(string fname) const;
  25. Cvirtual_file save_as_wav_pcm() const;
  26. int save_as_wav_pcm(string fname) const;
  27. Cvirtual_audio();
  28. ~Cvirtual_audio();
  29. const __int16* audio() const
  30. {
  31. return reinterpret_cast<const __int16*>(m_f.data());
  32. }
  33. int cb_audio() const
  34. {
  35. return mc_samples * mcb_sample * mc_channels;
  36. }
  37. int c_samples() const
  38. {
  39. return mc_samples;
  40. }
  41. int samplerate() const
  42. {
  43. return m_samplerate;
  44. }
  45. int cb_sample() const
  46. {
  47. return mcb_sample;
  48. }
  49. int c_channels() const
  50. {
  51. return mc_channels;
  52. }
  53. private:
  54. Cvirtual_file m_f;
  55. int mc_samples;
  56. int m_samplerate;
  57. int mcb_sample;
  58. int mc_channels;
  59. };