*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
#include "main.h"
#define SHORT_MIN -32768
struct message *message;
if (p_record)
- close_record(0);
+ close_record(0, 0);
classuse--;
/*
* close the recoding file, put header in front and rename
*/
-void Port::close_record(int beep)
+void Port::close_record(int beep, int mute)
{
- static signed long beep_mono[] = {-10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000};
- static unsigned char beep_8bit[] = {48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208};
+ static signed short beep_mono[256];
unsigned long size, wsize;
struct fmt fmt;
char filename[512], indexname[512];
PDEBUG(DEBUG_PORT, "data still in record buffer: %d (dir %d)\n", (p_record_buffer_writep - p_record_buffer_readp) & RECORD_BUFFER_MASK, p_record_buffer_dir);
memcpy(&callerinfo, &p_callerinfo, sizeof(struct caller_info));
- apply_callerid_restriction(p_record_anon_ignore, callerinfo.id, &callerinfo.ntype, &callerinfo.present, &callerinfo.screen, callerinfo.extension, callerinfo.name);
+// apply_callerid_restriction(p_record_anon_ignore, callerinfo.id, &callerinfo.ntype, &callerinfo.present, &callerinfo.screen, callerinfo.extension, callerinfo.name);
SCPY(number, p_dialinginfo.id);
SCPY(callerid, numberrize_callerinfo(callerinfo.id, callerinfo.ntype));
i++;
}
+ /* mute */
+ if (mute && p_record_type==CODEC_MONO)
+ {
+ i = p_record_length;
+ if (i > mute)
+ i = mute;
+ fseek(p_record, -(i<<1), SEEK_END);
+ p_record_length -= (i<<1);
+ }
/* add beep to the end of recording */
- if (beep)
- switch(p_record_type)
+ if (beep && p_record_type==CODEC_MONO)
{
- case CODEC_MONO:
i = 0;
- while(i < beep)
+ while(i < 256)
{
- fwrite(beep_mono, sizeof(beep_mono), 1, p_record);
- i += sizeof(beep_mono);
- p_record_length += sizeof(beep_mono);
- }
- break;
- case CODEC_8BIT:
- i = 0;
- while(i < beep)
- {
- fwrite(beep_8bit, sizeof(beep_8bit), 1, p_record);
- i += sizeof(beep_8bit);
- p_record_length += sizeof(beep_8bit);
+ beep_mono[i] = (signed short)(sin((double)i / 5.688888888889 * 2.0 * 3.1415927) * 2000.0);
+ i++;
}
- break;
-#if 0
- case CODEC_LAW:
i = 0;
while(i < beep)
{
- fwrite(beep_law, sizeof(beep_law), 1, p_record);
- i += sizeof(beep_law);
- p_record_length += sizeof(beep_law);
+ fwrite(beep_mono, sizeof(beep_mono), 1, p_record);
+ i += sizeof(beep_mono);
+ p_record_length += sizeof(beep_mono);
}
- break;
-#endif
- default:
- PERROR("codec %d not supported for beep adding\n", p_record_type);
}
/* complete header */