diff --git a/blupi.cpp b/blupi.cpp index 295c757..8b6fe4a 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -329,38 +329,6 @@ LRESULT CALLBACK WindowProc2 (HWND hWnd, UINT message, if ( g_pEvent != NULL && g_pEvent->TreatEvent(event) ) return 0; - switch( message ) - { - case MM_MCINOTIFY: - OutputDebug("Event MM_MCINOTIFY\n"); - if ( g_pEvent->IsMovie() ) // film en cours ? - { - if ( wParam == MCI_NOTIFY_SUCCESSFUL ) - { - g_pEvent->StopMovie(); - } - } - else - { - // music over, play it again - g_pSound->SuspendMusic(); - // if music finished, play it again. Otherwise assume that - // it was aborted by the user or otherwise - if ( wParam == MCI_NOTIFY_SUCCESSFUL ) - { - OutputDebug("Event MCI_NOTIFY_SUCCESSFUL\n"); - g_pSound->RestartMusic(); - } - else - { - char s[50]; - sprintf(s, "wParam=%d\n", static_cast (wParam)); - OutputDebug(s); - } - } - break; - } - if (event) { switch (event->type) @@ -436,6 +404,16 @@ LRESULT CALLBACK WindowProc2 (HWND hWnd, UINT message, g_pPixmap->Display (); } break; + + case WM_MUSIC_STOP: + if (g_pSound->IsStoppedOnDemand ()) + break; + + if (g_pEvent->IsMovie ()) + g_pEvent->StopMovie (); + else + g_pSound->RestartMusic (); + break; } break; } diff --git a/def.h b/def.h index 47a66eb..cbda404 100644 --- a/def.h +++ b/def.h @@ -588,6 +588,8 @@ enum MouseSprites #define WM_PHASE_INTRO1 (WM_USER+536) #define WM_PHASE_INTRO2 (WM_USER+537) +#define WM_MUSIC_STOP (WM_USER+550) + #define WM_PREV (WM_USER+600) #define WM_NEXT (WM_USER+601) #define WM_MOVIE (WM_USER+602) diff --git a/event.cpp b/event.cpp index 583149a..fb8bd7a 100644 --- a/event.cpp +++ b/event.cpp @@ -3127,6 +3127,7 @@ bool CEvent::ChangePhase(UINT phase) if ( music > 0 ) { sprintf(filename, "sound\\music%.3d.blp", music-1); + m_pSound->StopMusic (); m_pSound->PlayMusic(m_hWnd, filename); } } @@ -3651,7 +3652,7 @@ void CEvent::ChangeButtons(int message) if ( volume > 0 ) { m_pSound->SetMidiVolume(volume-1); - m_pSound->SuspendMusic(); + m_pSound->AdaptVolumeMusic (); } } if ( message == WM_BUTTON6 ) @@ -3660,7 +3661,7 @@ void CEvent::ChangeButtons(int message) if ( volume < MAXVOLUME ) { m_pSound->SetMidiVolume(volume+1); - m_pSound->SuspendMusic(); + m_pSound->AdaptVolumeMusic (); } } diff --git a/event.h b/event.h index b3df9ac..63e7dc3 100644 --- a/event.h +++ b/event.h @@ -4,6 +4,7 @@ #include "jauge.h" #include "menu.h" +#include "button.h" class CMovie; diff --git a/jauge.h b/jauge.h index 875654e..fbfd34b 100644 --- a/jauge.h +++ b/jauge.h @@ -2,6 +2,10 @@ #pragma once +class CPixmap; +class CDecor; +class CSound; + ///////////////////////////////////////////////////////////////////////////// class CJauge diff --git a/menu.h b/menu.h index 8296b05..9ba6918 100644 --- a/menu.h +++ b/menu.h @@ -2,6 +2,8 @@ #pragma once +#include "def.h" + ///////////////////////////////////////////////////////////////////////////// class CMenu diff --git a/sound.cpp b/sound.cpp index 015a0a6..fdce4b7 100644 --- a/sound.cpp +++ b/sound.cpp @@ -5,6 +5,7 @@ #include #include #include "sound.h" +#include "event.h" #include "misc.h" #include "def.h" #include "resource.h" @@ -26,71 +27,6 @@ bool CSound::StopAllSounds() return true; } -///////////////////////////////////////////////////////////////////////////// - - -// Modifie le volume midi. -// Le volume est compris entre 0 et 20 ! - -void InitMidiVolume(int volume) -{ - int nb, i, n; - MMRESULT result; - HMIDIOUT hmo = 0; - - static unsigned int table[21] = - { - 0x00000000, - 0x11111111, - 0x22222222, - 0x33333333, - 0x44444444, - 0x55555555, - 0x66666666, - 0x77777777, - 0x88888888, - 0x99999999, - 0xAAAAAAAA, - 0xBBBBBBBB, - 0xCCCCCCCC, - 0xDDDDDDDD, - 0xEEEEEEEE, - 0xF222F222, - 0xF555F555, - 0xF777F777, - 0xFAAAFAAA, - 0xFDDDFDDD, - 0xFFFFFFFF, - }; - - if ( volume < 0 ) volume = 0; - if ( volume > MAXVOLUME ) volume = MAXVOLUME; - - nb = midiOutGetNumDevs(); - for ( i=0 ; i