OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable/] [mp3/] [sw/] [mad-xess/] [audio.h] - Blame information for rev 1778

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 291 simons
/*
2
 * mad - MPEG audio decoder
3
 * Copyright (C) 2000-2001 Robert Leslie
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 *
19
 * $Id: audio.h,v 1.3 2001-11-06 17:01:07 simons Exp $
20
 */
21
 
22
# ifndef AUDIO_H
23
# define AUDIO_H
24
 
25
# include "mad.h"
26
 
27
# define MAX_NSAMPLES   (1152 * 3)      /* allow for resampled frame */
28
 
29
enum audio_command {
30
  AUDIO_COMMAND_INIT,
31
  AUDIO_COMMAND_CONFIG,
32
  AUDIO_COMMAND_FINISH
33
};
34
 
35
enum audio_mode {
36
  AUDIO_MODE_ROUND  = 0x0001,
37
  AUDIO_MODE_DITHER = 0x0002
38
};
39
 
40
struct audio_stats {
41
  unsigned long clipped_samples;
42
  mad_fixed_t peak_clipping;
43
  mad_fixed_t peak_sample;
44
};
45
 
46
union audio_control {
47
  enum audio_command command;
48
 
49
  struct audio_init {
50
    enum audio_command command;
51
    char const *path;
52
  } init;
53
 
54
  struct audio_config {
55
    enum audio_command command;
56
    unsigned int channels;
57
    unsigned int speed;
58
  } config;
59
 
60
  struct audio_play {
61
    enum audio_command command;
62
    unsigned int nsamples;
63
    mad_fixed_t const *samples[2];
64
    enum audio_mode mode;
65
    struct audio_stats *stats;
66
  } play;
67
 
68
  struct audio_finish {
69
    enum audio_command command;
70
  } finish;
71
};
72
 
73
extern char const *audio_error;
74
 
75
typedef int audio_ctlfunc_t(union audio_control *);
76
 
77
audio_ctlfunc_t *audio_output(char const **);
78
 
79
audio_ctlfunc_t audio_oss;
80
audio_ctlfunc_t audio_empeg;
81
audio_ctlfunc_t audio_sun;
82
audio_ctlfunc_t audio_win32;
83
 
84
audio_ctlfunc_t audio_raw;
85
audio_ctlfunc_t audio_wave;
86
audio_ctlfunc_t audio_snd;
87
audio_ctlfunc_t audio_hex;
88
audio_ctlfunc_t audio_null;
89
 
90
signed long audio_linear_round(unsigned int, mad_fixed_t,
91
                               struct audio_stats *);
92
signed long audio_linear_dither(unsigned int, mad_fixed_t, mad_fixed_t *,
93
                                struct audio_stats *);
94
 
95
unsigned int audio_pcm_s16le(unsigned char *, unsigned int,
96
                             mad_fixed_t const *, mad_fixed_t const *);
97
 
98
unsigned char audio_mulaw_round(mad_fixed_t);
99
unsigned char audio_mulaw_dither(mad_fixed_t, mad_fixed_t *);
100
 
101
unsigned int audio_pcm_mulaw(unsigned char *, unsigned int,
102
                             mad_fixed_t const *, mad_fixed_t const *,
103
                             enum audio_mode, struct audio_stats *);
104
 
105
# endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.