source: contrib/API/tools/pcmconv.c

Last change on this file was 578, checked in by David Azarewicz, 11 years ago

API updates

File size: 1.4 KB
Line 
1#define INCL_DOS
2#define INCL_DOSERRORS
3#include <os2.h>
4#include <stdlib.h>
5#include <stdio.h>
6#include <io.h>
7#include <fcntl.h>
8#include <conio.h>
9#include <math.h>
10
11int main (int argc, char *argv[])
12{
13 int ArgNum;
14 int ver, err, ret;
15 int channels,i, bytesread, count;
16 int card_id = 0;
17 char *Buffer;
18 char *Buf;
19 int readed, written, state, fsize;
20 FILE *input_handle;
21 FILE *output_handle;
22
23
24 printf("PCM convert tool. Version 0.01\n");
25 printf("Copyright 2004 by Vlad Stelmahosky aka Vladest\n");
26
27 if (argc > 1)
28 input_handle = fopen(argv[1], "rb");
29 else
30 input_handle = fopen("debug.wav", "rb");
31 if (!input_handle) printf("Error opening input file\n");
32
33 if (argc > 2)
34 output_handle = fopen(argv[1], "wb");
35 else
36 output_handle = fopen("debug6ch.wav", "wb");
37 if (!output_handle) printf("Error opening output file\n");
38 fseek(input_handle, 0L, SEEK_END);
39 fsize = ftell(input_handle);
40 Buffer = malloc(fsize);
41 fseek(input_handle, 0L, SEEK_SET);
42 // memset(Buffer,0, count);
43 bytesread = fread (Buffer, 1, fsize, input_handle);
44 fclose(input_handle);
45
46 for(i=0; i < bytesread;i+=4)
47 {
48 fwrite (Buffer+i, 1, 4, output_handle);
49 fwrite (Buffer+i, 1, 4, output_handle);
50 fwrite (Buffer+i, 1, 4, output_handle);
51 }
52
53 fclose(output_handle);
54 return 0;
55}
Note: See TracBrowser for help on using the repository browser.