~ubuntu-branches/ubuntu/trusty/libao/trusty

« back to all changes in this revision

Viewing changes to src/ao_null.c

  • Committer: Bazaar Package Importer
  • Author(s): John Francesco Ferlito
  • Date: 2010-04-11 11:04:30 UTC
  • mfrom: (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100411110430-wldc1w7ll1j6c4yc
Tags: 1.0.0-4
Actually depend on libao.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 *  along with GNU Make; see the file COPYING.  If not, write to
23
23
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
24
 *
25
 
 */
 
25
 ********************************************************************
 
26
 
 
27
 last mod: $Id: ao_null.c 16982 2010-03-18 19:50:04Z xiphmont $
 
28
 
 
29
 ********************************************************************/
26
30
 
27
31
#include <stdio.h>
28
32
#include <string.h>
29
33
#include <ao/ao.h>
30
34
 
31
35
static char *ao_null_options[] = {
32
 
        "debug"
 
36
  "debug","verbose","matrix","quiet"
33
37
};
34
38
static ao_info ao_null_info = {
35
39
        AO_TYPE_LIVE,
40
44
        AO_FMT_NATIVE,
41
45
        0,
42
46
        ao_null_options,
43
 
        1
 
47
        4
44
48
};
45
49
 
46
50
 
47
51
typedef struct ao_null_internal {
48
52
        unsigned long byte_counter;
49
 
        int debug_output;
50
53
} ao_null_internal;
51
54
 
52
55
 
68
71
 
69
72
        internal = (ao_null_internal *) malloc(sizeof(ao_null_internal));
70
73
 
71
 
        if (internal == NULL)   
 
74
        if (internal == NULL)
72
75
                return 0; /* Could not initialize device memory */
73
 
        
 
76
 
74
77
        internal->byte_counter = 0;
75
 
        internal->debug_output = 0;
76
78
 
77
79
        device->internal = internal;
 
80
        device->output_matrix_order = AO_OUTPUT_MATRIX_FIXED;
78
81
 
79
82
        return 1; /* Memory alloc successful */
80
83
}
81
84
 
82
85
 
83
 
static int ao_null_set_option(ao_device *device, const char *key, 
 
86
static int ao_null_set_option(ao_device *device, const char *key,
84
87
                              const char *value)
85
88
{
86
89
        ao_null_internal *internal = (ao_null_internal *) device->internal;
87
90
 
88
 
        if (!strcmp(key, "debug")) {
89
 
                internal->debug_output = 1;
90
 
        }
91
 
 
92
91
        return 1;
93
92
}
94
93
 
99
98
        /* Use whatever format the client requested */
100
99
        device->driver_byte_format = device->client_byte_format;
101
100
 
 
101
        if(!device->inter_matrix){
 
102
          /* by default, we want inter == in */
 
103
          if(format->matrix)
 
104
            device->inter_matrix = strdup(format->matrix);
 
105
        }
 
106
 
102
107
        return 1;
103
108
}
104
109
 
105
110
 
106
 
static int ao_null_play(ao_device *device, const char *output_samples, 
 
111
static int ao_null_play(ao_device *device, const char *output_samples,
107
112
                        uint_32 num_bytes)
108
113
{
109
114
        ao_null_internal *internal = (ao_null_internal *)device->internal;
118
123
{
119
124
        ao_null_internal *internal = (ao_null_internal *) device->internal;
120
125
 
121
 
        if (internal->debug_output) {
122
 
          fprintf(stderr, "ao_null: %ld bytes sent to null device.\n",
123
 
                  internal->byte_counter);
124
 
        }
 
126
        adebug("%ld bytes sent to null device.\n", internal->byte_counter);
125
127
 
126
128
        return 1;
127
129
}