File: obuffer_hp.h

package info (click to toggle)
maplay 1.2b-5
  • links: PTS
  • area: main
  • in suites: slink
  • size: 432 kB
  • ctags: 441
  • sloc: cpp: 5,421; sh: 97; makefile: 86
file content (74 lines) | stat: -rw-r--r-- 2,785 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 *  @(#) obuffer_hp.h 1.2, last edit: 21 Nov 1994 13:27:33
 *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
 *  @(#) Berlin University of Technology
 *
 *  Many thanks to:
 *  -> John Brezak <brezak@apollo.hp.com>
 *     for his first HP implementation using the audio server
 *     (the current version does not use the audio server to keep
 *      ethernets on low traffic for playing DOOM :-)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*
 *  New in maplay 1.3
 */

#ifndef OBUFFER_HPUX_H
#define OBUFFER_HPUX_H

const uint32	TXBUFSIZE = 256 * 1024;
		  // size of audio device internal buffer

// a class for direct sound output on Hewlett-Packard series 700 workstations
// (the audio server is not used, instead /dev/audio is used directly)
class HpuxObuffer : public Obuffer
{
private:
  static uint32		ringbuffersize;		// size of ringbuffer (in bytes)
  static int16		*buffer;		// ringbuffer
  static int16		*tail[2];		// position for next sample per channel
  static uint32		channels;		// number of channels (1 or 2)
  static char		*head;			// next byte for the audio device
  static boil		buffer_empty;		// buffer empty?
  static boil		handler_activated;	// signal_handler() is activated and
						// can receive signals, if True
  static boil		drain_buffer;		// drain ringbuffer completely, if True
  static int		audio_fd;		// filedescriptor for /dev/audio
  static itimerval	timerval;		// timer value for setitimer()

  static int		open_audio_device (void);

  static void		signal_handler (void);
			  // works as a SIGALRM handler if USE_TIMER is defined,
			  // else as SIGIO handler

public:
		HpuxObuffer (uint32 number_of_channels, Header *, boil use_speaker,
			     boil use_headphone, boil use_line_out, float volume);
	       ~HpuxObuffer (void);

  void		append (uint32 channel, int16 value);

  void		write_buffer (int) { cerr << "don't call me!\n"; }
		  // This function is obsolete, because signal_handler() does the output now.

  static boil	class_suitable (void);
		  // returnvalue == False: no 16-bit audio output possible (class unsuitable)
};

#endif