bool C4MusicFileOgg::Play(bool loop) { // Load Song size_t iFileSize; if (!C4Group_ReadFile(FileName, &Data, &iFileSize)) return false; // init fsound int loop_flag = loop ? FSOUND_LOOP_NORMAL : 0; stream = FSOUND_Stream_Open(Data, FSOUND_LOADMEMORY | FSOUND_NORMAL | FSOUND_2D | loop_flag, 0, iFileSize); if (!stream) return false; // Play Song Channel = FSOUND_Stream_Play(FSOUND_FREE, stream); if (Channel == -1) return false; // Set highest priority if (!FSOUND_SetPriority(Channel, 255)) return false; Playing = true; FSOUND_Stream_SetEndCallback(stream, &C4MusicFileOgg::OnEnd, this); return true; }
void MusicStream::play(double volume) { if (! playing && (music != NULL)) { channel = FSOUND_Stream_Play(FSOUND_FREE, music); FSOUND_SetVolume(channel, min(volume, 1) * 255); playing = true; } }
int CSound::Startmusic(char *song) { songname = song; CurrentSong = FSOUND_Stream_OpenFile(song,FSOUND_LOOP_NORMAL,0); //if (!CurrentSong) //{ //printf("Error Loading!\n"); //printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); // return 1; //} FSOUND_Stream_Play(0,CurrentSong); SetMusicVolume(MUSIC_VOLUME); // be adam: stream play seems to reset the music volume // ret = FMUSIC_PlaySong(CurrentSong); // if (!ret) { //printf("Error Playing!\n"); //printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); // return 2; //printf("Press Any Key.\n"); } // getchar(); return 0; }
void LecteurAudio::joueurLectureMorceau() { // Si aucun fichier audio n'est actuellement ouvert, on quitte la fonction if (!fluxAudio) { qWarning("Demande de lecture alors qu'aucun fichier n'est ouvert (joueurLectureMorceau - LecteurAudio.cpp)"); return; } // Si le lecteur etait a l'arret if (etatActuel == arret) { // L'etat passe a Lecture etatActuel = lecture; // On initialise le canal audio en commencant la lecture canalAudio = FSOUND_Stream_Play(FSOUND_FREE, fluxAudio); // On se positionne a l'endroit indique par le MJ FSOUND_Stream_SetTime(fluxAudio, joueurPositionTemps); // On regle le volume FSOUND_SetVolume(canalAudio, niveauVolume->value()); } // Si le lecteur etait en pause else if (etatActuel == pause) { // L'etat passe a Lecture etatActuel = lecture; // On reprend la lecture du titre FSOUND_SetPaused(canalAudio, false); } // Dans tous les autres cas il s'agit d'une erreur else qWarning("Demande de lecture d'un titre alors que le lecteur n'est ni en pause, ni a l'arret (joueurLectureMorceau - LecteurAudio.cpp)"); }
bool C4MusicFileMP3::Play(bool loop) { #ifndef USE_MP3 return false; #endif // Load Song size_t iFileSize; if (!C4Group_ReadFile(FileName, &Data, &iFileSize)) return false; // init fsound int loop_flag = loop ? FSOUND_LOOP_NORMAL : 0; stream = FSOUND_Stream_Open(Data, FSOUND_LOADMEMORY | FSOUND_NORMAL | FSOUND_2D | loop_flag, 0, iFileSize); if (!stream) return false; // Play Song Channel = FSOUND_Stream_Play(FSOUND_FREE, stream); if (Channel == -1) return false; // Set highest priority if (!FSOUND_SetPriority(Channel, 255)) return false; return true; }
// Lecture des sons. Ils sont lu par streaming c'est à dire qu'ils sont chargés pendant la lecture. void CSoundManager::Jouer ( std::string const & Filename, ECanaux Canal, bool bLoop ) { if (!m_bCanauxJeu && Canal != CANAL_MUSIQUE) return; if (m_pSon[Canal]) FSOUND_Stream_Close (m_pSon[Canal]); // Si bLoop == true alors le son boucle. if (bLoop) { FSOUND_SetLoopMode (0, FSOUND_LOOP_NORMAL); m_pSon[Canal] = FSOUND_Stream_Open((DIRECTORY + Filename).c_str(), FSOUND_LOOP_NORMAL, 0, 0); FSOUND_SetVolume (Canal, 64); FSOUND_SetVolumeAbsolute (Canal, 64); } // Sinon il est jouer une seule fois. else { m_pSon[Canal] = FSOUND_Stream_Open((DIRECTORY + Filename).c_str(), FSOUND_NORMAL, 0, 0); FSOUND_SetVolume (Canal, 255); FSOUND_SetVolumeAbsolute (Canal, 255); } FSOUND_Stream_Play (Canal, m_pSon[Canal]); }
void LecteurAudio::appuiLecture(bool etatBouton) { // Le bouton vient d'etre enfonce if (etatBouton) { // On (re)met en lecture les lecteurs des joueurs emettreCommande(lectureMorceau); // L'etat passe a Lecture etatActuel = lecture; // Si le bouton pause etait enfonce il s'agit d'une reprise de pause if (actionPause->isChecked()) { // On relache le bouton pause actionPause->setChecked(false); // On reprend la lecture du titre FSOUND_SetPaused(canalAudio, false); } // Sinon il s'agit d'une premiere lecture else { // On rend inoperant le passage sur un tag : sans cela un tag peut deplacer le curseur de temps entre // le lancement de la lecture et le repositionnement dans le temps repriseDeLecture = true; // On initialise le canal audio en commencant la lecture canalAudio = FSOUND_Stream_Play(FSOUND_FREE, fluxAudio); // On se positionne a l'endroit choisi par l'utilisateur FSOUND_Stream_SetTime(fluxAudio, positionTemps->value()); // On regle le volume FSOUND_SetVolume(canalAudio, niveauVolume->value()); // Le passage sur un tag est a nouveau operationnel repriseDeLecture = false; } } // Le bouton vient d'etre relache else { // Le lecteur etait dans l'etat Lecture if (etatActuel == lecture) { // On met en pause les lecteurs des joueurs emettreCommande(pauseMorceau); // On met le lecteur en Pause etatActuel = pause; // On enfonce le bouton pause actionPause->setChecked(true); // On met la lecture en pause FSOUND_SetPaused(canalAudio, true); } // Dans les autres cas il y a un probleme else { qWarning("Le bouton lecture etait enfonce alors que le lecteur n'etait pas en en train de lire (appuiLecture - LecteurAudio.cpp)"); return; } } }
//count = 0 is infinte void CAudioManager::PlayStream(int id, int count){ if(m_bValidAudio == false) return; for(int i = 0; i < m_Stream.size(); i++){ if(m_Stream[i].AudioID == id){ FSOUND_Stream_SetLoopCount(m_Stream[i].handle, count); FSOUND_Stream_Play(m_Stream[i].AudioID, m_Stream[i].handle); } } }
void SoundSystem::playMusic(const FileName &fileName) { stopMusic(); if(!mute && fileName!=FileName("none") && fileName!=FileName("")) { musicStream = FSOUND_Stream_Open(fileName.c_str(), FSOUND_LOOP_NORMAL, 0, 0); musicChannel = FSOUND_Stream_Play(FSOUND_FREE, musicStream); TRACE("Playing music: " + fileName.str()); } }
//=========================================================================== // DM_FModExtStartPlaying //=========================================================================== void DM_FModExtStartPlaying(void) { if(module) { FMUSIC_SetMasterVolume(module, ext_volume); FMUSIC_PlaySong(module); } if(stream) { stream_channel = FSOUND_Stream_Play(FSOUND_FREE, stream); } // ext_playing = true; // ext_start_time = Sys_GetTime(); }
/* * * void Play(float fadeout, float fadein, Music &oldmusic){ * if (!m) return; * FSOUND_Stream_SetEndCallback(m,endcallback,0); * FSOUND_Stream_SetSynchCallback(m, endcallback, 0); * channel = FSOUND_Stream_PlayEx(FSOUND_FREE, m, NULL, 1); * FSOUND_SetPaused(channel, 0); * SetVolume(0); * if (fadeout*100>1) { * for (unsigned int i=0;i<fadeout*100;i++) { * SetVolume(i/(float)fadeout); * oldmusic.SetVolume(((float)fadeout-i)/fadeout); * micro_sleep (10000); * } * } * SetVolume(1); * oldmusic.Stop(); * } * void SetVolume(float vol) { * if (m) { * F_API FSOUND_SetVolume(this->channel,(int)(vol*GetMaxVolume())); * } * } */ void Play( float fadeout, float fadein, Music &oldmusic ) { if (!m) return; FSOUND_Stream_SetEndCallback( m, endcallback, 0 ); FSOUND_Stream_SetSynchCallback( m, endcallback, 0 ); channel = FSOUND_Stream_Play( FSOUND_FREE, m ); SetVolume( 0 ); if (fadeout*10 > 1) for (unsigned int i = 0; i < fadeout*10; i++) { float ratio = ( (float) i )/(fadeout*10.); SetVolume( ratio ); oldmusic.SetVolume( 1-ratio ); micro_sleep( 10000 ); } oldmusic.Stop(); oldmusic.Free(); SetVolume( 1 ); }
void Ambient::enterState() { if(baseBuffer != NULL && baseSize > 0) { base = FSOUND_Stream_Open(static_cast<const char*>(baseBuffer), FSOUND_LOADMEMORY | FSOUND_LOOP_NORMAL, 0, baseSize); if(base == NULL) { reportFMODError("FSOUND_Stream_Open"); } else { baseChannel = FSOUND_Stream_Play(FSOUND_FREE, base); if(baseChannel == -1) { reportFMODError("FSOUND_Stream_Play"); } else { isActive = true; play(); } } } }
void StateLevel::handleEvents() { if ( SDL_PollEvent(&event) ) { if ( event.type == SDL_QUIT ) setNextGameState(0); if ( event.type == SDL_KEYUP ) { if ( event.key.keysym.sym == SDLK_ESCAPE ) setNextGameState (2); if ( event.key.keysym.sym == SDLK_SPACE && ( (o_player.b_die == true) || (o_player.b_win == true )) ) b_go = true; if ( event.key.keysym.sym == SDLK_r ) b_restart = true; } if ( o_player.b_die == false && o_player.b_win == false ) o_player.handleEvents(); if ( event.type == SDL_KEYUP && event.key.keysym.sym == SDLK_m ) { if ( b_music == true ) { FSOUND_Stream_Stop(song2); b_music = false; } else if ( b_music == false ) { FSOUND_Stream_Play( 1, song2 ); FSOUND_Stream_SetLoopCount(song2,-1); b_music = true; } } } }
Status Target::Response() { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, _targetTex); //camera spot light GLfloat white_light[] = {1.0, 1.0, 1.0, 1.0}; GLfloat uplightpoz[] = {0, 20, 0, 1}; GLfloat uplightdir[]={0, -1, 0}; glLightfv(GL_LIGHT2, GL_DIFFUSE, white_light); glLightfv(GL_LIGHT2, GL_SPOT_DIRECTION, uplightdir); glLightf(GL_LIGHT2, GL_SPOT_CUTOFF, 60); glLightf(GL_LIGHT2, GL_SPOT_EXPONENT, 50); glLightfv(GL_LIGHT3, GL_DIFFUSE, white_light); glLightfv(GL_LIGHT3, GL_SPOT_DIRECTION, uplightdir); glLightf(GL_LIGHT3, GL_SPOT_CUTOFF, 60); glLightf(GL_LIGHT3, GL_SPOT_EXPONENT, 50); glLightfv(GL_LIGHT4, GL_DIFFUSE, white_light); glLightfv(GL_LIGHT4, GL_SPOT_DIRECTION, uplightdir); glLightf(GL_LIGHT4, GL_SPOT_CUTOFF, 60); glLightf(GL_LIGHT4, GL_SPOT_EXPONENT, 50); glLightfv(GL_LIGHT5, GL_DIFFUSE, white_light); glLightfv(GL_LIGHT5, GL_SPOT_DIRECTION, uplightdir); glLightf(GL_LIGHT5, GL_SPOT_CUTOFF, 60); glLightf(GL_LIGHT5, GL_SPOT_EXPONENT, 50); glLightfv(GL_LIGHT6, GL_DIFFUSE, white_light); glLightfv(GL_LIGHT6, GL_SPOT_DIRECTION, uplightdir); glLightf(GL_LIGHT6, GL_SPOT_CUTOFF, 60); glLightf(GL_LIGHT6, GL_SPOT_EXPONENT, 50); glLightfv(GL_LIGHT7, GL_DIFFUSE, white_light); glLightfv(GL_LIGHT7, GL_SPOT_DIRECTION, uplightdir); glLightf(GL_LIGHT7, GL_SPOT_CUTOFF, 60); glLightf(GL_LIGHT7, GL_SPOT_EXPONENT, 50); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glPushMatrix(); glTranslatef(targetPoz1.x, 0, targetPoz1.z); glLightfv(GL_LIGHT2, GL_POSITION,uplightpoz); if (flag1 == 1) { glDisable(GL_LIGHT2); glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); } else if (collision(BulletPoz)==1) { glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); //if hit the target, play clap sound hitTarget = FSOUND_Stream_Open( "Resources\\Sound\\hitTarget.wav" , FSOUND_2D , 0 , 0 ); FSOUND_Stream_Play(0,hitTarget); flag1 = 1; } glCallList(targetList); glPopMatrix(); glPushMatrix(); glTranslatef(targetPoz2.x, 0, targetPoz2.z); glLightfv(GL_LIGHT3, GL_POSITION,uplightpoz); if (flag2 == 1) { glDisable(GL_LIGHT3); glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); } else if (collision(BulletPoz)==2) { glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); //if hit the target, play clap sound hitTarget = FSOUND_Stream_Open( "Resources\\Sound\\hitTarget.wav" , FSOUND_2D , 0 , 0 ); FSOUND_Stream_Play(0,hitTarget); flag2 = 1; } glCallList(targetList); glPopMatrix(); glPushMatrix(); glTranslatef(targetPoz3.x, 0, targetPoz3.z); glLightfv(GL_LIGHT4, GL_POSITION,uplightpoz); if (flag3 == 1) { glDisable(GL_LIGHT4); glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); } else if (collision(BulletPoz)==3) { glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); //if hit the target, play clap sound hitTarget = FSOUND_Stream_Open( "Resources\\Sound\\hitTarget.wav" , FSOUND_2D , 0 , 0 ); FSOUND_Stream_Play(0,hitTarget); flag3 = 1; } glCallList(targetList); glPopMatrix(); glPushMatrix(); glTranslatef(targetPoz4.x, 0, targetPoz4.z); glLightfv(GL_LIGHT5, GL_POSITION,uplightpoz); if (flag4 == 1) { glDisable(GL_LIGHT5); glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); } else if (collision(BulletPoz)==4) { glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); //if hit the target, play clap sound hitTarget = FSOUND_Stream_Open( "Resources\\Sound\\hitTarget.wav" , FSOUND_2D , 0 , 0 ); FSOUND_Stream_Play(0,hitTarget); flag4 = 1; } glCallList(targetList); glPopMatrix(); glPushMatrix(); glTranslatef(targetPoz5.x, 0, targetPoz5.z); glLightfv(GL_LIGHT6, GL_POSITION,uplightpoz); if (flag5 == 1) { glDisable(GL_LIGHT6); glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); } else if (collision(BulletPoz)==5) { glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); //if hit the target, play clap sound hitTarget = FSOUND_Stream_Open( "Resources\\Sound\\hitTarget.wav" , FSOUND_2D , 0 , 0 ); FSOUND_Stream_Play(0,hitTarget); flag5 = 1; } glCallList(targetList); glPopMatrix(); glPushMatrix(); glTranslatef(targetPoz6.x, 0, targetPoz6.z); glLightfv(GL_LIGHT7, GL_POSITION,uplightpoz); if (flag6 == 1) { glDisable(GL_LIGHT7); glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); } else if (collision(BulletPoz)==6) { glTranslatef(0, -1.6, 0); glRotatef(90, 1, 0, 0); //if hit the target, play clap sound hitTarget = FSOUND_Stream_Open( "Resources\\Sound\\hitTarget.wav" , FSOUND_2D , 0 , 0 ); FSOUND_Stream_Play(0,hitTarget); flag6 = 1; } glCallList(targetList); glPopMatrix(); glDisable(GL_TEXTURE_2D); if (flag1==1&&flag2==1&&flag3==1&&flag4==1&&flag5==1&&flag6==1) { return WIN; } }
static void DrawCube(void) { if (guss == 99){ } else if (gCharacter[0].patt_found){ glPushMatrix(); //Applying // coordinate transformation matrix arglCameraViewRH(gCharacter[0].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScalef(7.8, 4.8, 4.8); //glTranslated(3, 0, -30); //glRotated(90, 1, 0, 0); //sky(); //glTranslated(-3, 0, 20); //glScalef(xx, yy, z); //drawElephant2(); if (wire){ OnDraw(); } else OnDraw1(); glPopMatrix(); glPopMatrix(); if (skyflag){ } //FSOUND_Stream_Play(0, g_mp3_stream1); //PlaySound(data1, NULL, SND_ASYNC | SND_NOSTOP );*/ } else if (gCharacter[4].patt_found){ glPushMatrix(); //Applying // coordinate transformation matrix arglCameraViewRH(gCharacter[4].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); //sky(); glTranslated(-3, 0, 20); glScalef(xx, yy, z); //drawElephant2(); FSOUND_Stream_Play(0, g_mp3_stream1); //PlaySound(data1, NULL, SND_ASYNC | SND_NOSTOP );*/ } else if(gCharacter[1].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[1].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, LIGHT_MODEL_AMBIENT); glEnable(GL_LIGHTING); //gluPerspective(60.0, ASPECT_RATIO, 0.2, 100.0); gluLookAt(LOOK_AT_POSITION[0] + ViewerDistance * sin(viewerZenith) * sin(viewerAzimuth), LOOK_AT_POSITION[1] + ViewerDistance * cos(viewerZenith), LOOK_AT_POSITION[2] + ViewerDistance * sin(viewerZenith) * cos(viewerAzimuth), LOOK_AT_POSITION[0], LOOK_AT_POSITION[1], LOOK_AT_POSITION[2], 0.0, 1.0, 0.20); glScalef(xx, yy, z); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_NORMALIZE); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); FSOUND_Stream_Play(0, g_mp3_stream2); glRotated(90, 1, 0, 0); glScaled(2, 2, 2); UpdateLight(); drawEarthAndMoon(); drawAllPlanets(); drawSaturnRing(); drawSun(); if (blendFlag){ glEnable(GL_BLEND); glDepthMask(GL_FALSE); glBlendFunc(GL_SRC_COLOR, GL_ONE); } if (particleFlag) drawAllParticles(); glDepthMask(GL_TRUE); glDisable(GL_BLEND); glDisable(GL_LIGHTING); //drawElephant(); //glTranslated(0, 0, -2); glPopMatrix(); glPopMatrix(); //OnDraw2(); } else if (gCharacter[3].patt_found) { glPushMatrix(); arglCameraViewRH(gCharacter[3].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, LIGHT_MODEL_AMBIENT); glEnable(GL_LIGHTING); //gluPerspective(60.0, ASPECT_RATIO, 0.2, 100.0); gluLookAt(LOOK_AT_POSITION[0] + ViewerDistance * sin(viewerZenith) * sin(viewerAzimuth), LOOK_AT_POSITION[1] + ViewerDistance * cos(viewerZenith), LOOK_AT_POSITION[2] + ViewerDistance * sin(viewerZenith) * cos(viewerAzimuth), LOOK_AT_POSITION[0], LOOK_AT_POSITION[1], LOOK_AT_POSITION[2], 0.0, 1.0, 0.020); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_NORMALIZE); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTranslated(0, 0, 0); glScalef(xx, yy, z); UpdateLight(); glRotated(90, 1, 0, 0); drawOne(); glDepthMask(GL_TRUE); glDisable(GL_BLEND); glDisable(GL_LIGHTING); guss1 = 1; glPopMatrix(); glPopMatrix(); } /* if (gCharacter[4].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[4].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScaled(xx, yy, z); glColor3d(1, 1, 1); glBegin(GL_QUADS); glVertex2f(-3, 3); glVertex2f(-3, -3); glVertex2f(3, -3); glVertex2f(3, 3); glEnd(); glPopMatrix(); glPushMatrix(); glTranslated(0, 0, 2); glScaled(25, 25, 25); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glEnd(); glPopMatrix(); glPopMatrix(); //printf("found"); } if (gCharacter[5].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[5].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScaled(xx, yy, z); glColor3d(1, 1, 1); glBegin(GL_QUADS); glVertex2f(-3, 3); glVertex2f(-3, -3); glVertex2f(3, -3); glVertex2f(3, 3); glEnd(); glPopMatrix(); glPushMatrix(); glTranslated(0, 0, 2); glScaled(25, 25, 25); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glEnd(); glPopMatrix(); glPopMatrix(); //printf("found"); }*/else if (gCharacter[5].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[6].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScalef(13, 13, 13); glColor3f(1, 1, 1); glTranslated(-10, 0, 0); cube(); FSOUND_Stream_Play(0, g_mp3_stream16); glPopMatrix(); glPopMatrix(); } /* if (gCharacter[7].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[7].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScaled(xx, yy, z); glColor3d(1, 1, 1); glBegin(GL_QUADS); glVertex2f(-3, 3); glVertex2f(-3, -3); glVertex2f(3, -3); glVertex2f(3, 3); glEnd(); glPopMatrix(); if (pause){ glPushMatrix(); glTranslated(0, 0, 2); glScaled(25, 25, 25); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glEnd(); glPopMatrix(); } else if (!pause){ glPushMatrix(); glScaled(8, 8, 8); glTranslated(0, -1 , 3); glRotated(90, 0, 0, 1); glColor3d(0, 1, 1); glBegin(GL_QUADS); glVertex2f(-0.6, 3); glVertex2f(-0.6, -3); glVertex2f(0.6, -3); glVertex2f(0.6, 3); glEnd(); glPopMatrix(); glPushMatrix(); glScaled(8, 8, 8); glTranslated(0, 1 , 3); glRotated(90, 0, 0, 1); glColor3d(0, 1, 1); glBegin(GL_QUADS); glVertex2f(-0.6, 3); glVertex2f(-0.6, -3); glVertex2f(0.6, -3); glVertex2f(0.6, 3); glEnd(); glPopMatrix(); } glPopMatrix(); }*/ }
void StateMenu::handleEvents() { if ( SDL_PollEvent(&event) ) { if ( event.type == SDL_QUIT ) { setNextGameState(0); } if ( event.type == SDL_KEYUP && event.key.keysym.sym == SDLK_m ) { if ( b_music == true ) { FSOUND_Stream_Stop(song2); b_music = false; } else if ( b_music == false ) { FSOUND_Stream_Play( 1, song2 ); FSOUND_Stream_SetLoopCount(song2,-1); b_music = true; } } if ( event.type == SDL_MOUSEBUTTONUP ) { if ( event.button.button == SDL_BUTTON_LEFT ) { int x,y; SDL_GetMouseState(&x,&y); Box mouse; mouse.x = (float)x; mouse.y = (float)y; mouse.w = 1; mouse.h = 1; if ( checkCollisionQuads( mouse, play ) ) { setNextGameState(8); } else if ( checkCollisionQuads( mouse, select ) ) { setNextGameState(5); } else if ( checkCollisionQuads( mouse, editor ) ) { setNextGameState(4); } else if ( checkCollisionQuads( mouse, exit ) ) { setNextGameState(0); } } } } }
void LecteurAudio::finDeTitreSlot() { // Si la lecture en boucle est activee if (enBoucle) { // On arrete les lecteurs des joueurs emettreCommande(arretMorceau); // On remet en lecture les lecteurs des joueurs emettreCommande(lectureMorceau); // On initialise le canal audio en commencant la lecture canalAudio = FSOUND_Stream_Play(FSOUND_FREE, fluxAudio); // On regle le volume FSOUND_SetVolume(canalAudio, niveauVolume->value()); // On remet la barre de temps au depart positionTemps->setValue(0); positionTemps->update(); // On met l'afficheur de temps a 0 afficheurTemps->display("0:00"); } // Si la lecture unique est activee else if (lectureUnique) { // On arrete les lecteurs des joueurs emettreCommande(arretMorceau); // On arrete le lecteur local arreter(); } // Sinon on passe au titre suivant else { // Il existe un titre suivant if (titreCourant < listeChemins.size()-1) { // On passe au titre suivant titreCourant++; // On envoie le nouveau titre aux lecteurs des joueurs emettreCommande(nouveauMorceau, listeTitres->item(titreCourant)->text()); // On demande aux lecteurs des joueurs de commencer a le lire emettreCommande(lectureMorceau); // Changement de titre en cours nouveauTitre(listeTitres->item(titreCourant)->text(), listeChemins[titreCourant]); // On met le lecteur en lecture etatActuel = lecture; // On initialise le canal audio en commencant la lecture canalAudio = FSOUND_Stream_Play(FSOUND_FREE, fluxAudio); // On regle le volume FSOUND_SetVolume(canalAudio, niveauVolume->value()); // On enfonce le bouton Lecture actionLecture->setChecked(true); } // Il n'existe pas de titre suivant : on arrete le lecteur else { // On emet une demande d'arret aux autres utilisateurs emettreCommande(arretMorceau); // On arrete le lecteur arreter(); } } }
int main ( int argc, char* args[] ) { init(); srand(time(NULL)); int FPS = 0; ///////GLOBAL LOADING tex_spikes = loadTexture("data/gfx/Spikes.png"); tex_block1 = loadTexture("data/gfx/block1.png"); tex_menu = loadTexture("data/gfx/menu.png"); tex_playgame = loadTexture("data/gfx/playgame.png"); tex_selectlevel = loadTexture("data/gfx/selectlevel.png"); tex_editor = loadTexture("data/gfx/editor.png"); tex_exit = loadTexture("data/gfx/exitmenu.png"); tex_player1 = loadTexture("data/gfx/player.png"); tex_door = loadTexture("data/gfx/door.png"); tex_font = loadTexture("data/gfx/font.png"); tex_done = loadTexture("data/gfx/ok.png"); tex_gold = loadTexture("data/gfx/gold.png"); tex_silver = loadTexture("data/gfx/silver.png"); tex_bronze = loadTexture("data/gfx/bronze.png"); tex_eyes = loadTexture("data/gfx/playgame.png"); tex_arrow = loadTexture("data/gfx/arrow.png"); tex_info = loadTexture("data/gfx/info.png"); ///////soundsss sample_playerJump = FSOUND_Sample_Load(FSOUND_UNMANAGED,"data/sfx/jump.wav",0,0,0); FSOUND_Sample_SetDefaults(sample_playerJump, -1,100,-1,-1); sample_playerHit = FSOUND_Sample_Load(FSOUND_UNMANAGED,"data/sfx/hit.wav",0,0,0); FSOUND_Sample_SetDefaults(sample_playerHit, -1,100,-1,-1); sample_playerForce = FSOUND_Sample_Load(FSOUND_UNMANAGED,"data/sfx/force.wav",0,0,0); FSOUND_Sample_SetDefaults(sample_playerForce, -1,100,-1,-1); song2 = FSOUND_Stream_Open( "data/music/Random-SitgesSavepoint.mp3",FSOUND_LOOP_NORMAL,0,0); FSOUND_Stream_Play( 1, song2 ); FSOUND_Stream_SetLoopCount(song2,-1); //FSOUND_SetVolume(1,80); std::ifstream file ("data/levels/score.lvl"); while ( !file.eof() ) { o_scores.push_back(new Score()); file >> o_scores.back()->i_number; file >> o_scores.back()->b_unlocked; file >> o_scores.back()->i_highScore; file >> o_scores.back()->i_B; file >> o_scores.back()->i_S; file >> o_scores.back()->i_G; } file.close(); //o_scores.pop_back(); gameState = new StateMenu(); currentGameState = STATE_MENU; /* for ( int n = 0; n < 100; n++ ) { o_scores.push_back( new Score () ); o_scores.back()->b_unlocked = true; o_scores.back()->i_highScore = 0; o_scores.back()->i_B = 0; o_scores.back()->i_G = 0; o_scores.back()->i_S = 0; }*/ //saving FPSA = SDL_GetTicks(); while ( nextGameState != STATE_EXIT ) { FPS = SDL_GetTicks(); gameState->handleEvents(); gameState->logic(); FPSA = SDL_GetTicks(); gameState->render(); changeGameState(); //////////////////////////// if ( (SDL_GetTicks() - FPS) < 1000/60 ) { //SDL_Delay( ( 1000/60) - (SDL_GetTicks() - FPS) ); } SDL_Delay(2); } FSOUND_Stream_Close(song2); FSOUND_Close(); return 0; }
bool CMenu::load(TiXmlNode* t_nodePtr) { TiXmlNode* a_nodePtr = 0; TiXmlNode* a_subNodePtr = 0; TiXmlElement* a_elemPtr = 0; CMenuItem* a_menuItemPtr = 0; std::string a_key = ""; std::string a_str = ""; bool r_ret = true; FSOUND_STREAM* a_sound = 0; ////////////////////////////////////////////////////////////////////////// // clear old menu clear(); ////////////////////////////////////////////////////////////////////////// // Start to play level music a_elemPtr = t_nodePtr->ToElement(); getAttributeStr(a_elemPtr, "music", a_str); a_str = SOUND_BASE + a_str; a_sound = FSOUND_Stream_Open(a_str.c_str(), FSOUND_LOOP_NORMAL, 0, 0); if (a_sound && !g_mute) { FSOUND_Stream_Play(0, a_sound); } ////////////////////////////////////////////////////////////////////////// // load textures for menu a_nodePtr = t_nodePtr->FirstChild("texturelist"); for(a_subNodePtr = a_nodePtr->FirstChild("texture"); a_subNodePtr; a_subNodePtr = a_nodePtr->IterateChildren("texture", a_subNodePtr)) { a_elemPtr = a_subNodePtr->ToElement(); if(!getAttributeStr(a_elemPtr, "key", a_key)) { r_ret = false; } if(r_ret) { if(m_textureMap[a_key] == 0) { m_textureMap[a_key] = new CTexture(a_elemPtr, GFX_BASE); } } } ////////////////////////////////////////////////////////////////////////// // load menu items for(a_nodePtr = t_nodePtr->FirstChild("menuitem"); a_nodePtr; a_nodePtr = t_nodePtr->IterateChildren("menuitem", a_nodePtr)) { a_menuItemPtr = new CMenuItem(this); r_ret &= a_menuItemPtr->load(a_nodePtr); m_menuItems.push_back(a_menuItemPtr); } return r_ret; }
void Title::HandleEvents(GameEngine* game) { /*la majorité du code de l'écran titre se trouve ici (mise à jour des images inclue) étant donné le fonctionnement de l'écran titre la méthode de gestion des évènements de l'exploration peut également s'appliquer, mais il faut penser à inclure des variables static de fonction et "simuler" la répétition des touches après un certain temps appuyé sur une des deux touches (haut/bas) Ce type de code devra être simulé lors des combats si la jauge ATB reste active pendant la gestion des commandes*/ SDL_EnableKeyRepeat(400, 100); int tempsPrecedent = 0, tempsActuel = 0; FSOUND_Stream_Play(FSOUND_FREE, musique1); SDL_BlitSurface(image1,NULL,SDL_GetVideoSurface(),NULL); SDL_BlitSurface(image2,NULL,SDL_GetVideoSurface(),&image02); SDL_UpdateRect(game->screen, 0, 0, 0, 0); //SDL_EventState(SDL_KEYDOWN, SDL_IGNORE); //Désactive et annule les anciens évènements SDL_EventState(SDL_KEYDOWN, SDL_ENABLE); // Réactive les évènements while ( quit==false && positionCurseur != 0 ) { //Tant qu'il y a un événement while( SDL_WaitEvent( &game->event ) ) //////ON ATTEND QU'UN EVENEMENT SE DECLBNCHE POUR EXECUTER LES ACTIONS EN DESSOUS { switch (game->event.type) { //A retirer lorsque phase de test terminée case SDL_QUIT: //Si l'utilisateur a cliqué sur le X de la fenêtre //On quitte the programme quit = true; break; case SDL_KEYDOWN: switch (game->event.key.keysym.sym) { case SDLK_DOWN: FSOUND_PlaySound(FSOUND_FREE, sonCurseurDeplacement); positionCurseur++; if ( positionCurseur > 2 ) { positionCurseur = 1; } SDL_Delay(10); break; case SDLK_UP: FSOUND_PlaySound(FSOUND_FREE, sonCurseurDeplacement); positionCurseur--; if ( positionCurseur < 1 ) { positionCurseur = 2; } break; case SDLK_RETURN: FSOUND_PlaySound(FSOUND_FREE, sonCurseurValider); FSOUND_Stream_Stop(musique1); positionCurseur = 0; break; default:; } } if (positionCurseur == 0 && quit==false ) { for (int i = 0 ; i <= 255 ; i+=24) // transition noir { alpha = i; SDL_SetAlpha(fondu, SDL_SRCALPHA, alpha); SDL_BlitSurface(image1,NULL,SDL_GetVideoSurface(),NULL); SDL_BlitSurface(image2,NULL,SDL_GetVideoSurface(),&image02); SDL_BlitSurface(fondu, NULL, SDL_GetVideoSurface(), NULL); SDL_UpdateRect(game->screen, 0, 0, 0, 0); tempsPrecedent = tempsActuel; while( tempsActuel - tempsPrecedent < 1000 / FRAMES_PER_SECOND ) { tempsActuel = SDL_GetTicks(); } } alpha = 255; SDL_SetAlpha(fondu, SDL_SRCALPHA, alpha); SDL_BlitSurface(fondu, NULL, SDL_GetVideoSurface(), NULL); SDL_UpdateRect(game->screen, 0, 0, 0, 0); break; } if ( positionCurseur == 1 && quit==false ) { image02.x = 300; image02.y = 515; } if ( positionCurseur == 2 && quit==false) { image02.x = 300; image02.y = 539; } if ( positionCurseur != 0 && quit==false) { SDL_BlitSurface(image1,NULL,SDL_GetVideoSurface(),NULL); SDL_BlitSurface(image2,NULL,SDL_GetVideoSurface(),&image02); SDL_UpdateRect(game->screen, 0, 0, 0, 0); } break; } } game->Quit(); }
/** Plays the stream * * @returns The channel id that the stream is playing on */ int FMODStreamBuffer::Play(void) { // Play the buffer, return the channel playing on m_channel = FSOUND_Stream_Play(FSOUND_FREE,m_stream); return m_channel; }
bool setupAudio() { int ret; //read audio stream info; specifically, we need the encoded chunksize AVISTREAMINFO audioStreamInfo; AVIStreamInfo(audioStream,&audioStreamInfo,sizeof(AVISTREAMINFO)); audioChunkSize = audioStreamInfo.dwSuggestedBufferSize; audioSampleCount = audioStreamInfo.dwLength; audioEncoded = new char[audioChunkSize]; //read the audio streamformat info LONG formatSize; AVIStreamReadFormat(audioStream,AVIStreamStart(audioStream),0,&formatSize); char *format = (char *)malloc(formatSize); AVIStreamReadFormat(audioStream,AVIStreamStart(audioStream),format,&formatSize); WAVEFORMATEX *wfxEncoded = (WAVEFORMATEX *)format; //construct a descriptor for the format we desire to get out of the decoder //note that we have to use the same samplerate as the encoded format indicates //since acm can't change the samplerate in one fell swoop wfxDecoded.cbSize = sizeof(WAVEFORMATEX); wfxDecoded.nChannels = wfxEncoded->nChannels; wfxDecoded.wFormatTag = WAVE_FORMAT_PCM; wfxDecoded.nSamplesPerSec = wfxEncoded->nSamplesPerSec; wfxDecoded.wBitsPerSample = 16; wfxDecoded.nBlockAlign = wfxDecoded.wBitsPerSample/8 * wfxEncoded->nChannels; wfxDecoded.nAvgBytesPerSec = wfxDecoded.nBlockAlign * wfxDecoded.nSamplesPerSec; sampleSize = wfxDecoded.nBlockAlign; //try to get a converter from the encoded data to the decoded data ret = acmStreamOpen(&acmStream,0,wfxEncoded,&wfxDecoded,0,0,0,0); //now we're done with wfxEncoded free(format); if(ret) { delete[] audioEncoded; AVIStreamClose(audioStream); return false; } //decide on a playback buffer size //make each buffer 1/2sec playBufferSamples = wfxDecoded.nSamplesPerSec / 2; playBufferSize = playBufferSamples * sampleSize; //hurry and try to create the output stream. //if we can't do that, then everything that follows is pointless. int mode = 0; if(wfxDecoded.wBitsPerSample == 8) mode |= FSOUND_8BITS; else if(wfxDecoded.wBitsPerSample == 16) mode |= FSOUND_16BITS; if(wfxDecoded.nChannels == 1) mode |= FSOUND_MONO; else mode |= FSOUND_STEREO; #ifdef SND_USE_FMOD fmod_stream = FSOUND_Stream_Create(win_movie_fmod_streamCallback,playBufferSize,mode,wfxDecoded.nSamplesPerSec,(int)this); if(!fmod_stream) { acmStreamClose(acmStream,0); delete[] audioEncoded; AVIStreamClose(audioStream); err("Error creating fmod stream for movieplayback. Please report this case so we can improve the robustness of the movie player!"); return false; } #endif //find out how large a decode buffer we need for the encode buffer chunksize acmStreamSize(acmStream,audioChunkSize,&decodeBufferSize,ACM_STREAMSIZEF_SOURCE); decodeBufferSamples = decodeBufferSize / sampleSize; //allocate the decode buffer audioDecoded = new char[decodeBufferSize]; //prep the decode operation audioStreamHeader.cbStruct = sizeof(ACMSTREAMHEADER); audioStreamHeader.fdwStatus = 0; audioStreamHeader.pbSrc = (LPBYTE)audioEncoded; audioStreamHeader.cbSrcLength = audioChunkSize; audioStreamHeader.pbDst = (LPBYTE)audioDecoded; audioStreamHeader.cbDstLength = decodeBufferSize; ret = acmStreamPrepareHeader(acmStream,&audioStreamHeader,0); if(ret) { delete[] audioDecoded; acmStreamClose(acmStream,0); delete[] audioEncoded; AVIStreamClose(audioStream); return false; } #ifdef SND_USE_FMOD //finally we're ready to start the audio stream FSOUND_Stream_Play(FSOUND_FREE,fmod_stream); #endif return true; }
/* [ [DESCRIPTION] [PARAMETERS] [RETURN_VALUE] [REMARKS] [SEE_ALSO] ] */ int main() { FSOUND_STREAM *stream; FSOUND_DSPUNIT *dsp1,*dsp2; char key; if (FSOUND_GetVersion() < FMOD_VERSION) { printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); return 1; } printf("-------------------------------------------------------------\n"); printf("FSOUND Streamer example.\n"); printf("Copyright (c) Firelight Technologies Pty, Ltd, 2001-2004.\n"); printf("-------------------------------------------------------------\n"); printf("---------------------------------------------------------\n"); printf("Output Type\n"); printf("---------------------------------------------------------\n"); #if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) printf("1 - Direct Sound\n"); printf("2 - Windows Multimedia Waveout\n"); printf("3 - ASIO\n"); #elif defined(__linux__) printf("1 - OSS - Open Sound System\n"); printf("2 - ESD - Elightment Sound Daemon\n"); printf("3 - ALSA 0.9 - Advanced Linux Sound Architecture\n"); #endif printf("4 - NoSound\n"); printf("---------------------------------------------------------\n"); // print driver names printf("Press a corresponding number or ESC to quit\n"); do { key = getch(); } while (key != 27 && key < '1' && key > '4'); switch (key) { #if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); break; case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); break; case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ASIO); break; #elif defined(__linux__) case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_OSS); break; case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_ESD); break; case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ALSA); break; #endif case '4' : FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); break; default : exit(0); } // ========================================================================================== // SELECT DRIVER // ========================================================================================== { int i,driver=0; char key; // The following list are the drivers for the output method selected above. printf("---------------------------------------------------------\n"); switch (FSOUND_GetOutput()) { case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; case FSOUND_OUTPUT_ASIO: printf("ASIO"); break; case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; case FSOUND_OUTPUT_ESD: printf("Enlightment Sound Daemon"); break; case FSOUND_OUTPUT_ALSA: printf("Alsa"); break; }; printf(" Driver list\n"); printf("---------------------------------------------------------\n"); for (i=0; i < FSOUND_GetNumDrivers(); i++) { printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); // print driver names } printf("---------------------------------------------------------\n"); // print driver names printf("Press a corresponding number or ESC to quit\n"); do { key = getch(); if (key == 27) exit(0); driver = key - '1'; } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); FSOUND_SetDriver(driver); // Select sound card (0 = default) } // ========================================================================================== // INITIALIZE // ========================================================================================== if (!FSOUND_Init(44100, 16, 0)) { printf("Error!\n"); printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); return 1; } // ========================================================================================== // CREATE USER STREAM // ========================================================================================== stream = FSOUND_Stream_Create(streamcallback, 6*2048, FSOUND_NORMAL | FSOUND_16BITS | FSOUND_STEREO, 44100, (void *)12345); if (!stream) { printf("Error!\n"); printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); return 1; } FSOUND_Stream_SetEndCallback(stream, endcallback, 0); dsp1 = FSOUND_Stream_CreateDSP(stream, dspcallback, 0, 0); // priority 0 = it comes first in dsp chain. dsp2 = FSOUND_Stream_CreateDSP(stream, dspcallback, 1, 0); // priority 1 = it comes last printf("Press any key to quit\n"); printf("=========================================================================\n"); printf("Playing stream...\n"); // ========================================================================================== // PLAY STREAM // ========================================================================================== if (FSOUND_Stream_Play(FSOUND_FREE, stream) == -1) { printf("Error!\n"); printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); return 1; } printf("******* Hit a key to active stream DSP unit #1 to halve the stream volume.\n"); getch(); FSOUND_DSP_SetActive(dsp1, 1); printf("******* Now hit a key to active stream DSP unit #2 to quarter the stream volume.\n"); getch(); FSOUND_DSP_SetActive(dsp2, 1); printf("******* How hit a key to finish.\n"); getch(); printf("\n"); FSOUND_DSP_Free(dsp1); FSOUND_DSP_Free(dsp2); FSOUND_Stream_Close(stream); FSOUND_Close(); return 0; }
int main(int argc, char ** argv) { int finp = 0,first = 1; SDL_Surface * menu = NULL; SDL_Surface * ecran = NULL; SDL_Rect position_menu; SDL_Event event; FSOUND_STREAM * musique = NULL; SDL_Init(SDL_INIT_VIDEO); TTF_Init(); FSOUND_Init(44100,32,0); ecran = SDL_SetVideoMode(800,800,32,SDL_HWSURFACE | SDL_DOUBLEBUF); if(ecran == NULL) exit(EXIT_FAILURE); SDL_WM_SetCaption("Prozet zz1",NULL); menu = IMG_Load("./dessin/menu.jpg"); if(menu == NULL) exit(EXIT_FAILURE); position_menu.x = 0; position_menu.y = 0; musique = FSOUND_Stream_Open("./son/jourdefoot.mp3",0,0,0); if(musique == NULL) exit(EXIT_FAILURE); while(finp == 0) { if(first == 1) { SDL_BlitSurface(menu,NULL,ecran,&position_menu); SDL_Flip(ecran); FSOUND_Stream_Play(FSOUND_FREE,musique); first = 0; } SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: finp = 1; break; case SDL_MOUSEBUTTONDOWN: if(event.button.button == SDL_BUTTON_LEFT) { if(event.button.x >= 250 && event.button.x <= 550) { if(event.button.y >= 300 && event.button.y <= 400) { FSOUND_Stream_Stop(musique); mode_solo(ecran); first = 1; } else { if(event.button.y >= 450 && event.button.y <= 550) { FSOUND_Stream_Stop(musique); mode_local_serveur(ecran); first = 1; } else { if(event.button.y >= 600 && event.button.y <= 700) { FSOUND_Stream_Stop(musique); mode_local_client(ecran); first = 1; } } } } } break; } } FSOUND_Stream_Stop(musique); FSOUND_Stream_Close(musique); FSOUND_Close(); SDL_FreeSurface(menu); SDL_FreeSurface(ecran); TTF_Quit(); SDL_Quit(); return(EXIT_SUCCESS); }