debug
authorThomas Pietrzak <thomas.pietrzak@gmail.com>
Tue, 24 May 2011 14:25:32 +0000 (14:25 +0000)
committerThomas Pietrzak <thomas.pietrzak@gmail.com>
Tue, 24 May 2011 14:25:32 +0000 (14:25 +0000)
git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@15 47cf9a05-e0a8-4ed5-9e9b-101a649bc004

14 files changed:
Haptic Metronome/Haptic Metronome.suo
Haptic Metronome/Haptic Metronome/Haptic Metronome.vcxproj
include/MetronomeAudio.hpp
include/MetronomeHaptic.hpp
include/Mixer.hpp
include/Sound.hpp
include/Texture.hpp
src/MetronomeAudio.cpp
src/Mixer.cpp
src/PaintGame.cpp
src/SerialWindows.cpp
src/Texture.cpp
src/Tools.cpp
src/main.cpp

index 5f9e0c5228fb743f7479cfec77b10e20f116a48a..d2e0b3597d8d7369693f48d36ba97919d122e037 100644 (file)
Binary files a/Haptic Metronome/Haptic Metronome.suo and b/Haptic Metronome/Haptic Metronome.suo differ
index 04cb9c5a31c948fac3b5970ddbac38103167c21e..81f38c5e10df3536c1b91c15ab261d6e3e9cb4cd 100644 (file)
   </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
@@ -53,6 +58,7 @@
       <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
index 6d6bb67b260158196377d9cabc36177601ca3ed0..8956755d8a74dfb38e7791ed2f0a5dd46ccd849d 100644 (file)
@@ -5,12 +5,10 @@
 
 #ifdef WIN32
 #include <time.h>
-#include <SDL.h>
-#include <SDL_Thread.h>
-#else
+#endif
+
 #include <SDL/SDL.h>
 #include <SDL/SDL_Thread.h>
-#endif
 \r
 class MetronomeAudio : public Metronome\r
 {      \r
index 361a0053948683ca1cbac226eafc558238a2444c..72eff232b9c208a2636acd2136e0d941d36348c8 100644 (file)
@@ -5,12 +5,10 @@
 
 #ifdef WIN32
 #include <time.h>
-#include <SDL.h>
-#include <SDL_Thread.h>
-#else
+#endif
+
 #include <SDL/SDL.h>
 #include <SDL/SDL_Thread.h>
-#endif
 
 #include "Serial.hpp"
 \r
index 64cb5c522647b0394c310048c3917a00a7a9dc14..ba49c2e1bc6c2190a80303c2d61ddd3339c3f1e3 100644 (file)
 
 #ifdef __APPLE__
 #include <SDL_mixer/SDL_mixer.h>
-#elif WIN32
-#include <SDL_mixer.h>
 #else
 #include <SDL/SDL_mixer.h>
+#include <SDL/SDL_mutex.h>
 #endif
 
 class Mixer
@@ -74,6 +73,7 @@ class Mixer
     int _musicVolume, _soundVolume;
 
     static Mixer *_minstance;
+       static SDL_mutex *_mutex;
 };
 
 #endif
index fbe81f1bd06a836f1b3cc35bbdc98daf6b92b461..8fae0af484da2dca0902dc9979eadf9698f5b084 100644 (file)
@@ -25,8 +25,6 @@
 
 #ifdef __APPLE__
 #include <SDL_mixer/SDL_mixer.h>
-#elif WIN32
-#include <SDL_mixer.h>
 #else
 #include <SDL/SDL_mixer.h>
 #endif
index e2a2ec321e823330752c7ff74b7034fe768b47f0..ee7058ab3eff446fed2b8a7a49bef0d50b2e1e74 100644 (file)
 #define __TEXTURE__
 
 #include <GL/glew.h>
-#ifdef WIN32
-#include <SDL.h>
-#else
 #include <SDL/SDL.h>
-#endif
 // #include <SDL/SDL_opengl.h>
 
 #include "String.hpp"
index 0f2bea0aba690efb688d09c4fa9c4d73243a69df..7d4de3042f5bb886b33fd0610c65283d3dbff0ae 100644 (file)
@@ -18,8 +18,8 @@ extern FILE*logfile;
 MetronomeAudio::MetronomeAudio(const Track *track, uint32_t nbbeats, uint32_t tempo, bool activated)
 :Metronome(track, nbbeats, tempo, activated), thread(NULL)
 {
-       Mixer::getInstance()->addSound("bip","bip10.ogg");
-       Mixer::getInstance()->addSound("bip2","bip2.ogg");
+       Mixer::getInstance()->addSound("bip","bip10.wav");
+       Mixer::getInstance()->addSound("bip2","bip2.wav");
 }
 
 MetronomeAudio::~MetronomeAudio()
