| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <complex.h>
- #include <raylib.h>
- #ifndef _WIN32
- #include <signal.h> // needed for sigaction()
- #endif // _WIN32
- #include "./hotreload.h"
- int main(void)
- {
- #ifndef _WIN32
- // NOTE: This is needed because if the pipe between Musializer and FFmpeg breaks
- // Musializer will receive SIGPIPE on trying to write into it. While such behavior
- // makes sense for command line utilities, Musializer is a relatively friendly GUI
- // application that is trying to recover from such situations.
- struct sigaction act = {0};
- act.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &act, NULL);
- #endif // _WIN32
- if (!reload_libplug()) return 1;
- Image logo = LoadImage("./resources/logo/logo-256.png");
- SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_ALWAYS_RUN);
- size_t factor = 80;
- InitWindow(factor*16, factor*9, "Musializer");
- SetWindowIcon(logo);
- SetTargetFPS(60);
- SetExitKey(KEY_NULL);
- InitAudioDevice();
- plug_init();
- while (!WindowShouldClose()) {
- if (IsKeyPressed(KEY_H)) {
- void *state = plug_pre_reload();
- if (!reload_libplug()) return 1;
- plug_post_reload(state);
- }
- plug_update();
- }
- CloseAudioDevice();
- CloseWindow();
- UnloadImage(logo);
- return 0;
- }
|