home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 Secrets / Secrets2.iso / Audio / WAV / MaplayP / _SETUP.1 / sublay2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-02  |  3.5 KB  |  112 lines

  1. /* sublay2.cpp
  2.  
  3.    Layer II subband object declarations */
  4.  
  5.    /*
  6.  *  @(#) subband_layer_2.h 1.8, last edit: 6/15/94 16:51:59
  7.  *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
  8.  *  @(#) Berlin University of Technology
  9.  *
  10.  *  This program is free software; you can redistribute it and/or modify
  11.  *  it under the terms of the GNU General Public License as published by
  12.  *  the Free Software Foundation; either version 2 of the License, or
  13.  *  (at your option) any later version.
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #ifndef SUBBAND_LAYER_2_H
  26. #define SUBBAND_LAYER_2_H
  27.  
  28. #include "all.h"
  29. #include "subband.h"
  30. #include "header.h"
  31. #include "crc.h"
  32.  
  33. // class for layer II subbands in single channel mode:
  34. class SubbandLayer2 : public Subband
  35. {
  36. protected:
  37.   uint32 subbandnumber;
  38.  
  39.   uint32 allocation;
  40.   uint32 scfsi;
  41.   real     scalefactor1, scalefactor2, scalefactor3;
  42.   uint32 codelength;
  43.   const real *groupingtable;
  44.   real     factor;
  45.  
  46.   uint32 groupnumber;
  47.   uint32 samplenumber;
  48.   real     samples[3];
  49.   real     c, d;
  50.  
  51.   uint32 get_allocationlength (Header *);
  52.   void     prepare_sample_reading (Header *, uint32, const real **, real *,
  53.                  uint32 *, real *, real *);
  54.  
  55. public:
  56.         SubbandLayer2 (uint32 subbandnumber);
  57.   void        read_allocation (Ibitstream *, Header *, Crc16 *);
  58.   virtual void    read_scalefactor_selection (Ibitstream *, Crc16 *);
  59.   void        read_scalefactor (Ibitstream *, Header *);
  60.   bool        read_sampledata (Ibitstream *);
  61.   bool        put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter * = NULL);
  62. };
  63.  
  64.  
  65. // class for layer II subbands in joint stereo mode:
  66. class SubbandLayer2IntensityStereo : public SubbandLayer2
  67. {
  68. protected:
  69.   uint32 channel2_scfsi;
  70.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  71.  
  72. public:
  73.        SubbandLayer2IntensityStereo (uint32 subbandnumber);
  74.   void read_allocation (Ibitstream *stream, Header *header, Crc16 *crc)
  75.   {
  76.     SubbandLayer2::read_allocation (stream, header, crc);
  77.   }
  78.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  79.   void read_scalefactor (Ibitstream *, Header *);
  80.   bool read_sampledata (Ibitstream *stream)
  81.   {
  82.      return SubbandLayer2::read_sampledata (stream);
  83.   }
  84.   bool put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  85. };
  86.  
  87.  
  88. // class for layer II subbands in stereo mode:
  89. class SubbandLayer2Stereo : public SubbandLayer2
  90. {
  91. protected:
  92.   uint32 channel2_allocation;
  93.   uint32 channel2_scfsi;
  94.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  95.   bool     channel2_grouping;
  96.   uint32 channel2_codelength;
  97.   const real *channel2_groupingtable;
  98.   real     channel2_factor;
  99.   real     channel2_samples[3];
  100.   real     channel2_c, channel2_d;
  101.  
  102. public:
  103.        SubbandLayer2Stereo (uint32 subbandnumber);
  104.   void read_allocation (Ibitstream *, Header *, Crc16 *);
  105.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  106.   void read_scalefactor (Ibitstream *, Header *);
  107.   bool read_sampledata (Ibitstream *);
  108.   bool put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  109. };
  110.  
  111. #endif
  112.