2. Command Line Program

This program can be built into a commandline program if WAVDRAW_CLI is built. The program itself is built into a program called wavdraw_main so it can be called as a subprogram in Monolith.

<<main>>=
int wavdraw_main(int argc, char *argv[])
{
    btprnt *bp;
    btprnt_region r;

    if (argc < 3) {
        printf("Usage: %s filename.wav out.pbm\n", argv[0]);
        return 1;
    }

    bp = btprnt_new(500, 250);

    btprnt_region_init(btprnt_canvas_get(bp),
                       &r, 0, 0,
                       500, 250);

    btprnt_wavdraw(&r, argv[1], 1);

    btprnt_buf_pbm(btprnt_buf_get(bp), argv[2]);

    btprnt_del(&bp);
    return 0;
}

#ifdef WAVDRAW_CLI
int main(int argc, char *argv[])
{
    return wavdraw_main(argc, argv);
}
#endif



prev | home | next