|
Packit |
e67170 |
/*
|
|
Packit |
e67170 |
* firmware writer for SoundBlaster 16 ASP sound cards
|
|
Packit |
e67170 |
* Copyright (c) 2006 Clemens Ladisch <clemens@ladisch.de>
|
|
Packit |
e67170 |
*
|
|
Packit |
e67170 |
*
|
|
Packit |
e67170 |
* Permission to use, copy, modify, and distribute this software for any
|
|
Packit |
e67170 |
* purpose with or without fee is hereby granted, provided that the above
|
|
Packit |
e67170 |
* copyright notice and this permission notice appear in all copies.
|
|
Packit |
e67170 |
*
|
|
Packit |
e67170 |
* The software is provided "as is" and the author disclaims all warranties
|
|
Packit |
e67170 |
* with regard to this software including all implied warranties of
|
|
Packit |
e67170 |
* merchantability and fitness. In no event shall the author be liable for
|
|
Packit |
e67170 |
* any special, direct, indirect, or consequential damages or any damages
|
|
Packit |
e67170 |
* whatsoever resulting from loss of use, data or profits, whether in an
|
|
Packit |
e67170 |
* action of contract, negligence or other tortious action, arising out of
|
|
Packit |
e67170 |
* or in connection with the use or performance of this software.
|
|
Packit |
e67170 |
*/
|
|
Packit |
e67170 |
|
|
Packit |
e67170 |
#include <stdio.h>
|
|
Packit |
e67170 |
#include <stdlib.h>
|
|
Packit |
e67170 |
|
|
Packit |
e67170 |
#include "sb16_csp_codecs.h"
|
|
Packit |
e67170 |
|
|
Packit |
e67170 |
static void write_file(const char *filename,
|
|
Packit |
e67170 |
const unsigned char data[], size_t size)
|
|
Packit |
e67170 |
{
|
|
Packit |
e67170 |
FILE *f;
|
|
Packit |
e67170 |
|
|
Packit |
e67170 |
fprintf(stderr, "writing %s ...\n", filename);
|
|
Packit |
e67170 |
f = fopen(filename, "wb");
|
|
Packit |
e67170 |
if (!f) {
|
|
Packit |
e67170 |
perror("cannot create file");
|
|
Packit |
e67170 |
exit(EXIT_FAILURE);
|
|
Packit |
e67170 |
}
|
|
Packit |
e67170 |
if (fwrite(data, 1, size, f) != size ||
|
|
Packit |
e67170 |
fclose(f) == EOF) {
|
|
Packit |
e67170 |
perror("cannot write");
|
|
Packit |
e67170 |
exit(EXIT_FAILURE);
|
|
Packit |
e67170 |
}
|
|
Packit |
e67170 |
}
|
|
Packit |
e67170 |
|
|
Packit |
e67170 |
int main(void)
|
|
Packit |
e67170 |
{
|
|
Packit |
e67170 |
#define WRITE(data) write_file(#data ".csp", data, sizeof data)
|
|
Packit |
e67170 |
WRITE(mulaw_main);
|
|
Packit |
e67170 |
WRITE(alaw_main);
|
|
Packit |
e67170 |
WRITE(ima_adpcm_init);
|
|
Packit |
e67170 |
WRITE(ima_adpcm_playback);
|
|
Packit |
e67170 |
WRITE(ima_adpcm_capture);
|
|
Packit |
e67170 |
return 0;
|
|
Packit |
e67170 |
}
|