Skip to content

Commit d7a3960

Browse files
committed
Merge branch 'master' into glsl
2 parents 0732b62 + 3eb68d2 commit d7a3960

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/projectM-sdl/pmSDL.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void projectMSDL::audioInputCallbackS16(void *userdata, unsigned char *stream, i
2020
projectMSDL *app = (projectMSDL *) userdata;
2121
short pcm16[2][512];
2222

23-
for (int i = 0; i < 512; i++) { //
23+
for (int i = 0; i < 512; i++) {
2424
for (int j = 0; j < app->audioChannelsCount; j++) {
2525
pcm16[j][i] = stream[i+j];
2626
}
@@ -79,19 +79,33 @@ void projectMSDL::beginAudioCapture() {
7979
unsigned int maxSamples = audioChannelsCount * audioSampleCount;
8080
pcmBuffer = (unsigned char *) malloc(maxSamples);
8181
SDL_PauseAudioDevice(audioDeviceID, false);
82-
// pm->pcm()->initPCM(maxSamples);
82+
this->pcm()->initPCM(2048);
8383
}
8484

8585
void projectMSDL::endAudioCapture() {
8686
free(pcmBuffer);
8787
SDL_PauseAudioDevice(audioDeviceID, true);
8888
}
8989

90+
void projectMSDL::maximize() {
91+
SDL_DisplayMode dm;
92+
if (SDL_GetDesktopDisplayMode(0, &dm) != 0) {
93+
SDL_Log("SDL_GetDesktopDisplayMode failed: %s", SDL_GetError());
94+
return;
95+
}
96+
97+
SDL_SetWindowSize(win, dm.w, dm.h);
98+
this->resize(dm.w, dm.h);
99+
}
100+
90101
void projectMSDL::toggleFullScreen() {
102+
maximize();
91103
if (isFullScreen) {
92104
SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN_DESKTOP);
93105
isFullScreen = false;
106+
SDL_ShowCursor(true);
94107
} else {
108+
SDL_ShowCursor(false);
95109
SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN);
96110
isFullScreen = true;
97111
}

src/projectM-sdl/pmSDL.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class projectMSDL : projectM {
4242
void resize(unsigned int width, unsigned int height);
4343
void renderFrame();
4444
void pollEvent();
45+
void maximize();
4546

4647
private:
4748
SDL_Window *win;

0 commit comments

Comments
 (0)