History

player: add audio render

lieff committed 8 years ago

Commit 53cb2a11 parent 29f6dca6 files · +133 −8Browse files

Showing the changes to player/player.cpp (1 of 6 files). Show all

Unified · Split

player/player.cpp+13−5
@@ -10,6 +10,8 @@ · 9 unmodified lines
10#include <OpenGL/gl3.h>10#include <OpenGL/gl3.h>
11#endif11#endif
12#include "FreeSans.h"12#include "FreeSans.h"
13#include "audio_sdl.h"
14#include "decode.h"
13 15
14#define STB_IMAGE_IMPLEMENTATION16#define STB_IMAGE_IMPLEMENTATION
15#include "stb_image.h"17#include "stb_image.h"
@@ -32,10 +34,11 @@ · 16 unmodified lines
32#ifdef USE_GLES334#ifdef USE_GLES3
33static PFNGLGENERATEMIPMAPPROC glGenerateMipmap;35static PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
34#endif36#endif
35void *_ctx;37static void *_ctx;
36GLFWwindow *_mainWindow;38static GLFWwindow *_mainWindow;
37std::map<std::string, int> _previews;39static std::map<std::string, int> _previews;
38std::vector<std::string> _playlist;40static std::vector<std::string> _playlist;
41static void *_render;
39 42
40static int load_image(const stbi_uc *data, int len)43static 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 } else164 } else
162 {165 {
@@ -196,10 +199,15 @@ static void tick() · 33 unmodified lines
196 199
197int main(int argc, char *argv[])200int 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}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t