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.7 2004/07/27 02:02:07 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 
00041 #ifdef HAVE_SCHEDULER
00042 #include "radiosched.h"
00043 #endif
00044 
00045 class SoundDevice;
00046 
00063 class Stream_mixer {
00064 
00065  public:
00066   Stream_mixer();
00068   ~Stream_mixer();
00070 
00074 
00075 
00076 
00077 
00105   bool create_channel(int ch);
00106 
00107   bool delete_channel(int ch); 
00108   
00126   bool add_to_playlist(int ch, const char *file);
00128   
00129   void rem_from_playlist(int ch, int pos);
00131 
00132   bool set_channel(int ch, int playlist_pos);
00134 
00142   int play_channel(int ch);
00144 
00145   bool stop_channel(int ch);
00147 
00148   bool pause_channel(int ch);
00150   
00151   bool pause_channel(int ch, bool stat);
00153 
00154   bool set_volume(int ch, float vol);
00156 
00157   void set_all_volumes(float *vol);
00159 
00160   void crossfade(int ch1, float vol1, int ch2, float vol2);
00162 
00163   bool set_playmode(int ch, int mode);
00165 
00166   void set_speed(int ch, int speed);
00168   
00169   bool set_position(int ch, float pos);
00171 
00172   bool move_song(int ch, int pos, int nch, int npos);
00174   
00175   bool set_live(bool stat);
00177 
00178   void set_mic_volume(int vol);
00180 
00181   bool set_lineout(bool stat);
00183   
00185   
00186 
00187 
00200 
00221   int create_enc(enum codec enc);
00222 
00227   void delete_enc(int id);
00228 
00229   
00239   OutChannel *get_enc(int id);
00240 
00241   
00249   bool apply_enc(int id);
00251   
00253 
00254 
00255 
00256 
00257   
00266   void register_gui(GUI *reg_gui);
00267 
00268 
00269   SoundDevice *snddev;
00270   bool open_soundcard(bool in, bool out);
00271   void close_soundcard();
00272 
00274 
00275 
00289   void cafudda();
00290 
00291 
00296   bool dsp_ok() { if(dsp>0) return true; else return false; };
00297 
00298 
00300   Channel *chan[MAX_CHANNELS];
00301 
00303   IN_DATATYPE linein_buf[PROCBUF_SIZE];
00304   int linein_samples;
00305   int linein_vol;
00306 
00307   LiveIn livein;
00308 
00310   Linklist outchans;
00311   
00312   /* the following are here filled with the first two
00313      encoder channels created. this is for backward
00314      compatibility with the existing GUIs, the encoders
00315      can be as many as you want! */
00316   OutChannel *lame;
00317   OutChannel *ogg;
00318   
00319  
00320   bool cli_vumeter; 
00321   void cli_vumeter_set(int val); 
00322 
00323   bool dspout; 
00324   bool linein; 
00325   bool fileout; 
00326   bool quit; 
00327 
00328 
00329 
00330 
00331 
00335  private:
00336   
00337   GUI *gui;
00339   bool have_gui;
00341   int dsp; 
00342   bool fullduplex; 
00343   int max; 
00344   int peak[8]; 
00345   int cpeak; 
00346   int idseed; 
00347 
00348   void updchan(int ch); 
00349   
00357   void clip_audio(int samples); 
00358   
00359   OutChannel *out; 
00360 
00361 
00362   int32_t process_buffer[PROCBUF_SIZE]; 
00363   int16_t audio_buffer[PROCBUF_SIZE]; 
00364 
00365 
00367   void lock() { pthread_mutex_lock(&_mutex); };
00368   void unlock() { pthread_mutex_unlock(&_mutex); };
00369   void wait() { pthread_cond_wait(&_cond,&_mutex); };
00370   void signal() { pthread_cond_signal(&_cond); };
00371   pthread_mutex_t _mutex;
00372   pthread_cond_t _cond;
00373 
00374 #ifdef HAVE_SCHEDULER
00375   Basic_scheduler *rsched;
00376   public:  void register_sched(Basic_scheduler *s) {rsched=s;};
00377 #endif
00378 };
00379 
00380 #endif

Generated on Thu Dec 16 12:28:21 2004 for MuSE by doxygen1.3