AmAudioMixIn.h

Go to the documentation of this file.
00001 /*
00002  * $Id: AmAudioMixIn.h 322 2007-05-02 18:49:26Z sayer $
00003  *
00004  * Copyright (C) 2007 iptego GmbH
00005  *
00006  * This file is part of sems, a free SIP media server.
00007  *
00008  * sems is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * For a license to use the sems software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * sems is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00028 #ifndef _AM_AUDIO_MIX_IN_H
00029 #define _AM_AUDIO_MIX_IN_H
00030 
00031 #include "AmAudio.h"
00032 #include "AmAudioFile.h"
00033 
00034 
00035 #define MAX_PACKETLENGTH_MS   30
00036 #define MAX_BUF_SAMPLES  8000 * MAX_PACKETLENGTH_MS / 1000
00037 #define DEFAULT_SAMPLE_RATE 8000 // eh...
00038 
00049 class AmAudioMixIn : public AmAudio {
00050   AmAudio* A;
00051   AmAudioFile* B;
00052   unsigned int s;
00053   double l;
00054   bool finish_b_while_mixing;
00055 
00056   bool mixing;
00057 
00058   unsigned int next_start_ts;
00059   bool next_start_ts_i;
00060 
00061   short mix_buf[MAX_BUF_SAMPLES];  // 240
00062 
00063 
00064  public:
00065   AmAudioMixIn(AmAudio* A, AmAudioFile* B, 
00066                unsigned int s, double l, 
00067                bool finish_b_while_mixing = false);
00068   ~AmAudioMixIn();
00069  protected:
00070   // not used
00071   int read(unsigned int user_ts, unsigned int size){ return -1; }
00072   int write(unsigned int user_ts, unsigned int size){ return -1; }
00073     
00074   // override AmAudio
00075   int get(unsigned int user_ts, unsigned char* buffer, unsigned int nb_samples);
00076   int put(unsigned int user_ts, unsigned char* buffer, unsigned int size);
00077 };
00078 
00079 
00080 #endif // _AM_AUDIO_MIX_IN_H

Generated on Fri May 16 12:02:05 2008 for SEMS by  doxygen 1.5.1
Home |  Recent changes |  Search |  Glossary |  Sitemap |  Login