~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to kmidi/output.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 
 
3
    TiMidity -- Experimental MIDI to WAVE converter
 
4
    Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
 
5
 
 
6
    This program is free software; you can redistribute it and/or modify
 
7
    it under the terms of the GNU General Public License as published by
 
8
    the Free Software Foundation; either version 2 of the License, or
 
9
    (at your option) any later version.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
    GNU General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU General Public License
 
17
    along with this program; if not, write to the Free Software
 
18
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 
 
20
    output.h
 
21
 
 
22
*/
 
23
 
 
24
/* Data format encoding bits */
 
25
#ifndef KMIDI_OUTPUT
 
26
#define KMIDI_OUTPUT
 
27
 
 
28
#define PE_MONO         0x01  /* versus stereo */
 
29
#define PE_SIGNED       0x02  /* versus unsigned */
 
30
#define PE_16BIT        0x04  /* versus 8-bit */
 
31
#define PE_ULAW         0x08  /* versus linear */
 
32
#define PE_BYTESWAP     0x10  /* versus the other way */
 
33
 
 
34
typedef struct {
 
35
  uint32 rate, encoding;
 
36
  int fd; /* file descriptor for the audio device */
 
37
  int32 extra_param[5]; /* e.g. buffer fragments, output channel, ... */
 
38
  const char *id_name;
 
39
  char id_character;
 
40
  const char *name; /* default device or file name */
 
41
 
 
42
  int (*open_output)(void); /* 0=success, 1=warning, -1=fatal error */
 
43
  void (*close_output)(void);
 
44
  void (*output_data)(int32 *buf, uint32 count);
 
45
  int (*driver_output_data)(unsigned char *buf, uint32 count);
 
46
  void (*flush_output)(void);
 
47
  void (*purge_output)(void);
 
48
  int (*output_count)(uint32 ct);
 
49
} PlayMode;
 
50
 
 
51
extern PlayMode *play_mode_list[], *play_mode;
 
52
extern char *cfg_names[];
 
53
extern int got_a_configuration;
 
54
 
 
55
extern int output_buffer_full;
 
56
extern int output_device_open;
 
57
/* extern int current_sample_count(uint32 ct); */
 
58
/* extern int driver_output_data(char *buf, uint32 count); */
 
59
extern int b_out_count(void);
 
60
extern void b_out(char id, int fd, int *buf, int ocount);
 
61
/* Conversion functions -- These overwrite the int32 data in *lp with
 
62
   data in another format */
 
63
 
 
64
extern int output_clips;
 
65
 
 
66
/* 8-bit signed and unsigned*/
 
67
extern void s32tos8(int32 *lp, uint32 c);
 
68
extern void s32tou8(int32 *lp, uint32 c);
 
69
 
 
70
/* 16-bit */
 
71
extern void s32tos16(int32 *lp, uint32 c);
 
72
extern void s32tou16(int32 *lp, uint32 c);
 
73
 
 
74
/* byte-exchanged 16-bit */
 
75
extern void s32tos16x(int32 *lp, uint32 c);
 
76
extern void s32tou16x(int32 *lp, uint32 c);
 
77
 
 
78
/* uLaw (8 bits) */
 
79
extern void s32toulaw(int32 *lp, uint32 c);
 
80
 
 
81
/* little-endian and big-endian specific */
 
82
#ifdef LITTLE_ENDIAN
 
83
#define s32tou16l s32tou16
 
84
#define s32tou16b s32tou16x
 
85
#define s32tos16l s32tos16
 
86
#define s32tos16b s32tos16x
 
87
#else
 
88
#define s32tou16l s32tou16x
 
89
#define s32tou16b s32tou16
 
90
#define s32tos16l s32tos16x
 
91
#define s32tos16b s32tos16
 
92
#endif
 
93
 
 
94
#endif /*KMIDI_OUTPUT*/