00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #ifndef __JMIXER_H
00030 #define __JMIXER_H
00031
00032 #include <math.h>
00033 #include <pthread.h>
00034
00035 #include <inchannels.h>
00036 #include <outchannels.h>
00037 #include <gui.h>
00038
00039 #include <generic.h>
00040
00057 class Stream_mixer {
00058
00059 public:
00060 Stream_mixer();
00062 ~Stream_mixer();
00064
00068
00069
00070
00071
00099 bool create_channel(int ch);
00100
00101 bool delete_channel(int ch);
00102
00120 bool add_to_playlist(int ch, const char *file);
00122
00123 void rem_from_playlist(int ch, int pos);
00125
00126 bool set_channel(int ch, int playlist_pos);
00128
00129 int play_channel(int ch);
00131
00132 bool stop_channel(int ch);
00134
00135 bool pause_channel(int ch);
00137
00138 bool pause_channel(int ch, bool stat);
00140
00141 bool set_volume(int ch, float vol);
00143
00144 void set_all_volumes(float *vol);
00146
00147 void crossfade(int ch1, float vol1, int ch2, float vol2);
00149
00150 bool set_playmode(int ch, int mode);
00152
00153 void set_speed(int ch, int speed);
00155
00156 bool set_position(int ch, float pos);
00158
00159 bool move_song(int ch, int pos, int nch, int npos);
00161
00162 bool set_live(bool stat);
00164
00165 bool set_lineout(bool stat);
00167
00169
00170
00171
00184
00205 int create_enc(enum codec enc);
00206
00211 void delete_enc(int id);
00212
00213
00223 OutChannel *get_enc(int id);
00224
00225
00233 bool apply_enc(int id);
00235
00237
00238
00239
00240
00241
00250 void register_gui(GUI *reg_gui);
00251
00252
00253 bool open_soundcard(bool in, bool out);
00254 void close_soundcard();
00255
00269 void cafudda();
00270
00271
00276 bool dsp_ok() { if(dsp>0) return true; else return false; };
00277
00278
00280 Channel *chan[MAX_CHANNELS];
00281
00283 LiveIn livein;
00284
00286 Linklist outchans;
00287
00288
00289
00290
00291
00292 OutChannel *lame;
00293 OutChannel *ogg;
00294
00295
00296 bool cli_vumeter;
00297 void cli_vumeter_set(int val);
00298
00299 bool dspout;
00300 bool linein;
00301 bool fileout;
00302 bool quit;
00303
00304
00305
00306
00307
00311 private:
00312
00313 GUI *gui;
00315 bool have_gui;
00317 int dsp;
00318 bool fullduplex;
00319 int max;
00320 int peak[8];
00321 int cpeak;
00322 int idseed;
00323
00324 void updchan(int ch);
00325
00333 void clip_audio(int samples);
00334
00335 OutChannel *out;
00336
00337
00338 int32_t process_buffer[PROCBUF_SIZE];
00339 int16_t audio_buffer[PROCBUF_SIZE];
00340
00341
00342
00343
00345 void lock() { pthread_mutex_lock(&_mutex); };
00346 void unlock() { pthread_mutex_unlock(&_mutex); };
00347 void wait() { pthread_cond_wait(&_cond,&_mutex); };
00348 void signal() { pthread_cond_signal(&_cond); };
00349 pthread_mutex_t _mutex;
00350 pthread_cond_t _cond;
00351
00352 };
00353
00354 #endif