index 575e7160d4bb591232961d6a8b5182127f4e1b35..2c22ee7e030524e7275b7843fcc5e10d5456c6a0 100644 (file)
@@ -26,6 +26,7 @@
 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)
@@ -56,6 +57,7 @@ Mixer::~Mixer()
         //for the moment we never unload Sounds...
        if (_music)
                stopMusic();
+       SDL_DestroyMutex(_mutex);
 }
 
 
@@ -93,6 +95,7 @@ void Mixer::playMusic(const String &filename)
 
        if (buffer != "")
        {
+               SDL_mutexP(_mutex);
                _music = Mix_LoadMUS(buffer.c_str());
                if(_music==NULL)
                        fprintf(stderr, "cannot load music %s\n",buffer.c_str());
@@ -101,6 +104,7 @@ void Mixer::playMusic(const String &filename)
                        Mix_PlayMusic(_music, -1);
                        Mix_HookMusicFinished(stopMusic);
                }
+               SDL_mutexV(_mutex);
        }
        else
                fprintf(stderr, "music file %s not found\n",filename.c_str());
@@ -129,7 +133,11 @@ bool Mixer::addSound(const String &s, const String &filename)
                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)
index 8e89292bf085be4c9d447232df29303c8cb74b3a..bec53683e054bcb3af84640a9115a621ba6da055 100644 (file)
@@ -7,17 +7,14 @@
 #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>
@@ -32,8 +29,8 @@ int resolution_x, resolution_y;
 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
@@ -79,7 +76,7 @@ void init()
                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;
@@ -93,12 +90,12 @@ void init()
                        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";
 
@@ -130,8 +127,6 @@ void init()
   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);
 
@@ -140,13 +135,17 @@ void init()
     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;
 
@@ -523,7 +522,7 @@ bool processEvents()
                                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
@@ -605,7 +604,7 @@ bool processEvents()
                                        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
@@ -708,7 +707,7 @@ void loop(const Track &tr, const String &songname)
        if (iswiimoteconnected)
          mw->handleEvents();
 //             cout << "pause" << endl;
-//    SDL_Delay(10);
+    SDL_Delay(10);
        // check metronome events
 //     tr.checkMetronome(currenttime, m);
   }
index 927cfae2bd1022d7834762449cb87af4afef7588..2b6d4d8885e0a8ff9cf7b1a042cac2f44a33cd3e 100644 (file)
@@ -4,11 +4,10 @@
 using namespace std;\r
 
 #ifdef WIN32
-#include <SDL.h>
 #include <windows.h>
-#else
-#include <SDL/SDL.h>
 #endif
+
+#include <SDL/SDL.h>
 \r
 SerialWindows::SerialWindows(char *portName)\r
 :Serial(portName)\r
index 9da81f5b7f23f77d7839568b4554b811bbd4fe8b..85605e245da86fc946afeff4598725f09742bfdc 100644 (file)
@@ -24,8 +24,6 @@
 // #include <SDL/SDL.h>
 #ifdef __APPLE__
 #include <SDL_image/SDL_image.h>
-#elif WIN32
-#include <SDL_image.h>
 #else
 #include <SDL/SDL_image.h>
 #endif
@@ -70,7 +68,7 @@ Texture::Texture(const String &filename, const bool &rep)
 
   if (buffer != "")
     surface = IMG_Load(buffer.c_str());
-       else
+  else
                cerr << "Could not open texture " << filename << endl;
 
   if (surface)
index a09e915c4931901ae551fa2667faebe408be1143..bb23adc1aa5d3881900c0ebb318ff366338cf9cc 100644 (file)
  */
 #include "Tools.hpp"
 
-#ifdef WIN32
-#include <SDL.h>
-#else
 #include <SDL/SDL.h>
-#endif
 
 #include <cmath>
 #include <cstdio>
index 5df6946ab8ae05af6c50765c4add518455139669..f21bc77fbaf85dfd580ec3c3de49c6b08bc82819 100644 (file)
@@ -7,13 +7,12 @@
 
 #ifdef WIN32
 #include <time.h>
-#include <SDL.h>
 #include <windows.h>
 #else
 #include <sys/time.h>
+#endif
 
 #include <SDL/SDL.h>
-#endif
 
 
 #ifdef WIN32
@@ -31,8 +30,6 @@
 
 float SECONDSIZE = 0.050f;
 FILE *logfile = NULL;
-//list<double> bips;
-//list<double>::iterator cb;
 
 void handleStrokeOff()
 {