Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members  

jmixer.h

Go to the documentation of this file.
00001 /* MuSE - Multiple Streaming Engine
00002  * Copyright (C) 2000-2004 Denis Rojo aka jaromil <jaromil@dyne.org>
00003  *
00004  * This source code is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Public License as published 
00006  * by the Free Software Foundation; either version 2 of the License,
00007  * or (at your option) any later version.
00008  *
00009  * This source code is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00012  * Please refer to the GNU Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Public License along with
00015  * this source code; if not, write to:
00016  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018  $Id: jmixer.h,v 1.4 2004/03/29 16:04:26 jaromil Exp $
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   /* the following are here filled with the first two
00289      encoder channels created. this is for backward
00290      compatibility with the existing GUIs, the encoders
00291      can be as many as you want! */
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

Generated on Sat Apr 17 17:38:48 2004 for MuSE by doxygen1.3