www.pudn.com > d4j.zip > TNGEN.java


// TNGEN: Model Tone generation template 
// $Id: TNGEN.java,v 1.3 2003/11/13 11:55:18 cgm8 Exp $ 
/*  
 * Copyright (c) 1999 Carlos G Mendioroz. 
 * 
 *  This file is part of D4J. 
 * 
 *  D4J is free software; you can redistribute it and/or 
 *  modify it under the terms of the GNU Lesser General Public 
 *  License as published by the Free Software Foundation; either 
 *  version 2 of the License, or (at your option) any later version. 
 *   
 *  D4J is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 *  Lesser General Public License for more details. 
 *   
 *  You should have received a copy of the GNU Lesser General Public 
 *  License along with this library; if not, write to the 
 *  Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
 *  Boston, MA  02111-1307, USA. 
 * 
 * Report problems and direct all questions to: 
 * 
 *	tron@acm.org 
 */ 
package local.dialogic; 
 
public class TNGEN extends java.lang.Object 
{ 
 
// This is what we model: 
 
//    typedef struct { 
// 
//       unsigned short tg_dflag;  /* Dual Tone - 1, Single Tone - 0 */ 
//       unsigned short tg_freq1;  /* Frequency for Tone 1 (HZ)      */ 
//       unsigned short tg_freq2;  /* Frequency for Tone 2 (HZ)      */ 
//       short          tg_ampl1;  /* Amplitude for Tone 1 (dB)      */ 
//       short          tg_ampl2;  /* Amplitude for Tone 2 (dB)      */ 
//       short          tg_dur;    /* Duration of the Generated Tone */ 
//                                 /*  Units = 10ms          */ 
//    } TN_GEN; 
 
 
    protected int dflag; 
    protected int freq1; 
    protected int freq2; 
    protected int ampl1; 
    protected int ampl2; 
    protected int dur; 
 
    public TNGEN(int f1, int d1, int f2, int d2, int dur) 
    { 
        dflag = 1; 
        freq1 = f1; 
        ampl1 = d1; 
        freq2 = f2; 
        ampl2 = d2; 
        this.dur = dur; 
    } 
 
    public TNGEN(int f, int d, int dur) 
    { 
        dflag = 0; 
        freq1 = f; 
        ampl1 = d; 
        freq2 = 0; 
        ampl2 = 0; 
        this.dur = dur; 
    } 
}