# HG changeset patch # User Herman Bloggs # Date 1038597449 0 # Node ID cdce88d6e67cbcf5962faed6920ec05a0518f8c1 # Parent e53d9f9969d01d13d7c14dd3172f8be555977c03 [gaim-migrate @ 4220] gaim sounds now played from file committer: Tailor Script diff -r e53d9f9969d0 -r cdce88d6e67c sounds/Makefile.mingw --- a/sounds/Makefile.mingw Fri Nov 29 19:13:12 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -# Makefile for creating wave data include files (mingw win32) - -all: wav2h.exe hfiles - -wav2h.exe: - gcc -c wav2h.c -o wav2h.o - gcc -o wav2h.exe wav2h.o - -%.h: %.wav wav2h.exe - ./wav2h.exe $< - -hfiles: BuddyArrive.h BuddyLeave.h Send.h Receive.h RedAlert.h - -clean: - rm -rf *.o *.exe *.h \ No newline at end of file diff -r e53d9f9969d0 -r cdce88d6e67c sounds/wav2h.c --- a/sounds/wav2h.c Fri Nov 29 19:13:12 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -#include -#include -#include - -#define BUF_SIZE 10 - -unsigned long load_file( char* filename, char** wavePtr ) { - HANDLE inHandle; - unsigned long waveSize, action; - - /* Open the WAVE file */ - if (INVALID_HANDLE_VALUE != (inHandle = CreateFile( filename, GENERIC_READ, - FILE_SHARE_READ, 0, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, 0))) { - /* I'm going to skip checking that this is a WAVE file. I'll assume that it is. - * Normally, you'd check it's RIFF header. - */ - - /* Get the size of the file */ - if(0xFFFFFFFF == (waveSize = GetFileSize(inHandle, 0)) && waveSize) { - printf("Bad wave file size\n"); - exit(1); - } - - /* Allocate some memory to load the file */ - if ((*wavePtr = (char *)VirtualAlloc(0, waveSize, MEM_COMMIT, PAGE_READWRITE))) { - /* Read in WAVE file */ - if (ReadFile(inHandle, *wavePtr, waveSize, &action, 0) && waveSize == action) { - return waveSize; - } - else { - printf("Error loading WAVE!\r\n"); - } - - /* Free the memory */ - VirtualFree(*wavePtr, waveSize, MEM_FREE); - } - else { - printf("Can't get memory!\r\n"); - } - } - else { - printf("Bad WAVE size!\r\n"); - } - - /* Close the WAVE file */ - CloseHandle(inHandle); - return 0; -} - -void usage() { - printf("Usage: wav2h NameOfFile.wav\n"); - exit(1); -} - -int main(int argc, char **argv) { - FILE *f_in=0; - FILE *f_out=0; - int res, i, j, ext=0; - char *wavedata=0; - int wavesize=0; - char dataname[100]; - char filename[100]; - char outfile[100]; - - if(argc<2 || argc>2) { - usage(); - } - - for(i=0;i= strlen(argv[1]) || - !(argv[1][i+1] == 'w' && argv[1][i+2] == 'a' && argv[1][i+3] == 'v') || - i+4 != strlen(argv[1])) { - printf("Error: wav2h only works with wav files (with wav extension)\n"); - usage(); - } - dataname[i] = '\0'; - ext=1; - break; - } - else - dataname[i] = argv[1][i]; - } - - if(!ext) { - printf("Error: wav2h only works with wav files (with wav extension)\n"); - usage(); - } - - sprintf(filename, ".\\%s", argv[1]); - sprintf(outfile, ".\\%s.h", dataname); - - if((wavesize = load_file( filename, &wavedata )) == 0) { - printf("Error loading file to memory\n"); - exit(1); - } - f_out = fopen(outfile, "w+"); - if (!f_out) { - perror("fopen"); - exit(1); - } - - fprintf(f_out, "static unsigned char %s[] = {\n", dataname); - - for(i=0,j=0;i