720 lines
24 KiB
C
720 lines
24 KiB
C
/* $Id$
|
|
*
|
|
* Audio support data for ISDN4Linux.
|
|
*
|
|
* Copyright 2002/2003 by Andreas Eversberg (jolly@jolly.de)
|
|
*
|
|
* This software may be used and distributed according to the terms
|
|
* of the GNU General Public License, incorporated herein by reference.
|
|
*
|
|
*/
|
|
|
|
#include "layer1.h"
|
|
#include "helper.h"
|
|
#include "debug.h"
|
|
#include "dsp.h"
|
|
|
|
#define DATA_S sample_silence
|
|
#define SIZE_S &sizeof_silence
|
|
#define DATA_GA sample_german_all
|
|
#define SIZE_GA &sizeof_german_all
|
|
#define DATA_GO sample_german_old
|
|
#define SIZE_GO &sizeof_german_old
|
|
#define DATA_DT sample_american_dialtone
|
|
#define SIZE_DT &sizeof_american_dialtone
|
|
#define DATA_RI sample_american_ringing
|
|
#define SIZE_RI &sizeof_american_ringing
|
|
#define DATA_BU sample_american_busy
|
|
#define SIZE_BU &sizeof_american_busy
|
|
#define DATA_S1 sample_special1
|
|
#define SIZE_S1 &sizeof_special1
|
|
#define DATA_S2 sample_special2
|
|
#define SIZE_S2 &sizeof_special2
|
|
#define DATA_S3 sample_special3
|
|
#define SIZE_S3 &sizeof_special3
|
|
|
|
/***************/
|
|
/* tones loops */
|
|
/***************/
|
|
|
|
/* all tones are alaw encoded */
|
|
|
|
static unsigned char sample_german_all[]= {
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
0x80,0xab,0x81,0x6d,0xfd,0xdd,0x5d,0x9d,
|
|
0x4d,0xd1,0x89,0x88,0xd0,0x4c,0x9c,0x5c,
|
|
0xdc,0xfc,0x6c,
|
|
};
|
|
static unsigned long sizeof_german_all = sizeof(sample_german_all);
|
|
|
|
static unsigned char sample_german_old[]= {
|
|
0x2d,0x59,0x3d,0x0d,0xdd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d,0x59,0x3d,0x0d,0xdd,0x9d,0x89,0xbd,
|
|
0x6c,0xe0,0x7c,0xbc,0x5c,0x1c,0x08,0x0c,
|
|
0x2d,0x59,0x3d,0x0d,0xdd,0x9d,0x89,0xbd,
|
|
0x6c,0xe0,0x7c,0xbc,0x5c,0x1c,0x08,0x0c,
|
|
0x2d,0x59,0x3d,0x0d,0xdd,0x9d,0x89,0xbd,
|
|
0x6c,0xe0,0x7c,0xbc,0x5c,0x1c,0x08,0x0c,
|
|
0x2d,0x59,0x3d,0x0d,0xdd,0x9d,0x89,0xbd,
|
|
0x6c,0xe0,0x7c,0xbc,0x5c,0x1c,0x08,0x0c,
|
|
};
|
|
static unsigned long sizeof_german_old = sizeof(sample_german_old);
|
|
|
|
static unsigned char sample_american_dialtone[]= {
|
|
0x2a,0xd0,0x9c,0x64,0x44,0xb4,0x44,0x64,0x9c,0xac,
|
|
0x9e,0xb1,0xbd,0x25,0x85,0x05,0x85,0x25,0x3d,0x11,
|
|
0x47,0x20,0xec,0x3c,0x1c,0xdc,0x1c,0xbc,0xec,0x00,
|
|
0xc6,0x29,0x81,0x91,0xad,0x51,0x91,0x41,0xd9,0x29,
|
|
0x6f,0x12,0x1e,0x7e,0xc2,0x13,0x07,0x57,0xe9,0xd7,
|
|
0x1f,0x8e,0x08,0x80,0x90,0x2c,0x6c,0x6c,0x2c,0x30,
|
|
0x48,0x5f,0x01,0x6d,0xfd,0x5d,0x25,0xa5,0x9d,0x0d,
|
|
0x01,0xce,0x70,0x3c,0x24,0x84,0xc4,0x04,0xe4,0x7c,
|
|
0x10,0xca,0x91,0x7d,0x65,0x45,0xb5,0x45,0x85,0xdd,
|
|
0x2d,0x27,0xf0,0xfc,0x64,0xc4,0x44,0xc4,0x64,0x1c,
|
|
0x2c,0x16,0x81,0xcd,0x5d,0x65,0x85,0x65,0xa5,0x3d,
|
|
0xd1,0x29,0x38,0x50,0xcc,0xfc,0x7c,0xfc,0xcc,0x2c,
|
|
0x80,0xf6,0xc7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
0x00,0x0c,0x9c,0xa4,0x24,0x5c,0xfc,0x6c,0x00,0x5e,
|
|
0x49,0x31,0x2d,0x6d,0x6d,0x2d,0x91,0x81,0x09,0x8f,
|
|
0x1e,0xd6,0xe8,0x56,0x06,0x12,0xc3,0x7f,0x1f,0x13,
|
|
0x6e,0x28,0xd8,0x40,0x90,0x50,0xac,0x90,0x80,0x28,
|
|
0xc7,0x01,0xed,0xbd,0x1d,0xdd,0x1d,0x3d,0xed,0x21,
|
|
0x46,0x10,0x3c,0x24,0x84,0x04,0x84,0x24,0xbc,0xb0,
|
|
0x9f,0xad,0x9d,0x65,0x45,0xb5,0x45,0x65,0x9d,0xd1,
|
|
};
|
|
static unsigned long sizeof_american_dialtone = sizeof(sample_american_dialtone);
|
|
|
|
static unsigned char sample_american_ringing[]= {
|
|
0x2a,0x42,0xee,0x2e,0x1a,0x73,0x87,0x29,0x49,0x79,
|
|
0x79,0xc9,0xf7,0x0b,0x96,0x18,0x00,0xf0,0x70,0xb0,
|
|
0xe0,0x28,0x3f,0xd9,0xf1,0x2d,0x6d,0x6d,0xad,0x01,
|
|
0x77,0xe8,0x30,0x6c,0xbc,0x3c,0x4c,0x6c,0xc0,0x0e,
|
|
0xe1,0xed,0x3d,0xdd,0xdd,0x7d,0x8d,0x81,0x26,0x90,
|
|
0xbc,0x5c,0xe4,0x24,0x1c,0x6c,0x98,0xf9,0x8d,0xdd,
|
|
0x65,0x85,0xe5,0x1d,0xed,0xf7,0xb0,0x3c,0xe4,0x04,
|
|
0x04,0x64,0x9c,0x10,0xcf,0x2d,0x5d,0x85,0x45,0xc5,
|
|
0x65,0x3d,0x01,0xf8,0x4c,0xe4,0xc4,0xb4,0xc4,0xe4,
|
|
0xcc,0x08,0xb1,0x9d,0x85,0x45,0xb5,0x05,0xa5,0x2d,
|
|
0x2a,0x2c,0xa4,0x04,0xb4,0x44,0x84,0x9c,0xb0,0x09,
|
|
0xcd,0xe5,0xc5,0xb5,0xc5,0xe5,0x4d,0xf9,0x00,0x3c,
|
|
0x64,0xc4,0x44,0x84,0x5c,0x2c,0xce,0x11,0x9d,0x65,
|
|
0x05,0x05,0xe5,0x3d,0xb1,0xf6,0xec,0x1c,0xe4,0x84,
|
|
0x64,0xdc,0x8c,0xf8,0x99,0x6d,0x1d,0x25,0xe5,0x5d,
|
|
0xbd,0x91,0x27,0x80,0x8c,0x7c,0xdc,0xdc,0x3c,0xec,
|
|
0xe0,0x0f,0xc1,0x6d,0x4d,0x3d,0xbd,0x6d,0x31,0xe9,
|
|
0x76,0x00,0xac,0x6c,0x6c,0x2c,0xf0,0xd8,0x3e,0x29,
|
|
0xe1,0xb1,0x71,0xf1,0x01,0x19,0x97,0x0a,0xf6,0xc8,
|
|
0x78,0x78,0x48,0x28,0x86,0x72,0x1b,0x2f,0xef,0x43,
|
|
};
|
|
static unsigned long sizeof_american_ringing = sizeof(sample_american_ringing);
|
|
|
|
static unsigned char sample_american_busy[]= {
|
|
0x2a,0x67,0x77,0x27,0xfe,0x18,0x70,0xec,0x8c,0x2c,
|
|
0x80,0x2f,0x71,0x3d,0xa5,0xe5,0xdd,0x6d,0x37,0x10,
|
|
0xdc,0x04,0xc4,0x84,0x7c,0x60,0x41,0xdd,0xc5,0xb5,
|
|
0xc5,0xa5,0x11,0xc8,0xbc,0x64,0xc4,0x04,0xa4,0x2c,
|
|
0x2a,0x51,0x7d,0xa5,0x5d,0x3d,0x11,0xb7,0x98,0x10,
|
|
0x2c,0xac,0xb0,0x78,0x5e,0xef,0x9f,0x7b,0xe6,0xe8,
|
|
0x08,0x96,0x53,0xd9,0x11,0x8d,0xcd,0x8d,0x31,0xef,
|
|
0xb0,0x3c,0x24,0xe4,0xa4,0xcc,0xf8,0xb1,0x1d,0x85,
|
|
0x45,0x05,0x5d,0xf1,0xd8,0x7c,0x04,0xb4,0x44,0xe4,
|
|
0xec,0x1f,0x0d,0xe5,0x05,0x05,0x25,0x6d,0xb7,0x30,
|
|
0xbc,0xdc,0xdc,0x3c,0x50,0xe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
0xed,0xe5,0x45,0xb5,0x05,0x7d,0xd9,0xf0,0x5c,0x04,
|
|
0x44,0x84,0x1c,0xb0,0xf9,0xcd,0xa5,0xe5,0x25,0x3d,
|
|
0xb1,0xee,0x30,0x8c,0xcc,0x8c,0x10,0xd8,0x52,0x97,
|
|
0x09,0xe9,0xe7,0x7a,0x9e,0xee,0x5f,0x79,0xb1,0xad,
|
|
0x2d,0x11,0x99,0xb6,0x10,0x3c,0x5c,0xa4,0x7c,0x50,
|
|
0x2a,0x2d,0xa5,0x05,0xc5,0x65,0xbd,0xc9,0x10,0xa4,
|
|
0xc4,0xb4,0xc4,0xdc,0x40,0x61,0x7d,0x85,0xc5,0x05,
|
|
0xdd,0x11,0x36,0x6c,0xdc,0xe4,0xa4,0x3c,0x70,0x2e,
|
|
0x81,0x2d,0x8d,0xed,0x71,0x19,0xff,0x26,0x76,0x66,
|
|
};
|
|
static unsigned long sizeof_american_busy = sizeof(sample_american_busy);
|
|
|
|
static unsigned char sample_special1[]= {
|
|
0xa4,0x2a,0x64,0xb4,0x7d,0xd8,0x05,0x45,
|
|
0x8c,0xd1,0x44,0xc4,0xf1,0xcc,0xb5,0x05,
|
|
0x48,0x9d,0xb4,0xe4,0x1e,0x24,0xb5,0x5d,
|
|
0x61,0x85,0x44,0x3c,0x2c,0xc4,0xc5,0x6d,
|
|
0xbd,0x45,0x84,0x40,0xdc,0xb4,0xe5,0xd7,
|
|
0xe5,0xb5,0xdc,0xd7,0x84,0xb4,0xbd,0x40,
|
|
0xc5,0x45,0x2c,0x6d,0x44,0xc4,0x61,0x3c,
|
|
0xb5,0x85,0x1e,0x5d,0xb4,0x24,0x48,0xe4,
|
|
0xb5,0x9d,0xf1,0x05,0x44,0xcc,0x8c,0xc4,
|
|
0x05,0xd1,0x7d,0x45,0x64,0xd8,0xa4,0xb4,
|
|
0xa5,0x2a,0x65,0xb5,0x7c,0xd9,0x04,0x44,
|
|
0x8d,0xd0,0x45,0xc5,0xf0,0xcd,0xb4,0x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
0xc4,0x44,0x2d,0x6c,0x45,0xc5,0x60,0x3d,
|
|
0xb4,0x84,0x1f,0x5c,0xb5,0x25,0x49,0xe5,
|
|
0xb4,0x9c,0xf0,0x04,0x45,0xcd,0x8d,0xc5,
|
|
0x04,0xd0,0x7c,0x44,0x65,0xd9,0xa5,0xb5,
|
|
};
|
|
static unsigned long sizeof_special1 = sizeof(sample_special1);
|
|
|
|
static unsigned char sample_special2[]= {
|
|
0x25,0xd0,0xd9,0x45,0xc4,0x84,0xc5,0x2a,
|
|
0xd8,0x85,0x24,0x44,0xb5,0xd1,0xcc,0x9d,
|
|
0xcc,0xb4,0xb5,0x9d,0x24,0xd1,0xd8,0x44,
|
|
0xc5,0x85,0xc4,0x2a,0xd9,0x84,0x25,0x45,
|
|
0xb4,0xd0,0xcd,0x9c,0xcd,0xb5,0xb4,0x9c,
|
|
0x25,0xd0,0xd9,0x45,0xc4,0x84,0xc5,0x2a,
|
|
0xd8,0x85,0x24,0x44,0xb5,0xd1,0xcc,0x9d,
|
|
0xcc,0xb4,0xb5,0x9d,0x24,0xd1,0xd8,0x44,
|
|
0xc5,0x85,0xc4,0x2a,0xd9,0x84,0x25,0x45,
|
|
0xb4,0xd0,0xcd,0x9c,0xcd,0xb5,0xb4,0x9c,
|
|
0x25,0xd0,0xd9,0x45,0xc4,0x84,0xc5,0x2a,
|
|
0xd8,0x85,0x24,0x44,0xb5,0xd1,0xcc,0x9d,
|
|
0xcc,0xb4,0xb5,0x9d,0x24,0xd1,0xd8,0x44,
|
|
0xc5,0x85,0xc4,0x2a,0xd9,0x84,0x25,0x45,
|
|
0xb4,0xd0,0xcd,0x9c,0xcd,0xb5,0xb4,0x9c,
|
|
0x25,0xd0,0xd9,0x45,0xc4,0x84,0xc5,0x2a,
|
|
0xd8,0x85,0x24,0x44,0xb5,0xd1,0xcc,0x9d,
|
|
0xcc,0xb4,0xb5,0x9d,0x24,0xd1,0xd8,0x44,
|
|
0xc5,0x85,0xc4,0x2a,0xd9,0x84,0x25,0x45,
|
|
0xb4,0xd0,0xcd,0x9c,0xcd,0xb5,0xb4,0x9c,
|
|
0x25,0xd0,0xd9,0x45,0xc4,0x84,0xc5,0x2a,
|
|
0xd8,0x85,0x24,0x44,0xb5,0xd1,0xcc,0x9d,
|
|
0xcc,0xb4,0xb5,0x9d,0x24,0xd1,0xd8,0x44,
|
|
0xc5,0x85,0xc4,0x2a,0xd9,0x84,0x25,0x45,
|
|
0xb4,0xd0,0xcd,0x9c,0xcd,0xb5,0xb4,0x9c,
|
|
0x25,0xd0,0xd9,0x45,0xc4,0x84,0xc5,0x2a,
|
|
0xd8,0x85,0x24,0x44,0xb5,0xd1,0xcc,0x9d,
|
|
0xcc,0xb4,0xb5,0x9d,0x24,0xd1,0xd8,0x44,
|
|
0xc5,0x85,0xc4,0x2a,0xd9,0x84,0x25,0x45,
|
|
0xb4,0xd0,0xcd,0x9c,0xcd,0xb5,0xb4,0x9c,
|
|
0x25,0xd0,0xd9,0x45,0xc4,0x84,0xc5,0x2a,
|
|
0xd8,0x85,0x24,0x44,0xb5,0xd1,0xcc,0x9d,
|
|
0xcc,0xb4,0xb5,0x9d,0x24,0xd1,0xd8,0x44,
|
|
0xc5,0x85,0xc4,0x2a,0xd9,0x84,0x25,0x45,
|
|
0xb4,0xd0,0xcd,0x9c,0xcd,0xb5,0xb4,0x9c,
|
|
};
|
|
static unsigned long sizeof_special2 = sizeof(sample_special2);
|
|
|
|
static unsigned char sample_special3[]= {
|
|
0xd9,0x44,0xd9,0xb5,0xcc,0x44,0x25,0x85,
|
|
0xc4,0x9c,0xb5,0xd1,0xb4,0x2a,0xc5,0xd0,
|
|
0x24,0x9d,0xcd,0x84,0xd8,0x45,0xd8,0xb4,
|
|
0xcd,0x45,0x24,0x84,0xc5,0x9d,0xb4,0xd0,
|
|
0xb5,0x2b,0xc4,0xd1,0x25,0x9c,0xcc,0x85,
|
|
0xd9,0x44,0xd9,0xb5,0xcc,0x44,0x25,0x85,
|
|
0xc4,0x9c,0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|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,
|
|
};
|
|
static unsigned long sizeof_silence = sizeof(sample_silence);
|
|
|
|
struct tones_samples {
|
|
unsigned long *len;
|
|
unsigned char *data;
|
|
};
|
|
static struct
|
|
tones_samples samples[] = {
|
|
{&sizeof_german_all, sample_german_all},
|
|
{&sizeof_german_old, sample_german_old},
|
|
{&sizeof_american_dialtone, sample_american_dialtone},
|
|
{&sizeof_american_ringing, sample_american_ringing},
|
|
{&sizeof_american_busy, sample_american_busy},
|
|
{&sizeof_special1, sample_special1},
|
|
{&sizeof_special2, sample_special2},
|
|
{&sizeof_special3, sample_special3},
|
|
{NULL, NULL},
|
|
};
|
|
|
|
/***********************************
|
|
* generate ulaw from alaw samples *
|
|
***********************************/
|
|
|
|
void
|
|
dsp_audio_generate_ulaw_samples(void)
|
|
{
|
|
int i,j;
|
|
|
|
i = 0;
|
|
while(samples[i].len) {
|
|
j = 0;
|
|
while(j < (*samples[i].len)) {
|
|
samples[i].data[j] =
|
|
dsp_audio_alaw_to_ulaw[samples[i].data[j]];
|
|
j++;
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
|
|
|
|
/****************************
|
|
* tone sequence definition *
|
|
****************************/
|
|
|
|
struct pattern {
|
|
int tone;
|
|
unsigned char *data[10];
|
|
unsigned long *siz[10];
|
|
unsigned long seq[10];
|
|
} pattern[] = {
|
|
{TONE_GERMAN_DIALTONE,
|
|
{DATA_GA,0,0,0,0,0,0,0,0,0},
|
|
{SIZE_GA,0,0,0,0,0,0,0,0,0},
|
|
{1900,0,0,0,0,0,0,0,0,0}},
|
|
|
|
{TONE_GERMAN_OLDDIALTONE,
|
|
{DATA_GO,0,0,0,0,0,0,0,0,0},
|
|
{SIZE_GO,0,0,0,0,0,0,0,0,0},
|
|
{1998,0,0,0,0,0,0,0,0,0}},
|
|
|
|
{TONE_AMERICAN_DIALTONE,
|
|
{DATA_DT,0,0,0,0,0,0,0,0,0},
|
|
{SIZE_DT,0,0,0,0,0,0,0,0,0},
|
|
{8000,0,0,0,0,0,0,0,0,0}},
|
|
|
|
{TONE_GERMAN_DIALPBX,
|
|
{DATA_GA,DATA_S,DATA_GA,DATA_S,DATA_GA,DATA_S,0,0,0,0},
|
|
{SIZE_GA,SIZE_S,SIZE_GA,SIZE_S,SIZE_GA,SIZE_S,0,0,0,0},
|
|
{1995,2005,1995,2005,1995,12005,0,0,0,0}},
|
|
|
|
{TONE_GERMAN_OLDDIALPBX,
|
|
{DATA_GO,DATA_S,DATA_GO,DATA_S,DATA_GO,DATA_S,0,0,0,0},
|
|
{SIZE_GO,SIZE_S,SIZE_GO,SIZE_S,SIZE_GO,SIZE_S,0,0,0,0},
|
|
{1998,2002,1998,2002,1998,12002,0,0,0,0}},
|
|
|
|
{TONE_AMERICAN_DIALPBX,
|
|
{DATA_DT,DATA_S,DATA_DT,DATA_S,DATA_DT,DATA_S,0,0,0,0},
|
|
{SIZE_DT,SIZE_S,SIZE_DT,SIZE_S,SIZE_DT,SIZE_S,0,0,0,0},
|
|
{2000,2000,2000,2000,2000,12000,0,0,0,0}},
|
|
|
|
{TONE_GERMAN_RINGING,
|
|
{DATA_GA,DATA_S,0,0,0,0,0,0,0,0},
|
|
{SIZE_GA,SIZE_S,0,0,0,0,0,0,0,0},
|
|
{7999,32001,0,0,0,0,0,0,0,0}},
|
|
|
|
{TONE_GERMAN_OLDRINGING,
|
|
{DATA_GO,DATA_S,0,0,0,0,0,0,0,0},
|
|
{SIZE_GO,SIZE_S,0,0,0,0,0,0,0,0},
|
|
{7992,40008,0,0,0,0,0,0,0,0}},
|
|
|
|
{TONE_AMERICAN_RINGING,
|
|
{DATA_RI,DATA_S,0,0,0,0,0,0,0,0},
|
|
{SIZE_RI,SIZE_S,0,0,0,0,0,0,0,0},
|
|
{8000,32000,0,0,0,0,0,0,0,0}},
|
|
|
|
{TONE_GERMAN_RINGPBX,
|
|
{DATA_GA,DATA_S,DATA_GA,DATA_S,0,0,0,0,0,0},
|
|
{SIZE_GA,SIZE_S,SIZE_GA,SIZE_S,0,0,0,0,0,0},
|
|
{3990,4010,3990,28010,0,0,0,0,0,0}},
|
|
|
|
{TONE_GERMAN_OLDRINGPBX,
|
|
{DATA_GO,DATA_S,DATA_GA,DATA_S,0,0,0,0,0,0},
|
|
{SIZE_GO,SIZE_S,SIZE_GA,SIZE_S,0,0,0,0,0,0},
|
|
{3996,4040,3996,28004,0,0,0,0,0,0}},
|
|
|
|
{TONE_AMERICAN_RINGPBX,
|
|
{DATA_RI,DATA_S,DATA_RI,DATA_S,0,0,0,0,0,0},
|
|
{SIZE_RI,SIZE_S,SIZE_RI,SIZE_S,0,0,0,0,0,0},
|
|
{4000,4000,4000,28000,0,0,0,0,0,0}},
|
|
|
|
{T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},
|
|
|
|
{TONE_GERMAN_AUFSCHALTTON,
|
|
{DATA_GO,DATA_S,DATA_GO,DATA_S,0,0,0,0,0,0},
|
|
{SIZE_GO,SIZE_S,SIZE_GO,SIZE_S,0,0,0,0,0,0},
|
|
{999,3001,999,11001,0,0,0,0,0,0}},
|
|
|
|
{0,
|
|
{0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0}},
|
|
};
|
|
|
|
/******************
|
|
* copy tone data *
|
|
******************/
|
|
|
|
/* an sk_buff is generated from the number of samples needed.
|
|
* the count will be changed and may begin from 0 each pattern period.
|
|
* the clue is to precalculate the pointers and legths to use only one
|
|
* memcpy per function call, or two memcpy if the tone sequence changes.
|
|
*
|
|
* pattern - the type of the pattern
|
|
* count - the sample from the beginning of the pattern (phase)
|
|
* len - the number of bytes
|
|
*
|
|
* return - the sk_buff with the sample
|
|
*
|
|
* if tones has finished (e.g. knocking tone), dsp->tones is turned off
|
|
*/
|
|
void dsp_tone_copy(dsp_t *dsp, unsigned char *data, int len)
|
|
{
|
|
unsigned char *s;
|
|
int index, count, rest, start, num;
|
|
struct pattern *pat;
|
|
tone_t *tone = &dsp->tone;
|
|
|
|
/* if we have no tone, we copy silence */
|
|
if (!tone->tone) {
|
|
memset(data, silence, len);
|
|
return;
|
|
}
|
|
|
|
/* process pattern */
|
|
pat = (struct pattern *)tone->pattern; /* points to the current pattern */
|
|
index = tone->index; /* gives current sequence index */
|
|
count = tone->count; /* gives current sample */
|
|
|
|
/* copy sample */
|
|
while(len) {
|
|
/* find sample to start with */
|
|
while(42) {
|
|
/* warp arround */
|
|
if (!pat->seq[index]) {
|
|
count = 0;
|
|
index = 0;
|
|
}
|
|
/* check if we are currently playing this tone */
|
|
if (count < pat->seq[index]) {
|
|
break;
|
|
}
|
|
if (dsp->debug & DEBUG_DSP_TONE)
|
|
printk(KERN_DEBUG "%s: reaching next sequence (index=%d)\n", __FUNCTION__, index);
|
|
count -= pat->seq[index];
|
|
index++;
|
|
}
|
|
/* calculate start and number of samples */
|
|
start = count % (*pat->siz[index]);
|
|
s = pat->data[index] + start;
|
|
rest = pat->seq[index] - start;
|
|
num = (rest>len)?len:rest;
|
|
/* copy memory */
|
|
memcpy(data, s, num);
|
|
/* reduce length */
|
|
count += num;
|
|
len -= num;
|
|
}
|
|
tone->index = index;
|
|
tone->count = count;
|
|
|
|
/* return sk_buff */
|
|
return;
|
|
}
|
|
|
|
|
|
/********************
|
|
* set/release tone *
|
|
********************/
|
|
|
|
/*
|
|
* tones are relaized by streaming or by special loop commands if supported
|
|
* by hardware. when hardware is used, the patterns will be controlled by
|
|
* timers.
|
|
*/
|
|
int
|
|
dsp_tone(dsp_t *dsp, int tone)
|
|
{
|
|
struct pattern *pat;
|
|
int i;
|
|
tone_t *tonet = &dsp->tone;
|
|
|
|
/* we turn off the tone */
|
|
if (!tone) {
|
|
#ifdef WITH_HARDWARE
|
|
muessen wir noch die hardwareloop rausnehmen?: oder macht das der cmx ?:
|
|
wenn ja, dann muessen wir auch beim tone an/aus den cmx aufrufen (PH_CONTROL)
|
|
#endif
|
|
tonet->tone = 0;
|
|
return(0);
|
|
}
|
|
|
|
pat = NULL;
|
|
i = 0;
|
|
while(pattern[i].tone) {
|
|
if (pattern[i].tone == tone) {
|
|
pat = &pattern[i];
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
if (!pat) {
|
|
printk(KERN_WARNING "dsp: given tone 0x%x is invalid\n", tone);
|
|
return(-EINVAL);
|
|
}
|
|
if (dsp->debug & DEBUG_DSP_TONE)
|
|
printk(KERN_DEBUG "%s: now starting tone %d (index=%d)\n", __FUNCTION__, tone, 0);
|
|
tonet->tone = tone;
|
|
tonet->pattern = pat;
|
|
tonet->index = 0;
|
|
tonet->count = 0;
|
|
|
|
#ifdef WITH_HARDWARE
|
|
/* first check if we can do it with hardware */
|
|
if (.............) {
|
|
/* we have hardware support, so we set our pattern */
|
|
return(0);
|
|
}
|
|
|
|
#endif
|
|
|
|
return(0);
|
|
}
|
|
|
|
|
|
|