synth.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. /*
  10. * libmad - MPEG audio decoder library
  11. * Copyright (C) 2000-2004 Underbit Technologies, Inc.
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26. *
  27. * $Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp $
  28. */
  29. # ifndef LIBMAD_SYNTH_H
  30. # define LIBMAD_SYNTH_H
  31. # include "fixed.h"
  32. # include "frame.h"
  33. struct mad_pcm {
  34. unsigned int samplerate; /* sampling frequency (Hz) */
  35. unsigned short channels; /* number of channels */
  36. unsigned short length; /* number of samples per channel */
  37. mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
  38. };
  39. struct mad_synth {
  40. mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
  41. /* [ch][eo][peo][s][v] */
  42. unsigned int phase; /* current processing phase */
  43. struct mad_pcm pcm; /* PCM output */
  44. };
  45. /* single channel PCM selector */
  46. enum {
  47. MAD_PCM_CHANNEL_SINGLE = 0
  48. };
  49. /* dual channel PCM selector */
  50. enum {
  51. MAD_PCM_CHANNEL_DUAL_1 = 0,
  52. MAD_PCM_CHANNEL_DUAL_2 = 1
  53. };
  54. /* stereo PCM selector */
  55. enum {
  56. MAD_PCM_CHANNEL_STEREO_LEFT = 0,
  57. MAD_PCM_CHANNEL_STEREO_RIGHT = 1
  58. };
  59. void mad_synth_init(struct mad_synth *);
  60. # define mad_synth_finish(synth) /* nothing */
  61. void mad_synth_mute(struct mad_synth *);
  62. void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
  63. # endif