home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 Secrets / Secrets2.iso / Audio / WAV / MaplayP / _SETUP.1 / hpux_obuffer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-08  |  3.0 KB  |  87 lines

  1. /* hpux_obuffer.h
  2.  
  3.    Obuffer implementation for HP-UX
  4.  
  5.    Bugfixes in adaptation for maplay 1.2+ by :
  6.    Earle F. Philhower, III (earle@geocities.com)
  7.  
  8.    There is another implementation by John Fehr called
  9.    hpux_obuffer.h.old that uses the audio server. */
  10.  
  11. /*
  12.  *  @(#) obuffer_hp.h 1.2, last edit: 21 Nov 1994 13:27:33
  13.  *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
  14.  *  @(#) Berlin University of Technology
  15.  *
  16.  *  Many thanks to:
  17.  *  -> John Brezak <brezak@apollo.hp.com>
  18.  *     for his first HP implementation using the audio server
  19.  *     (the current version does not use the audio server to keep
  20.  *      ethernets on low traffic for playing DOOM :-)
  21.  *
  22.  *  This program is free software; you can redistribute it and/or modify
  23.  *  it under the terms of the GNU General Public License as published by
  24.  *  the Free Software Foundation; either version 2 of the License, or
  25.  *  (at your option) any later version.
  26.  *
  27.  *  This program is distributed in the hope that it will be useful,
  28.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  30.  *  GNU General Public License for more details.
  31.  *
  32.  *  You should have received a copy of the GNU General Public License
  33.  *  along with this program; if not, write to the Free Software
  34.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  35.  */
  36.  
  37. /*
  38.  *  New in maplay 1.3
  39.  */
  40.  
  41. #ifndef OBUFFER_HPUX_H
  42. #define OBUFFER_HPUX_H
  43.  
  44. #include <time.h>
  45. #include "args.h"
  46.  
  47. const uint32    TXBUFSIZE = 256 * 1024;
  48.           // size of audio device internal buffer
  49.  
  50. // a class for direct sound output on Hewlett-Packard series 700 workstations
  51. // (the audio server is not used, instead /dev/audio is used directly)
  52. class HpuxObuffer : public Obuffer
  53. {
  54. private:
  55.   static uint32        ringbuffersize;        // size of ringbuffer (in bytes)
  56.   static int16        *buffer;        // ringbuffer
  57.   static int16        *tail[2];        // position for next sample per channel
  58.   static uint32        channels;        // number of channels (1 or 2)
  59.   static char        *head;            // next byte for the audio device
  60.   static BOOL        buffer_empty;        // buffer empty?
  61.   static BOOL        handler_activated;    // signal_handler() is activated and
  62.                         // can receive signals, if True
  63.   static BOOL        drain_buffer;        // drain ringbuffer completely, if True
  64.   static int        audio_fd;        // filedescriptor for /dev/audio
  65.   static itimerval    timerval;        // timer value for setitimer()
  66.  
  67.   static int        open_audio_device(MPEG_Args *maplay_args);
  68.  
  69.   static void        signal_handler();
  70.               // works as a SIGALRM handler if USE_TIMER is defined,
  71.               // else as SIGIO handler
  72.  
  73. public:
  74.         HpuxObuffer(uint32 number_of_channels, MPEG_Args *maplay_args);
  75.       ~HpuxObuffer();
  76.  
  77.   void        append(uint32 channel, int16 value);
  78.  
  79.   void        write_buffer(int) {}
  80.           // This function is obsolete, because signal_handler() does the output now.
  81.  
  82.   static BOOL    class_suitable(MPEG_Args *maplay_args);
  83.           // returnvalue == False: no 16-bit audio output possible (class unsuitable)
  84. };
  85.  
  86. #endif // OBUFFER_HPUX_H
  87.