struct fmt {
unsigned short stereo; /* 1 = pcm, 2 = adpcm */
unsigned short channels; /* number of channels */
struct fmt {
unsigned short stereo; /* 1 = pcm, 2 = adpcm */
unsigned short channels; /* number of channels */
unsigned short bytes_sample; /* bytes per sample (all channels) */
unsigned short bits_sample; /* bits per sample (one channel) */
};
unsigned short bytes_sample; /* bytes per sample (all channels) */
unsigned short bits_sample; /* bits per sample (one channel) */
};
-int open_tone(char *file, int *codec, signed long *length, signed long *left)
+int open_tone(char *file, int *codec, signed int *length, signed int *left)
-// printf("%c%c%c%c lenght=%d\n",buffer[0],buffer[1],buffer[2],buffer[3],chunk);
+// printf("%c%c%c%c length=%d\n",buffer[0],buffer[1],buffer[2],buffer[3],chunk);
* the len must be the number of samples, NOT for the bytes to read!!
* the data returned is law-code
*/
* the len must be the number of samples, NOT for the bytes to read!!
* the data returned is law-code
*/
-int read_tone(int fh, unsigned char *buffer, int codec, int len, signed long size, signed long *left, int speed)
+int read_tone(int fh, unsigned char *buffer, int codec, int len, signed int size, signed int *left, int speed)
{
int l;
int offset;
signed short buffer16[len], *buf16 = buffer16;
signed short buffer32[len<<1], *buf32 = buffer32;
unsigned char buffer8[len], *buf8 = buffer8;
{
int l;
int offset;
signed short buffer16[len], *buf16 = buffer16;
signed short buffer32[len<<1], *buf32 = buffer32;
unsigned char buffer8[len], *buf8 = buffer8;
- signed long tone_size, tone_left;
- unsigned long memory = 0;
+ signed int tone_size, tone_left;
+ unsigned int memory = 0;
printf("PBX: Fetching tones '%s'\n", p);
PDEBUG(DEBUG_PORT, "fetching tones directory '%s'\n", p);
printf("PBX: Fetching tones '%s'\n", p);
PDEBUG(DEBUG_PORT, "fetching tones directory '%s'\n", p);
- *toneset_nextpointer = (struct toneset *)calloc(1, sizeof(struct toneset));
- if (*toneset_nextpointer == NULL)
- {
- PERROR("No memory for tone set: '%s'\n",p);
- return(0);
- }
+ *toneset_nextpointer = (struct toneset *)MALLOC(sizeof(struct toneset));
SCPY((*toneset_nextpointer)->directory, p);
tonesettone_nextpointer = &(*toneset_nextpointer)->first;
SCPY((*toneset_nextpointer)->directory, p);
tonesettone_nextpointer = &(*toneset_nextpointer)->first;
- /* allocate tone */
- *tonesettone_nextpointer = (struct tonesettone *)calloc(1, sizeof(struct tonesettone)+tone_size);
- if (*toneset_nextpointer == NULL)
- {
- PERROR("No memory for tone set: '%s'\n",p);
- close(fh);
- fduse--;
- return(0);
- }
+ /* Allocate tone */
+ *tonesettone_nextpointer = (struct tonesettone *)MALLOC(sizeof(struct tonesettone)+tone_size);
memuse++;
//printf("tone:%s, %ld bytes\n", name, tone_size);
memuse++;
//printf("tone:%s, %ld bytes\n", name, tone_size);
-void *open_tone_fetched(char *dir, char *file, int *codec, signed long *length, signed long *left)
+void *open_tone_fetched(char *dir, char *file, int *codec, signed int *length, signed int *left)
* read from fetched tone, check size
* the len must be the number of samples, NOT for the bytes to read!!
*/
* read from fetched tone, check size
* the len must be the number of samples, NOT for the bytes to read!!
*/
-int read_tone_fetched(void **fetched, void *buffer, int len, signed long size, signed long *left, int speed)
+int read_tone_fetched(void **fetched, void *buffer, int len, signed int size, signed int *left, int speed)