</ImportGroup>\r
<PropertyGroup Label="UserMacros" />\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <IncludePath>..\..\lib;..\..\lib\SDL_mixer-1.3\include;..\..\lib\wiiuse_v0.12_win;..\..\lib\glew-1.5.8\include;..\..\include;..\..\lib\SDL_image-1.3\include;..\..\lib\SDL-1.3\include;$(IncludePath)</IncludePath>\r
+ <IncludePath>..\..\include;$(IncludePath)</IncludePath>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <LibraryPath>..\..\lib\SDL_mixer-1.3\lib;..\..\lib\wiiuse_v0.12_win;..\..\lib\glew-1.5.8\lib;..\..\lib\SDL-1.3\lib;..\..\lib\SDL_image-1.3\lib;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath>$(LibraryPath)</LibraryPath>\r
+ <SourcePath>../../src;../../include;$(SourcePath)</SourcePath>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <IncludePath>..\..\lib;..\..\lib\SDL_mixer-1.3\include;..\..\lib\wiiuse_v0.12_win;..\..\lib\glew-1.5.8\include;..\..\include;..\..\lib\SDL_image-1.3\include;..\..\lib\SDL-1.3\include;$(IncludePath)</IncludePath>\r
<SourcePath>../../src;../../include;$(SourcePath)</SourcePath>\r
+ <LibraryPath>..\..\lib\SDL_mixer-1.3\lib;..\..\lib\wiiuse_v0.12_win;..\..\lib\glew-1.5.8\lib;..\..\lib\SDL-1.3\lib;..\..\lib\SDL_image-1.3\lib;$(LibraryPath)</LibraryPath>\r
</PropertyGroup>\r
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
<ClCompile>\r
<GenerateDebugInformation>true</GenerateDebugInformation>\r
<AdditionalDependencies>SDL.lib;SDLmain.lib;SDL_image.lib;SDL_mixer.lib;glew32.lib;opengl32.lib;glu32.lib;wiiuse.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
<SubSystem>Windows</SubSystem>\r
+ <IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>\r
</Link>\r
</ItemDefinitionGroup>\r
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
<Optimization>MaxSpeed</Optimization>\r
<FunctionLevelLinking>true</FunctionLevelLinking>\r
<IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);WIN32</PreprocessorDefinitions>\r
</ClCompile>\r
<Link>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <GenerateDebugInformation>false</GenerateDebugInformation>\r
<EnableCOMDATFolding>true</EnableCOMDATFolding>\r
<OptimizeReferences>true</OptimizeReferences>\r
+ <AdditionalDependencies>SDL.lib;SDLmain.lib;SDL_image.lib;SDL_mixer.lib;glew32.lib;opengl32.lib;glu32.lib;wiiuse.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ <SubSystem>Windows</SubSystem>\r
</Link>\r
</ItemDefinitionGroup>\r
<ItemGroup>\r
Mix_Music *Mixer::_music = NULL;
Mixer *Mixer::_minstance = NULL;
int *Mixer::_soundChannels = NULL;
+SDL_mutex *Mixer::_mutex = SDL_CreateMutex();
Mixer::Mixer()
:/*_music(NULL), *//*_soundChannels(new int[MAXSOUNDS]),*/ _musicVolume(-1), _soundVolume(-1)
//for the moment we never unload Sounds...
if (_music)
stopMusic();
+ SDL_DestroyMutex(_mutex);
}
if (buffer != "")
{
+ SDL_mutexP(_mutex);
_music = Mix_LoadMUS(buffer.c_str());
if(_music==NULL)
fprintf(stderr, "cannot load music %s\n",buffer.c_str());
Mix_PlayMusic(_music, -1);
Mix_HookMusicFinished(stopMusic);
}
+ SDL_mutexV(_mutex);
}
else
fprintf(stderr, "music file %s not found\n",filename.c_str());
snd = _sounds[s];
}
- return snd->addSound(filename);
+ SDL_mutexP(_mutex);
+ bool res = snd->addSound(filename);
+ SDL_mutexV(_mutex);
+
+ return res;
}
void Mixer::playSound(const String &s)
#include "MetronomeHaptic.hpp"
#include <GL/glew.h>
+#include <SDL/SDL.h>
+#include <SDL/SDL_mixer.h>
+#include <SDL/SDL_image.h>
#ifdef WIN32
-#include <SDL.h>
-#include <SDL_mixer.h>
-#include <SDL_image.h>
struct { int tv_sec, tv_usec; } start;
#else
struct timeval start;
-#include <SDL/SDL.h>
-#include <SDL/SDL_mixer.h>
-#include <SDL/SDL_image.h>
#endif
#include <iostream>
Config fromKeyboard;
extern FILE*logfile;
-\r
-#if SDL_VERSION_ATLEAST(1,3,0)\r
+
+#if SDL_VERSION_ATLEAST(1,3,0)
SDL_Window *window;
SDL_Renderer *renderer;
#endif
for (i=0 ; modes[i] ; i++)
{
cout << "Resolution available: " << modes[i]->w << "x" << modes[i]->h << endl;
- if (modes[i]->w > resolution_x)//== 1280 && modes[i]->h == 1024)
+ if (modes[i]->w== 1600 && modes[i]->h == 900) //> resolution_x)//
{
resolution_x = modes[i]->w;
resolution_y = modes[i]->h;
resolution_y = 768;
}*/
}
- \r
-#if 0//SDL_VERSION_ATLEAST(1,3,0)\r
- if ((window = SDL_CreateWindow("Haptic Metronome",\r
- SDL_WINDOWPOS_CENTERED,\r
- SDL_WINDOWPOS_CENTERED,\r
- resolution_x, resolution_y,\r
+
+#if 0//SDL_VERSION_ATLEAST(1,3,0)
+ if ((window = SDL_CreateWindow("Haptic Metronome",
+ SDL_WINDOWPOS_CENTERED,
+ SDL_WINDOWPOS_CENTERED,
+ resolution_x, resolution_y,
SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN)) == NULL)
throw "Unable to create the window";
SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 8);
-
- int flags = SDL_OPENGL | SDL_OPENGL | SDL_HWSURFACE | SDL_FULLSCREEN;
glEnable(GL_MULTISAMPLE);
throw "Impossible to initialize SDL_GL_MULTISAMPLEBUFFERS";
// Nombre de tampons utilisés pour l'anti-aliasing (la valeur utilisée dépend de la carte graphique)
- if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8) == -1)
+ if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16) == -1)
throw "Impossible to initialize SDL_GL_MULTISAMPLESAMPLES";
-
+
// int flags = SDL_OPENGL | SDL_OPENGLBLIT | SDL_SWSURFACE | SDL_FULLSCREEN;
+ int flags = SDL_OPENGL | SDL_FULLSCREEN;
SDL_Surface * screen;
- if (!(screen = SDL_SetVideoMode(resolution_x, resolution_y, 0, flags)))
+// if (!(screen = SDL_SetVideoMode(resolution_x, resolution_y, 0, flags)))
+ if (!(screen = SDL_SetVideoMode(0, 0, 0, flags)))
throw "Impossible to change the video mode";
+ resolution_x = 1600;
+ resolution_y = 900;
GLdouble ratio = (GLdouble) screen->w / screen->h;
break;
case SDL_KEYDOWN:
-#if SDL_VERSION_ATLEAST(1,3,0)\r
+#if SDL_VERSION_ATLEAST(1,3,0)
keystate = SDL_GetKeyboardState(NULL);
handleKeys(keystate[SDL_SCANCODE_F1], keystate[SDL_SCANCODE_F2], keystate[SDL_SCANCODE_F3], keystate[SDL_SCANCODE_F4], keystate[SDL_SCANCODE_F5], currenttime);
#else
default:
break;
}
-#if SDL_VERSION_ATLEAST(1,3,0)\r
+#if SDL_VERSION_ATLEAST(1,3,0)
keystate = SDL_GetKeyboardState(NULL);
handleKeys(keystate[SDL_SCANCODE_F1], keystate[SDL_SCANCODE_F2], keystate[SDL_SCANCODE_F3], keystate[SDL_SCANCODE_F4], keystate[SDL_SCANCODE_F5], currenttime);
#else
if (iswiimoteconnected)
mw->handleEvents();
// cout << "pause" << endl;
-// SDL_Delay(10);
+ SDL_Delay(10);
// check metronome events
// tr.checkMetronome(currenttime, m);
}