home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1997 June / PC_Shareware-1997-06.iso / manga / mp2win95 / _setup.1 / OBUFFER.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-25  |  2.6 KB  |  97 lines

  1. /*
  2.  *  @(#) obuffer.h 1.8, last edit: 6/15/94 16:51:56
  3.  *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
  4.  *  @(#) Berlin University of Technology
  5.  *
  6.  *  Idea and first implementation for u-law output with fast downsampling by
  7.  *  Jim Boucher (jboucher@flash.bu.edu)
  8.  *
  9.  *  LinuxObuffer class written by
  10.  *  Louis P. Kruger (lpkruger@phoenix.princeton.edu)
  11.  *
  12.  *  This program is free software; you can redistribute it and/or modify
  13.  *  it under the terms of the GNU General Public License as published by
  14.  *  the Free Software Foundation; either version 2 of the License, or
  15.  *  (at your option) any later version.
  16.  *
  17.  *  This program is distributed in the hope that it will be useful,
  18.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.  *  GNU General Public License for more details.
  21.  *
  22.  *  You should have received a copy of the GNU General Public License
  23.  *  along with this program; if not, write to the Free Software
  24.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  */
  26.  
  27. // MCIbuffer class added by Jeff Tsay. Last edit 3/29/96
  28.  
  29. #ifndef OBUFFER_H
  30. #define OBUFFER_H
  31.  
  32. #define MMNODRV
  33. #define MMNOSOUND
  34. #define MMNOMIDI
  35. #define MMNOAUX
  36. #define MMNOTIMER
  37. #define MMNOJOY
  38. #define MMNOMCI
  39. #define MMNOMMIO
  40. #define MMNOMMSYSTEM
  41. #include <mmsystem.h>
  42.  
  43. #include "all.h"
  44. #include "header.h"
  45.  
  46. static const uint32 OBUFFERSIZE = 2 * 1152;    // max. 2 * 1152 samples per frame
  47. static const uint32 MAXCHANNELS = 2;        // max. number of channels
  48.  
  49. // Abstract base class for audio output classes:
  50. class Obuffer
  51. {
  52. public:
  53.   virtual     ~Obuffer (void) {}        // dummy
  54.  
  55.  
  56.   virtual void append (uint32 channel, int32 value) = 0;
  57.              // this function takes a 16 Bit PCM sample
  58.   virtual void write_buffer (int fd) = 0;
  59.              // this function should write the samples to the filedescriptor
  60.              // or directly to the audio hardware
  61.  
  62.   virtual void clear_buffer(void) = 0;
  63.              // Clears all data in the buffer (for seeking)
  64.  
  65.   virtual void set_stop_flag(void) = 0;
  66.  
  67. };
  68.  
  69. class MCIbuffer : public Obuffer
  70. {
  71. private:
  72.   uint32 bufferp[MAXCHANNELS];
  73.   uint32 channels;
  74.   tWAVEFORMATEX *lpwf;
  75.   LPWAVEHDR* lpwavehdr_arr;
  76.   HWAVEOUT *phwo;
  77.   uint32 buffer_count;
  78.   uint32 hdr_size;
  79.   uint32 fillup;
  80.   DWORD data_size;
  81.   uint32 user_stop;
  82.  
  83. public:
  84.     MCIbuffer (uint32 number_of_channels, Header *header, HWAVEOUT *phwo0);
  85.     ~MCIbuffer (void);
  86.  
  87.   void    append (uint32 channel, int32 value);
  88.   void    write_buffer (int fd);
  89.   void   clear_buffer(void);
  90.   void   set_stop_flag(void);
  91.  
  92. private:
  93.   void wave_swap(void);
  94. };
  95.  
  96. #endif
  97.