~ubuntu-branches/debian/sid/flightgear/sid

« back to all changes in this revision

Viewing changes to 3rdparty/iaxclient/lib/audio_file.c

  • Committer: Package Import Robot
  • Author(s): Markus Wanner, Markus Wanner, Rebecca Palmer
  • Date: 2014-01-21 22:31:02 UTC
  • mfrom: (1.3.1) (15.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20140121223102-cjw7g9le25acd119
Tags: 3.0.0~git20140204+c99ea4-1
[ Markus Wanner ]
* Upload to unstable.
* Adjust B-D to allow building on kfreebsd-*. Closes: #724686.
* Add a lintian-overrides on autotools; we use cmake.
* Upstream corrected the fgfs manpage. Closes: #556362.
* Drop unnecessary man page for gl-info. Closes: #698308.
* Drop README.Linux: it's outdated to the point of uselessness.
  Closes: #574173.
* Add an upper limit of libsimgear-dev versions that flightgear can be
  built with. Closes: #738436.
* Drop the libsvn-dev dependency, neither flightgear nor simgear depend
  on libsvn, anymore. Closes: #682947.
* List icons in debian/install rather than copying around from rules.
* Update menu entry for flightgear, add one for fgcom; add .xpm icons.
  Closes: #713924.
* flightgear.desktop: add German translation
* Bump Standards-Version to 3.9.5; no changes needed.

[ Rebecca Palmer ]
* New upstream release.
* Install the icons (based on code by Saikrishna Arcot).  (Not a
  complete fix for LP908153 as it only sets the menu/Dash icon, not the
  running window's icon, but better than nothing).
* Disable screensaver while running. Closes: LP#793599. Add required
  libdbus-1-dev dependency.
* Remove outdated README.Debian.
* Terrasync now works after just ticking the box. Closes: #252899.
* Always set Terrasync directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * iaxclient_lib: An Inter-Asterisk eXchange communication library
 
3
 *
 
4
 * Module: audio_file
 
5
 * Purpose: Audio code to read/write to files
 
6
 * based on audio_portaudio, originally Developed by: Shawn Lawrence, Terrace Communications Inc.
 
7
 * Developed by: Steve Kann
 
8
 * Creation Date: October 30, 2003
 
9
 *
 
10
 * This program is free software, distributed under the terms of
 
11
 * the GNU Lesser (Library) General Public License
 
12
 *
 
13
 * IAX library Copyright (c) 2001 Linux Support Services
 
14
 * IAXlib is free software, distributed under the terms of
 
15
 * the GNU Lesser (Library) General Public License
 
16
 *
 
17
 * This library uses the PortAudio Portable Audio Library
 
18
 * For more information see: http://www.portaudio.com
 
19
 * PortAudio Copyright (c) 1999-2000 Ross Bencina and Phil Burk
 
20
 *
 
21
 */
 
22
 
 
23
#include "iaxclient_lib.h"
 
24
 
 
25
typedef short SAMPLE;
 
26
 
 
27
static FILE *inFile=NULL, *outFile=NULL;
 
28
 
 
29
#define FRAMES_PER_BUFFER 80 /* 80 frames == 10ms */
 
30
 
 
31
 
 
32
static int file_play_sound(struct iaxc_sound *inSound, int ring) {
 
33
  return 0;
 
34
}
 
35
 
 
36
static int file_stop_sound(int soundID) {
 
37
  return 0; 
 
38
}
 
39
 
 
40
 
 
41
static int file_start (struct iaxc_audio_driver *d ) {
 
42
    return 0;
 
43
}
 
44
 
 
45
static int file_stop (struct iaxc_audio_driver *d ) {
 
46
    return 0;
 
47
}
 
48
 
 
49
/* not used
 
50
static void file_shutdown_audio() {
 
51
    return;
 
52
}
 
53
*/
 
54
 
 
55
static int file_input(struct iaxc_audio_driver *d, void *samples, int *nSamples) {
 
56
        *nSamples = 0;
 
57
        return 0;
 
58
}
 
59
 
 
60
static int file_output(struct iaxc_audio_driver *d, void *samples, int nSamples) {
 
61
        
 
62
        if(outFile) {
 
63
            fwrite(samples, sizeof(SAMPLE), nSamples, outFile);
 
64
        }
 
65
        return 0;
 
66
}
 
67
 
 
68
static int file_select_devices (struct iaxc_audio_driver *d, int input, int output, int ring) {
 
69
    return 0;
 
70
}
 
71
 
 
72
static int file_selected_devices (struct iaxc_audio_driver *d, int *input, int *output, int *ring) {
 
73
    *input = 0;
 
74
    *output = 0;
 
75
    *ring = 0;
 
76
    return 0;
 
77
}
 
78
 
 
79
static int file_destroy (struct iaxc_audio_driver *d ) 
 
80
{
 
81
        /* TODO: something should happen here */
 
82
    return 0;
 
83
}
 
84
 
 
85
static float file_input_level_get(struct iaxc_audio_driver *d){
 
86
    return -1;
 
87
}
 
88
 
 
89
static float file_output_level_get(struct iaxc_audio_driver *d){
 
90
    return -1;
 
91
}
 
92
 
 
93
static int file_input_level_set(struct iaxc_audio_driver *d, float level){
 
94
    return -1;
 
95
}
 
96
 
 
97
static int file_output_level_set(struct iaxc_audio_driver *d, float level){
 
98
    return -1;
 
99
}
 
100
 
 
101
EXPORT int iaxc_set_files(FILE *input, FILE *output) {
 
102
    inFile = input;
 
103
    outFile = output;
 
104
    return 0;
 
105
}
 
106
 
 
107
 
 
108
/* initialize audio driver */
 
109
int file_initialize (struct iaxc_audio_driver *d , int sample_rate) {
 
110
 
 
111
    if(sample_rate != 8000 ) return -1;
 
112
 
 
113
    /* setup methods */
 
114
    d->initialize = file_initialize;
 
115
    d->destroy = file_destroy;
 
116
    d->select_devices = file_select_devices;
 
117
    d->selected_devices = file_selected_devices;
 
118
    d->start = file_start;
 
119
    d->stop = file_stop;
 
120
    d->output = file_output;
 
121
    d->input = file_input;
 
122
    d->input_level_get = file_input_level_get;
 
123
    d->input_level_set = file_input_level_set;
 
124
    d->output_level_get = file_output_level_get;
 
125
    d->output_level_set = file_output_level_set;
 
126
    d->play_sound = file_play_sound;
 
127
    d->stop_sound = file_stop_sound;
 
128
 
 
129
    return 0;
 
130
}