#include #include #include #include #include "noise.h" int main(int argc, char** argv) { struct player_t* player; int i; srand(time(NULL)); /* Initalize Allegro */ if (allegro_init() == -1) { fprintf(stderr, "allegro_init: %s\n", allegro_error); return EXIT_FAILURE; } if (install_timer() == -1) { fprintf(stderr, "install_timer: %s\n", allegro_error); return EXIT_FAILURE; } if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) == -1) { fprintf(stderr, "install_sound: %s\n", allegro_error); return EXIT_FAILURE; } /* Initialize the player */ player = create_player(1, sizeof(sample_t) * 8, 1, 22050, 255, 127, 4); if (player == NULL) { fprintf(stderr, "create_player: Cannot initialize player\n"); return EXIT_FAILURE; } /* Enqueue our song */ for (i = 0; i < num_channels; i++) add_channel_struct(player, &channels[i]); /* Main loop ;^) */ while (fill_buffer(player)); /* Let the buffer empty and then quit */ rest(1000 * player->buf_length / player->rate); destroy_player(player); return EXIT_SUCCESS; } END_OF_MAIN();