~ubuntu-branches/ubuntu/oneiric/xmp/oneiric

« back to all changes in this revision

Viewing changes to src/misc/control.c

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2010-01-15 01:15:22 UTC
  • mfrom: (1.1.8 upstream) (4.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100115011522-r4otlsg687ee1yx4
Tags: 3.0.0+20090923-1ubuntu1
* Merge from debian testing (LP: #507732).  Reamining changes:
  + Add PulseAudio support:
    - debian/rules: Add --enable-pulseaudio to ./configure
  + RFE Compile with 128 bit mixer:
    - dpatch support

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "mixer.h"
23
23
 
24
24
static int drv_parm = 0;
25
 
extern struct xmp_drv_info drv_callback;
26
25
 
27
26
 
28
27
int pw_init(void);
51
50
        o->flags = XMP_CTL_DYNPAN | XMP_CTL_FILTER | XMP_CTL_ITPT;
52
51
        o->cf_cutoff = 0;
53
52
 
54
 
        /* Set max number of voices per channel */
55
 
        o->maxvoc = 16;
56
 
 
57
53
        return ctx;
58
54
}
59
55
 
67
63
        return &((struct xmp_context *)ctx)->o;
68
64
}
69
65
 
70
 
void xmp_init_callback(xmp_context ctx, void (*callback) (void *, int))
71
 
{
72
 
        struct xmp_options *o = &((struct xmp_context *)ctx)->o;
73
 
 
74
 
        xmp_drv_register(&drv_callback);
75
 
        xmp_init_formats(ctx);
76
 
        pw_init();
77
 
 
78
 
        xmp_register_driver_callback(ctx, callback);
79
 
 
80
 
        o->drv_id = "callback";
81
 
}
82
 
 
83
66
void xmp_init(xmp_context ctx, int argc, char **argv)
84
67
{
 
68
        struct xmp_player_context *p = &((struct xmp_context *)ctx)->p;
85
69
        int num;
86
70
 
87
 
        xmp_init_drivers();
88
71
        xmp_init_formats(ctx);
89
72
        pw_init();
90
73
 
91
 
        xmp_event_callback = NULL;
 
74
        p->event_callback = NULL;
92
75
 
93
76
        /* must be parsed before loading the rc file. */
94
77
        for (num = 1; num < argc; num++) {
97
80
        }
98
81
        if (num >= argc)
99
82
                _xmp_read_rc((struct xmp_context *)ctx);
100
 
 
101
 
        /* _xmp_tell_wait(); */
102
83
}
103
84
 
104
85
inline int xmp_open_audio(xmp_context ctx)
119
100
        drv_parm++;
120
101
}
121
102
 
122
 
inline void xmp_register_event_callback(void (*cb) (unsigned long))
 
103
inline void xmp_register_event_callback(xmp_context ctx, void (*cb) (unsigned long))
123
104
{
124
 
        xmp_event_callback = cb;
 
105
        struct xmp_player_context *p = &((struct xmp_context *)ctx)->p;
 
106
 
 
107
        p->event_callback = cb;
125
108
}
126
109
 
127
110
void xmp_channel_mute(xmp_context ctx, int from, int num, int on)
155
138
        case XMP_MOD_STOP:
156
139
                p->pos = -2;
157
140
                break;
158
 
        case XMP_MOD_PAUSE:
159
 
                p->pause ^= 1;
160
 
                return p->pause;
161
141
        case XMP_MOD_RESTART:
162
142
                p->pos = -1;
163
143
                break;
180
160
        return 0;
181
161
}
182
162
 
183
 
int xmp_play_module(xmp_context ctx)
184
 
{
185
 
        struct xmp_options *o = &((struct xmp_context *)ctx)->o;
186
 
        time_t t0, t1;
187
 
        int t;
188
 
 
189
 
        time(&t0);
190
 
        _xmp_player_start((struct xmp_context *)ctx);
191
 
        time(&t1);
192
 
        t = difftime(t1, t0);
193
 
 
194
 
        o->start = 0;
195
 
 
196
 
        return t;
197
 
}
198
 
 
199
 
#ifdef TEST_OPEN_LOOP
200
 
 
201
 
int xmp_play_module2(xmp_context ctx)
202
 
{
203
 
        struct xmp_options *o = &((struct xmp_context *)ctx)->o;
204
 
        time_t t0, t1;
205
 
        int t;
206
 
 
207
 
        time(&t0);
208
 
        xmp_player_start((struct xmp_context *)ctx);
209
 
        while (xmp_player_loop((struct xmp_context *)ctx) == 0);
210
 
        xmp_player_end((struct xmp_context *)ctx);
211
 
        time(&t1);
212
 
        t = difftime(t1, t0);
213
 
 
214
 
        o->start = 0;
215
 
 
216
 
        return t;
217
 
}
218
 
#endif
219
 
 
 
163
inline int xmp_player_start(xmp_context ctx)
 
164
{
 
165
        return _xmp_player_start((struct xmp_context *)ctx);
 
166
}
 
167
 
 
168
inline int xmp_player_frame(xmp_context ctx)
 
169
{
 
170
        return _xmp_player_frame((struct xmp_context *)ctx);
 
171
}
 
172
 
 
173
inline void xmp_player_end(xmp_context ctx)
 
174
{
 
175
        _xmp_player_end((struct xmp_context *)ctx);
 
176
}
 
177
 
 
178
inline void xmp_play_buffer(xmp_context ctx)
 
179
{
 
180
        xmp_drv_bufdump((struct xmp_context *)ctx);
 
181
}
 
182
 
 
183
void xmp_get_buffer(xmp_context ctx, void **buffer, int *size)
 
184
{
 
185
        *size = xmp_smix_softmixer((struct xmp_context *)ctx);
 
186
        *buffer = xmp_smix_buffer((struct xmp_context *)ctx);
 
187
}
220
188
 
221
189
void xmp_get_driver_cfg(xmp_context ctx, int *srate, int *res, int *chn,
222
190
                        int *itpt)