Showing the changes to player/player.cpp (1 of 6 files). Show all
Unified · Split
| @@ -10,6 +10,8 @@ · 9 unmodified lines | |||
| 10 | #include <OpenGL/gl3.h> | 10 | #include <OpenGL/gl3.h> |
| 11 | #endif | 11 | #endif |
| 12 | #include "FreeSans.h" | 12 | #include "FreeSans.h" |
| 13 | #include "audio_sdl.h" | ||
| 14 | #include "decode.h" | ||
| 13 | 15 | ||
| 14 | #define STB_IMAGE_IMPLEMENTATION | 16 | #define STB_IMAGE_IMPLEMENTATION |
| 15 | #include "stb_image.h" | 17 | #include "stb_image.h" |
| @@ -32,10 +34,11 @@ · 16 unmodified lines | |||
| 32 | #ifdef USE_GLES3 | 34 | #ifdef USE_GLES3 |
| 33 | static PFNGLGENERATEMIPMAPPROC glGenerateMipmap; | 35 | static PFNGLGENERATEMIPMAPPROC glGenerateMipmap; |
| 34 | #endif | 36 | #endif |
| 35 | void *_ctx; | 37 | static void *_ctx; |
| 36 | GLFWwindow *_mainWindow; | 38 | static GLFWwindow *_mainWindow; |
| 37 | std::map<std::string, int> _previews; | 39 | static std::map<std::string, int> _previews; |
| 38 | std::vector<std::string> _playlist; | 40 | static std::vector<std::string> _playlist; |
| 41 | static void *_render; | ||
| 39 | 42 | ||
| 40 | static int load_image(const stbi_uc *data, int len) | 43 | static int load_image(const stbi_uc *data, int len) |
| 41 | { | 44 | { |
| @@ -156,7 +159,7 @@ static void tick() · 114 unmodified lines | |||
| 156 | if (nk_button_label(ctx, "Play") && _selected < (int)_playlist.size()) | 159 | if (nk_button_label(ctx, "Play") && _selected < (int)_playlist.size()) |
| 157 | { | 160 | { |
| 158 | _play_state = 1; | 161 | _play_state = 1; |
| 159 | //play(); | 162 | preload_mp3(&_dec, _playlist[_selected].c_str()); |
| 160 | } | 163 | } |
| 161 | } else | 164 | } else |
| 162 | { | 165 | { |
| @@ -196,10 +199,15 @@ static void tick() · 33 unmodified lines | |||
| 196 | 199 | ||
| 197 | int main(int argc, char *argv[]) | 200 | int main(int argc, char *argv[]) |
| 198 | { | 201 | { |
| 202 | InitializeCriticalSection(&_dec.mp3_lock); | ||
| 203 | sdl_audio_init(&_render, 44100, 2, 0, 0); | ||
| 199 | init(); | 204 | init(); |
| 205 | for (int i = 1; i < argc; i++) | ||
| 206 | _playlist.push_back(argv[i]); | ||
| 200 | while (!glfwWindowShouldClose(_mainWindow)) | 207 | while (!glfwWindowShouldClose(_mainWindow)) |
| 201 | { | 208 | { |
| 202 | tick(); | 209 | tick(); |
| 203 | } | 210 | } |
| 204 | close(); | 211 | close(); |
| 212 | sdl_audio_release(_render); | ||
| 205 | } | 213 | } |