diff --git a/Branches/MusicMod/Common/Src/Console.cpp b/Branches/MusicMod/Common/Src/Console.cpp index 976fa81d1d..fed086c040 100644 --- a/Branches/MusicMod/Common/Src/Console.cpp +++ b/Branches/MusicMod/Common/Src/Console.cpp @@ -59,28 +59,26 @@ void StartConsoleWin(int width, int height, char* fname) { #ifdef MM_DEBUG -#ifndef MM_DEBUG_FILEONLY - // --------------------------------------------------------------------------------------- - // Allocate console - AllocConsole(); - // --------------------------------------------------------------------------------------- + #ifndef MM_DEBUG_FILEONLY + // Allocate console + AllocConsole(); - // Set console window title - SetConsoleTitle(fname); + // Set console window title + SetConsoleTitle(fname); - // Get window handle to write to - __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); + // Get window handle to write to + __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); - // Create coordinates table - COORD co = {width, height}; + // Create coordinates table + COORD co = {width, height}; - // Set the innteral letter space - SetConsoleScreenBufferSize(__hStdOut, co); + // Set the innteral letter space + SetConsoleScreenBufferSize(__hStdOut, co); - // Set the window width and height - SMALL_RECT coo = {0,0, (width - 1),50}; // Top, left, right, bottom - SetConsoleWindowInfo(__hStdOut, TRUE, &coo); -#endif + // Set the window width and height + SMALL_RECT coo = {0,0, (width - 1),50}; // Top, left, right, bottom + SetConsoleWindowInfo(__hStdOut, true, &coo); + #endif if(fname) { diff --git a/Branches/MusicMod/Main/Src/Frame.cpp b/Branches/MusicMod/Main/Src/Frame.cpp index c0b7c13eeb..83eeecf332 100644 --- a/Branches/MusicMod/Main/Src/Frame.cpp +++ b/Branches/MusicMod/Main/Src/Frame.cpp @@ -48,8 +48,11 @@ namespace MusicMod bool GlobalMute = false; bool GlobalPause = false; bool bShowConsole = false; - int GlobalVolume = 255; + int GlobalVolume = 125; extern bool dllloaded; + + void ShowConsole(); + void Init(); } ////////////////////////////////// @@ -126,12 +129,7 @@ wxBitmap SetBrightness(wxBitmap _Bitmap, int _Brightness, bool Gray) ////////////////////////////////// -void ShowConsole() -{ - StartConsoleWin(100, 2000, "Console"); // Give room for 2000 rows -} - -#ifdef MUSICMOD +//#ifdef MUSICMOD void CFrame::MM_InitBitmaps(int Theme) { @@ -165,33 +163,11 @@ CFrame::MM_InitBitmaps(int Theme) void CFrame::MM_PopulateGUI() { - // --------------------------------------- - // Load config - // --------------------- - IniFile file; - file.Load("Plainamp.ini"); - file.Get("Interface", "ShowConsole", &MusicMod::bShowConsole, false); - // ------- - - - // --------------------------------------- - // Make a debugging window - // --------------------- - if(MusicMod::bShowConsole) ShowConsole(); - - // Write version - #ifdef _M_X64 - wprintf("64 bit version\n"); - #else - wprintf("32 bit version\n"); - #endif - // ----------- - - wxToolBar* toolBar = TheToolBar; // Shortcut toolBar->AddSeparator(); + MusicMod::Init(); // --------------------------------------- // Draw a rotated music label @@ -239,8 +215,10 @@ CFrame::MM_PopulateGUI() this code can be simplified a lot */ // --------- wxPanel * mm_SliderPanel = new wxPanel(toolBar, IDS_VOLUME_PANEL, wxDefaultPosition, wxDefaultSize); - wxSlider * mm_Slider = new wxSlider(mm_SliderPanel, IDS_VOLUME, 125, 0, 255, wxDefaultPosition, wxDefaultSize); - //m_Slider->SetToolTip("Change the music volume"); + mm_Slider = new wxSlider(mm_SliderPanel, IDS_VOLUME, 125, 0, 255, wxDefaultPosition, wxDefaultSize); + //mm_Slider->SetToolTip("Change the music volume"); + mm_Slider->SetValue(MusicMod::GlobalVolume); + wxStaticText * mm_SliderText = new wxStaticText(mm_SliderPanel, IDS_VOLUME_LABEL, _T("Volume"), wxDefaultPosition, wxDefaultSize); wxBoxSizer * mm_VolSizer = new wxBoxSizer(wxVERTICAL); mm_VolSizer->Add(mm_Slider, 0, wxEXPAND | wxALL, 0); @@ -252,7 +230,8 @@ CFrame::MM_PopulateGUI() toolBar->AddControl((wxControl*)mm_SliderPanel); // --------- - mm_ToolLog = toolBar->AddTool(IDT_LOG, _T("Log"), m_Bitmaps[Toolbar_Log], _T("Show or hide log")); + mm_ToolLog = toolBar->AddTool(IDT_LOG, _T("Log"), m_Bitmaps[Toolbar_Log], + wxT("Show or hide log. Enable the log window and restart Dolphin to show the DLL status.")); } @@ -304,6 +283,14 @@ void CFrame::MM_OnPlay() { //wprintf("\nCFrame::OnPlayMusicMod > Begin\n"); + + // Save the volume + MusicMod::GlobalVolume = mm_Slider->GetValue(); + + IniFile file; + file.Load("Plainamp.ini"); + file.Set("Plainamp", "Volume", MusicMod::GlobalVolume); + file.Save("Plainamp.ini"); if (Core::GetState() != Core::CORE_UNINITIALIZED) { @@ -349,29 +336,26 @@ CFrame::MM_OnStop() void CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event)) { - wprintf("CFrame::OnMute > Begin\n"); + //wprintf("CFrame::OnMute > Begin\n"); //MessageBox(0, "", "", 0); if(!MusicMod::GlobalMute) { if(MusicMod::dllloaded) // avoid crash { - Player_Mute(); + Player_Mute(MusicMod::GlobalVolume); } - MusicMod::GlobalMute = true; - //m_ToolMute->Enable(false); - //GetToolBar()->EnableTool(IDT_LOG, false); + MusicMod::GlobalMute = true; UpdateGUI(); } else { if(MusicMod::dllloaded) // avoid crash { - Player_Mute(); + Player_Mute(MusicMod::GlobalVolume); } MusicMod::GlobalMute = false; - //m_ToolMute->Enable(true); UpdateGUI(); } } @@ -430,6 +414,7 @@ void CFrame::MM_OnVolume(wxScrollEvent& event) MusicMod::GlobalMute = false; // Unmute to mm_ToolMute->Toggle(false); + if(event.GetEventType() == wxEVT_SCROLL_CHANGED) { // Only update this on release, to avoid major flickering when changing volume @@ -437,8 +422,7 @@ void CFrame::MM_OnVolume(wxScrollEvent& event) /* Use this to avoid that the focus get stuck on the slider when the main window has been replaced */ - this->SetFocus();} - + this->SetFocus();} } } //======================================================================================= @@ -453,14 +437,12 @@ void CFrame::MM_OnLog(wxCommandEvent& event) //wprintf("CFrame::OnLog > Begin\n"); //MessageBox(0, "", "", 0); - if(MusicMod::dllloaded) // Avoid crash - { - } + if(!MusicMod::dllloaded) return; // Avoid crash MusicMod::bShowConsole = !MusicMod::bShowConsole; if(MusicMod::bShowConsole) - { ShowConsole(); Player_Console(true); } + { MusicMod::ShowConsole(); Player_Console(true); } else { #if defined (_WIN32) @@ -476,4 +458,5 @@ void CFrame::MM_OnLog(wxCommandEvent& event) UpdateGUI(); } //======================================================================================= -#endif // MUSICMOD + +//#endif // MUSICMOD diff --git a/Branches/MusicMod/Main/Src/Main.cpp b/Branches/MusicMod/Main/Src/Main.cpp index 830594db24..ed24b55dfe 100644 --- a/Branches/MusicMod/Main/Src/Main.cpp +++ b/Branches/MusicMod/Main/Src/Main.cpp @@ -24,6 +24,8 @@ #include #include +#include "IniFile.h" // Common + #include "PowerPC/PowerPc.h" // Core #include "../../../../Source/Core/DiscIO/Src/FileSystemGCWii.h" // This file has #include "Filesystem.h" @@ -59,10 +61,12 @@ std::string MusicPath; DiscIO::CFileSystemGCWii* my_pFileSystem; -extern bool bShowConsole; int WritingFile = false; bool dllloaded = false; std::string CurrentPlayFile; + +extern bool bShowConsole; // Externally define +extern int GlobalVolume; ////////////////////////////////// @@ -97,11 +101,57 @@ void StructSort (std::vector &MyFiles) //wprintf("StructSort > Done\n"); } +// ======================================================================================= +/* Run these things once */ +// ------------------------ +void ShowConsole() +{ + StartConsoleWin(100, 2000, "Console"); // Give room for 2000 rows +} + +void Init() +{ + // These things below will not need to be updated after a new game is started + if (dllloaded) return; + + // --------------------------------------- + // Load config + // --------------------- + IniFile file; + file.Load("Plainamp.ini"); + file.Get("Interface", "ShowConsole", &MusicMod::bShowConsole, false); + file.Get("Plainamp", "Volume", &MusicMod::GlobalVolume, 125); + // ------- + + // --------------------------------------- + // Make a debugging window + // --------------------- + if(MusicMod::bShowConsole) ShowConsole(); + + // Write version + #ifdef _M_X64 + wprintf("64 bit version\n"); + #else + wprintf("32 bit version\n"); + #endif + // ----------- + + // Set volume + Player_Volume(MusicMod::GlobalVolume); + + // Show DLL status + Player_Main(MusicMod::bShowConsole); + //play_file("c:\\demo36_02.ast"); + //wprintf("DLL loaded\n"); + + dllloaded = true; // Do this once +} // ======================================================================================= /* This will load Plainamp.dll. It's the original Plainamp.exe with removed GUI and some small modifications. */ +// ------------------------ void Main(std::string FileName) { // @@ -123,15 +173,6 @@ void Main(std::string FileName) // Sort the files by offset StructSort(MyFiles); - // These things below will not need to be updated after a new game is started - if (dllloaded) return; - - // Call the DLL for the first time - Player_Main(bShowConsole); - //play_file("c:\\demo36_02.ast"); - wprintf("DLL loaded\n"); - dllloaded = true; // Do this once - // --------------------------------------------------------------------------------------- // Make Music directory // ------------------------- diff --git a/Branches/MusicMod/Player/Player.vcproj b/Branches/MusicMod/Player/Player.vcproj index fa85a2e24d..ac3c0722d4 100644 --- a/Branches/MusicMod/Player/Player.vcproj +++ b/Branches/MusicMod/Player/Player.vcproj @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -611,6 +465,38 @@ + + + + + + + + + + + + + + + + @@ -707,14 +593,6 @@ RelativePath=".\Src\afxres.h" > - - - - @@ -731,14 +609,6 @@ RelativePath=".\Src\DspModule.h" > - - - - @@ -755,14 +625,6 @@ RelativePath=".\Src\Font.h" > - - - - @@ -775,14 +637,6 @@ RelativePath=".\Src\Input.h" > - - - - @@ -799,14 +653,6 @@ RelativePath=".\Src\Output.h" > - - - - @@ -896,6 +742,18 @@ > + + + + + + diff --git a/Branches/MusicMod/Player/Src/AddDirectory.cpp b/Branches/MusicMod/Player/Src/AddDirectory.cpp index fae40764d9..17dd6de1d8 100644 --- a/Branches/MusicMod/Player/Src/AddDirectory.cpp +++ b/Branches/MusicMod/Player/Src/AddDirectory.cpp @@ -266,7 +266,8 @@ void AddDirectory() //////////////////////////////////////////////////////////////////////////////// -// +/* Warning: There is SetCurrentDirectory() here, be aware of it. We don't really + want to use that. */ //////////////////////////////////////////////////////////////////////////////// void SearchFolder( TCHAR * szPath ) { diff --git a/Branches/MusicMod/Player/Src/Config.cpp b/Branches/MusicMod/Player/Src/Config.cpp index bc978172ba..bdc15d20bb 100644 --- a/Branches/MusicMod/Player/Src/Config.cpp +++ b/Branches/MusicMod/Player/Src/Config.cpp @@ -10,20 +10,21 @@ //////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// Include and declarations, definitions +//////////////////////////////////////////////////////////////////////////////// #include "Config.h" #include "Console.h" #include using namespace std; - - map * conf_map = NULL; - TCHAR * szIniPath = NULL; const TCHAR * SECTION = TEXT( "Plainamp" ); - +// ============================================================================ @@ -33,10 +34,7 @@ const TCHAR * SECTION = TEXT( "Plainamp" ); ConfVar::ConfVar( TCHAR * szKey, ConfMode mode ) { // MessageBox( 0, TEXT( "no const @ ConfVar" ), TEXT( "" ), 0 ); - - // --------------------------------------------------------------------------------------- //wprintf("ConfVar::ConfVar(TCHAR) > Got <%s>\n", szKey); - // --------------------------------------------------------------------------------------- // Init const int iLen = ( int )_tcslen( szKey ); @@ -61,9 +59,7 @@ ConfVar::ConfVar( TCHAR * szKey, ConfMode mode ) //////////////////////////////////////////////////////////////////////////////// ConfVar::ConfVar( const TCHAR * szKey, ConfMode mode ) { - // --------------------------------------------------------------------------------------- //wprintf("ConfVar::ConfVar(const TCHAR) > Got <%s>\n", szKey); - // --------------------------------------------------------------------------------------- // Init m_szKey = ( TCHAR * )szKey; @@ -77,10 +73,7 @@ ConfVar::ConfVar( const TCHAR * szKey, ConfMode mode ) if( !conf_map ) conf_map = new map; conf_map->insert( pair( m_szKey, this ) ); - // --------------------------------------------------------------------------------------- //wprintf("ConfVar::ConfVar(const TCHAR) > Insert <%s>\n", ConfVar::m_szKey); - // --------------------------------------------------------------------------------------- - } @@ -103,10 +96,7 @@ ConfVar::~ConfVar() ConfBool::ConfBool( bool * pbData, TCHAR * szKey, ConfMode mode, bool bDefault ) : ConfVar( szKey, mode ) { // MessageBox( 0, TEXT( "no const @ ConfBool" ), TEXT( "" ), 0 ); - - // --------------------------------------------------------------------------------------- - wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey); - // --------------------------------------------------------------------------------------- + //wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey); m_pbData = pbData; m_bDefault = bDefault; @@ -122,9 +112,7 @@ ConfBool::ConfBool( bool * pbData, TCHAR * szKey, ConfMode mode, bool bDefault ) //////////////////////////////////////////////////////////////////////////////// ConfBool::ConfBool( bool * pbData, const TCHAR * szKey, ConfMode mode, bool bDefault ) : ConfVar( szKey, mode ) { - // --------------------------------------------------------------------------------------- - wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey); - // --------------------------------------------------------------------------------------- + //wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey); m_pbData = pbData; m_bDefault = bDefault; @@ -139,7 +127,7 @@ ConfBool::ConfBool( bool * pbData, const TCHAR * szKey, ConfMode mode, bool bDef //////////////////////////////////////////////////////////////////////////////// void ConfBool::Read() { - wprintf("ConfBool::Read() > Begin and \n", m_bRead, szIniPath); + //wprintf("ConfBool::Read() > Begin and \n", m_bRead, szIniPath); if( m_bRead || !szIniPath ) return; @@ -519,13 +507,13 @@ ConfString::ConfString( TCHAR * szData, const TCHAR * szKey, ConfMode mode, TCHA //////////////////////////////////////////////////////////////////////////////// void ConfString::Read() { - wprintf( "ConfString::Read() > Begin\n"); + //wprintf( "ConfString::Read() > Begin\n"); if( m_bRead || !szIniPath ) return; GetPrivateProfileString( SECTION, m_szKey, m_szDefault, m_szData, m_iMaxLen, szIniPath ); - wprintf( "ConfString::Read() > GetPrivateProfileString <%s> <%s> <%s>\n", m_szKey, m_szData, szIniPath); + //wprintf( "ConfString::Read() > GetPrivateProfileString <%s> <%s> <%s>\n", m_szKey, m_szData, szIniPath); m_bRead = true; } @@ -550,7 +538,8 @@ void ConfString::Write() //////////////////////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////////////////////// -ConfCurDir::ConfCurDir( TCHAR * szData, TCHAR * szKey ) : ConfString( szData, szKey, CONF_MODE_INTERNAL, TEXT( "C:\\" ), MAX_PATH ) +ConfCurDir::ConfCurDir( TCHAR * szData, TCHAR * szKey ) : ConfString( szData, szKey, + CONF_MODE_INTERNAL, TEXT( "C:\\" ), MAX_PATH ) { } @@ -560,31 +549,27 @@ ConfCurDir::ConfCurDir( TCHAR * szData, TCHAR * szKey ) : ConfString( szData, sz //////////////////////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////////////////////// -ConfCurDir::ConfCurDir( TCHAR * szData, const TCHAR * szKey ) : ConfString( szData, szKey, CONF_MODE_INTERNAL, TEXT( "C:\\" ), MAX_PATH ) +ConfCurDir::ConfCurDir( TCHAR * szData, const TCHAR * szKey ) : ConfString( szData, szKey, + CONF_MODE_INTERNAL, TEXT( "C:\\" ), MAX_PATH ) { } -// ======================================================================================= -// MAJOR FUNCTION: This changes the relative path for the whole application -// ======================================================================================= //////////////////////////////////////////////////////////////////////////////// -/// +/* IMPORTANT: This SetCurrentDirectory() has to be disabled or we change the relative paths + for the entire application */ //////////////////////////////////////////////////////////////////////////////// void ConfCurDir::Read() { ConfString::Read(); - - // MessageBox( 0, m_szData, TEXT( "CurDir" ), 0 ); // Apply //SetCurrentDirectory( m_szData ); - wprintf("ConfCurDir::Read > End <%s>\n", m_szData); + //wprintf("ConfCurDir::Read > End <%s>\n", m_szData); } -// ======================================================================================= -// ======================================================================================= +// ============================================================================== //////////////////////////////////////////////////////////////////////////////// @@ -671,10 +656,12 @@ void Conf::Init() map::iterator iter = conf_map->begin(); // ======================================================================================= - // *** Something changes the API relative paths here + // This will lead us to the Read() function earlier in this file. For example ConfBool::Read() while( iter != conf_map->end() ) { - iter->second->Read(); // *** This changes the relative path + /* By default there was a SetCurrentDirectory() here that would affect the entire process, + exe and everything. It is disabled now. */ + iter->second->Read(); iter++; } // ======================================================================================= diff --git a/Branches/MusicMod/Player/Src/Global.h b/Branches/MusicMod/Player/Src/Global.h index 80bdb9a6a6..250038356a 100644 --- a/Branches/MusicMod/Player/Src/Global.h +++ b/Branches/MusicMod/Player/Src/Global.h @@ -10,6 +10,14 @@ //////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +// Settings +// ŻŻŻŻŻŻŻŻŻŻ +/* This will build Plainamp without the GUI. Todo: Fix this, I disabled a little to much + to make the regular GUI version build */ +#define NOGUI +//////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////// // Include @@ -22,10 +30,6 @@ // Declarations and definitions // ŻŻŻŻŻŻŻŻŻŻ -// This will build Plainamp without the GUI -#define NOGUI - - // ======================================================================================= // Because there are undefined in 64 bit it's easy to redefine them in case we use 64 bit // --------------------- @@ -45,11 +49,9 @@ #define PA_GLOBAL_H - // #include "ide_devcpp/Plainamp_Private.h" - #ifdef UNICODE # define PA_UNICODE #else diff --git a/Branches/MusicMod/Player/Src/InputPlugin.cpp b/Branches/MusicMod/Player/Src/InputPlugin.cpp index 649b0aa17c..beef9ba11d 100644 --- a/Branches/MusicMod/Player/Src/InputPlugin.cpp +++ b/Branches/MusicMod/Player/Src/InputPlugin.cpp @@ -37,7 +37,7 @@ InputPlugin::InputPlugin( TCHAR * szDllpath, bool bKeepLoaded ) : Plugin( szDllp iFiltersLen = 0; plugin = NULL; - wprintf("\InputPlugin::InputPlugin > Begin\n"); + //wprintf("\InputPlugin::InputPlugin > Begin\n"); if( !Load() ) { @@ -235,14 +235,14 @@ bool InputPlugin::Integrate() // Append filter name ToTchar( walk_out, start_display, len_display ); -// ======================================================================================= -// Print used filetypes - TCHAR szBuffer[ 5000 ]; - *(walk_out + len_display) = TEXT( '\0' ); - _stprintf( szBuffer, TEXT( " %s" ), walk_out ); - Console::Append( szBuffer ); - //printf( szBuffer, TEXT( " %s\n" ), walk_out ); -// ======================================================================================= + // ======================================================================================= + // Print used filetypes + TCHAR szBuffer[ 5000 ]; + *(walk_out + len_display) = TEXT( '\0' ); + _stprintf( szBuffer, TEXT( " %s" ), walk_out ); + Console::Append( szBuffer ); + //printf( szBuffer, TEXT( " %s\n" ), walk_out ); + // ======================================================================================= walk_out += len_display; // Convert and append extensions @@ -317,15 +317,16 @@ bool InputPlugin::Unload() { if( !IsLoaded() ) return true; - DisIntegrate(); - - TCHAR szBuffer[ 5000 ]; - _stprintf( szBuffer, TEXT( "Unloading <%s>" ), GetFilename() ); - Console::Append( szBuffer ); - Console::Append( TEXT( " " ) ); - printf( ">>>Unloading <%s>\n" , GetFilename() ); + #ifndef NOGUI + TCHAR szBuffer[ 5000 ]; + _stprintf( szBuffer, TEXT( "Unloading '%s'" ), GetFilename() ); + Console::Append( szBuffer ); + Console::Append( TEXT( " " ) ); + #else + printf( ">>> Unloading '%s'\n" , GetFilename() ); + #endif // Quit if( plugin ) diff --git a/Branches/MusicMod/Player/Src/Main.cpp b/Branches/MusicMod/Player/Src/Main.cpp index afdc1e81fd..aee1519087 100644 --- a/Branches/MusicMod/Player/Src/Main.cpp +++ b/Branches/MusicMod/Player/Src/Main.cpp @@ -371,7 +371,7 @@ LRESULT CALLBACK WndprocMain( HWND hwnd, UINT message, WPARAM wp, LPARAM lp ) static bool bRemoveIcon = false; #ifdef NOGUI - wprintf("DLL > Main.cpp:WndprocMain() was called. But nothing will be done. \n"); + //wprintf("DLL > Main.cpp:WndprocMain() was called. But nothing will be done. \n"); #else Console::Append( TEXT( "Main.cpp:WndprocMain was called" ) ); #endif diff --git a/Branches/MusicMod/Player/Src/OutputPlugin.cpp b/Branches/MusicMod/Player/Src/OutputPlugin.cpp index 5276eb8481..69b130a5a8 100644 --- a/Branches/MusicMod/Player/Src/OutputPlugin.cpp +++ b/Branches/MusicMod/Player/Src/OutputPlugin.cpp @@ -41,7 +41,7 @@ OutputPlugin::OutputPlugin( TCHAR * szDllpath, bool bKeepLoaded ) : Plugin( szDl return; } -//////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// // Quick hack!!! TCHAR * szBuffer = new TCHAR[ 500 ]; // NOT LOCAL!!! @@ -72,7 +72,7 @@ OutputPlugin::OutputPlugin( TCHAR * szDllpath, bool bKeepLoaded ) : Plugin( szDl } } // Quick hack!!! -//////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// output_plugins.push_back( this ); @@ -248,7 +248,8 @@ bool OutputPlugin::Config( HWND hParent ) //////////////////////////////////////////////////////////////////////////////// bool OutputPlugin::Start() { - wprintf( "OutputPlugin::Start() > Begin \n" , IsLoaded(), bActive, active_output_count ); + //wprintf( "OutputPlugin::Start() > Begin \n", + // IsLoaded(), bActive, active_output_count ); if( !IsLoaded() ) return false; if( bActive ) return true; @@ -268,11 +269,14 @@ bool OutputPlugin::Start() active_output_count = 1; } - TCHAR szBuffer[ 5000 ]; - _stprintf( szBuffer, TEXT( "Output plugin <%s> activated" ), GetFilename() ); - Console::Append( szBuffer ); - Console::Append( TEXT( " " ) ); - wprintf( "\n >>> OutputPlugin::Start() > Output plugin <%s> activated\n\n" , GetFilename() ); + #ifndef NOGUI + TCHAR szBuffer[ 5000 ]; + _stprintf( szBuffer, TEXT( "Output plugin <%s> activated" ), GetFilename() ); + Console::Append( szBuffer ); + Console::Append( TEXT( " " ) ); + #else + wprintf( "\n >>> Output plugin '%s' activated\n\n" , GetFilename() ); + #endif bActive = true; diff --git a/Branches/MusicMod/Player/Src/Playback.cpp b/Branches/MusicMod/Player/Src/Playback.cpp index 36377a8afe..1e6c9fbeac 100644 --- a/Branches/MusicMod/Player/Src/Playback.cpp +++ b/Branches/MusicMod/Player/Src/Playback.cpp @@ -82,7 +82,7 @@ bool OpenPlay( TCHAR * szFilename, int iNumber ) { // ======================================================================================= #ifdef NOGUI - wprintf( "Playback.cpp: OpenPlay > Begin <%i> <%s>\n" , iNumber, szFilename ); + //wprintf( "Playback.cpp: OpenPlay > Begin <%i> <%s>\n" , iNumber, szFilename ); #else TCHAR sszBuffer[ 5000 ]; _stprintf( sszBuffer, TEXT( "Playback.cpp: OpenPlay was called <%i> <%s>" ), iNumber, szFilename ); @@ -128,7 +128,7 @@ bool OpenPlay( TCHAR * szFilename, int iNumber ) // Now that we know which input pugin to use we set that one as active InputPlugin * old_input = active_input_plugin; // Save the last one, if any active_input_plugin = iter->second; - wprintf("OpenPlay > Input plugin '%s' activated\n", active_input_plugin->GetName()); + wprintf("OpenPlay > Input plugin '%s' activated\n", active_input_plugin->GetFilename()); // ======================================================================================= if( old_input ) @@ -150,7 +150,7 @@ bool OpenPlay( TCHAR * szFilename, int iNumber ) } // Connect - wprintf( "OpenPlay > OutMod\n" ); + //wprintf( "OpenPlay > OutMod\n" ); active_input_plugin->plugin->outMod = &output_server; // output->plugin; // ======================================================================================= @@ -190,10 +190,10 @@ bool OpenPlay( TCHAR * szFilename, int iNumber ) TCHAR szTitle[ 2000 ] = TEXT( "\0" ); int length_in_ms; - wprintf( "OpenPlay > GetFileInfo\n" ); + //wprintf( "OpenPlay > GetFileInfo\n" ); active_input_plugin->plugin->GetFileInfo( szFilename, szTitle, &length_in_ms ); - wprintf( "OpenPlay > Play\n" ); + //wprintf( "OpenPlay > Play\n" ); active_input_plugin->plugin->Play( szFilename ); // ======================================================================================= #endif @@ -218,7 +218,7 @@ bool OpenPlay( TCHAR * szFilename, int iNumber ) // Timer ON //EnableTimer( true ); - wprintf( "OpenPlay > End\n" ); + //wprintf( "OpenPlay > End\n" ); return true; } @@ -292,11 +292,14 @@ bool Playback::Play() // --------------------------------------------------------------------------------------- - TCHAR sszBuffer[ 5000 ]; - _stprintf( sszBuffer, TEXT( "Playback::Play() with bPlaying <%i>\n" ), bPlaying ); - Console::Append( sszBuffer ); - Console::Append( TEXT( " " ) ); - wprintf( "Playback::Play() > Begin <%i>\n" , bPlaying ); + #ifndef NOGUI + TCHAR sszBuffer[ 5000 ]; + _stprintf( sszBuffer, TEXT( "Playback::Play() with bPlaying <%i>\n" ), bPlaying ); + Console::Append( sszBuffer ); + Console::Append( TEXT( " " ) ); + #else + //wprintf( "Playback::Play() > Begin <%i>\n" , bPlaying ); + #endif // --------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------- @@ -384,12 +387,14 @@ bool Playback::Play() Console::Append( " " ); return false; } - - TCHAR szBuffer[ 5000 ]; - _stprintf( szBuffer, TEXT( "Playback.cpp: Play() got the filename <%s>" ), szFilename); - Console::Append( szBuffer ); - // Console::Append( TEXT( " " ) ); - wprintf( "Playback::Play() > Filename <%s>\n", szFilename); + #ifndef NOGUI + TCHAR szBuffer[ 5000 ]; + _stprintf( szBuffer, TEXT( "Playback.cpp: Play() got the filename <%s>" ), szFilename); + Console::Append( szBuffer ); + //Console::Append( TEXT( " " ) ); + #else + //wprintf( "Playback::Play() > Filename <%s>\n", szFilename); + #endif // Play iLastIndex = iIndex; @@ -549,13 +554,13 @@ bool Playback::UpdateSeek() if( iVal > 1000 ) iVal = 0; -// ======================================================================================= -//TCHAR szBuffer[ 5000 ]; -//_stprintf( szBuffer, TEXT( "Current position is <%i of %i>" ), ms_cur, ms_len ); -//Console::Append( szBuffer ); -//Console::Append( TEXT( " " ) ); -printf( "Current position is <%i of %i>\n", ms_cur, ms_len ); -// ======================================================================================= + // ======================================================================================= + //TCHAR szBuffer[ 5000 ]; + //_stprintf( szBuffer, TEXT( "Current position is <%i of %i>" ), ms_cur, ms_len ); + //Console::Append( szBuffer ); + //Console::Append( TEXT( " " ) ); + printf( "Current position is <%i of %i>\n", ms_cur, ms_len ); + // ======================================================================================= } diff --git a/Branches/MusicMod/Player/Src/Player.cpp b/Branches/MusicMod/Player/Src/Player.cpp index 96cb4eb9e3..f04338ff20 100644 --- a/Branches/MusicMod/Player/Src/Player.cpp +++ b/Branches/MusicMod/Player/Src/Player.cpp @@ -125,7 +125,8 @@ void Player_Main(bool Console) //MessageBox(0, "main() opened", "", 0); //printf( "main() opened\n" ); - wprintf( "DLL > main_dll() > Begin\n" ); + wprintf( "\n=========================================================\n\n" ); + wprintf( "DLL > Player_Main() > Begin\n" ); // ======================================================================================= @@ -134,8 +135,9 @@ void Player_Main(bool Console) Conf::Init( ); // --------------------------------------------------------------------------------------- - wprintf( "DLL > bLoop <%i>\n", bLoop); - wprintf( "DLL > bWarnPluginsMissing <%i>\n", bWarnPluginsMissing); + wprintf( "\n\nDLL > Settings:\n", bLoop); + wprintf( "DLL > Loop: %i\n", bLoop); + wprintf( "DLL > WarnPluginsMissing: %i\n", bWarnPluginsMissing); // --------------------------------------------------------------------------------------- // ======================================================================================= @@ -167,13 +169,23 @@ void Player_Main(bool Console) memcpy( szPluginDir, szHomeDir, iHomeDirLen * sizeof( TCHAR ) ); memcpy( szPluginDir + iHomeDirLen, TEXT( "PluginsMusic" ), 12 * sizeof( TCHAR ) ); szPluginDir[ iHomeDirLen + 12 ] = TEXT( '\0' ); - wprintf("DLL > Plugindir: %s\n\n", szPluginDir); + wprintf("DLL > Plugindir: %s\n", szPluginDir); // ======================================================================================= #ifndef NOGUI Font::Create(); //Console::Append( TEXT( "Winmain.cpp called Font::Create()" ) ); #endif + + // --------------------------------------------------------------------------------------- + // Set volume. This must probably be done after the dll is loaded. + //GlobalVolume = Playback::Volume::Get(); // Don't bother with this for now + //GlobalCurrentVolume = GlobalVolume; + //Output_SetVolume( GlobalVolume ); + wprintf("DLL > Volume: %i\n\n", GlobalVolume); + // --------------------------------------------------------------------------------------- + + // ======================================================================================= // The only thing this function currently does is creating the Playlist. // ======================================================================================= @@ -186,25 +198,18 @@ void Player_Main(bool Console) //Prefs::Create(); // This creates windows preferences //Console::Append( TEXT( "Winmain.cpp called Prefs::Create()" ) ); - // Show window - + // Find plugins Plugin::FindAll ( szPluginDir, TEXT( "in_*.dll" ), true ); Plugin::FindAll( szPluginDir, TEXT( "out_*.dll" ), false ); Plugin::FindAll ( szPluginDir, TEXT( "vis_*.dll" ), false ); Plugin::FindAll ( szPluginDir, TEXT( "dsp_*.dll" ), false ); Plugin::FindAll ( szPluginDir, TEXT( "gen_*.dll" ), true ); + //wprintf( "Winmain.cpp > PluginManager::Fill()\n" ); PluginManager::Fill(); - wprintf( "Winmain.cpp > PluginManager::Fill()\n" ); + //wprintf( "Winmain.cpp > PluginManager::Fill()\n" ); - // --------------------------------------------------------------------------------------- - // Set volume. This must probably be done after the dll is loaded. - GlobalVolume = Playback::Volume::Get(); - GlobalCurrentVolume = GlobalVolume; - Output_SetVolume( GlobalVolume ); - wprintf("\n >>> Volume(%i)\n\n", GlobalVolume); - // --------------------------------------------------------------------------------------- // ======================================================================================= @@ -245,12 +250,20 @@ void Player_Main(bool Console) // Check the plugins if( input_plugins.empty() ) { - wprintf("\n***Warning: The input plugin is not working\n\n"); + wprintf("\n *** Warning: No valid input plugins found\n\n"); + } + else + { + wprintf(" >>> These valid input plugins were found:\n"); + for(int i = 0; i < input_plugins.size(); i++) + wprintf(" %i: %s\n", (i + 1), input_plugins.at(i)->GetFilename()); + wprintf("\n"); } + // The input plugins are never activated here, they are activate for each file if( !active_input_plugin || !active_input_plugin->plugin ) { - wprintf("The input plugin is not activated yet\n"); + // wprintf("The input plugin is not activated yet\n"); } else { @@ -261,72 +274,32 @@ void Player_Main(bool Console) // --------------------------------------------------------------------------------------- if( active_output_count > 0 ) { - // Minimum - int res_temp; + // Show current playback progress + /*int res_temp; for( int i = 0; i < active_output_count; i++ ) { res_temp = active_output_plugins[ i ]->plugin->GetOutputTime(); } - wprintf("Playback progress <%i>\n", res_temp); + wprintf("Playback progress <%i>\n", res_temp);*/ } else { - wprintf("\n***Warning: The output plugin is not working\n\n"); + wprintf("\n *** Warning: The output plugin is not working\n\n"); } // ======================================================================================= - - // ======================================================================================= - // Current playlist items - wprintf("Size & index <%i> <%i>\n", playlist->GetSize(), playlist->GetCurIndex()); - // ======================================================================================= - - - // ======================================================================================= - //This worked - //Sleep(2000); - //Playback::Stop(); - //playlist->RemoveAll(); - //play_file("C:\\demo36_02.ast"); - // ======================================================================================= - - // ======================================================================================= - // Current playlist items - wprintf("Size & index <%i> <%i>\n", playlist->GetSize(), playlist->GetCurIndex()); - // ======================================================================================= - - - // ======================================================================================= - // This worked - //Sleep(5000); - //Playback::Stop(); - //Playback::Play(); - // ======================================================================================= - - - // ======================================================================================= - - //bool bPlaying = false; - //TCHAR * szFilename = TEXT("C:\Files\Spel och spelfusk\Console\Gamecube\Code\vgmstream (isolate ast)\Music\demo36_02.ast"); - - //bPlaying = OpenPlay( szFilename, 1 ); - //bPlaying = OpenPlay( szFilename, iIndex + 1 ); - //Console::Append( TEXT( "Playback.cpp:Playback::Play() called OpenPlay" ) ); - - // ======================================================================================= - - // ======================================================================================= // Start the timer if(!TimerCreated && bLoop) // Only create this the first time { - wprintf("Created the timer\n"); + //wprintf("Created the timer\n"); MakeTime(); TimerCreated = true; } // ======================================================================================= - wprintf( "DLL > main_dll() > End\n\n\n" ); + wprintf( "\n=========================================================\n\n" ); + //wprintf( "DLL > main_dll() > End\n\n\n" ); //std::cin.get(); } diff --git a/Branches/MusicMod/Player/Src/PlayerExport.cpp b/Branches/MusicMod/Player/Src/PlayerExport.cpp index f887905dca..39cf9dcc67 100644 --- a/Branches/MusicMod/Player/Src/PlayerExport.cpp +++ b/Branches/MusicMod/Player/Src/PlayerExport.cpp @@ -4,6 +4,8 @@ // ŻŻŻŻŻŻŻŻŻŻ #include // System +#include "../../../../Source/Core/Common/Src/Common.h" // Global common + #include "../../Common/Src/Console.h" // Local common #include "OutputPlugin.h" // Local @@ -19,8 +21,8 @@ // Declarations and definitions // ŻŻŻŻŻŻŻŻŻŻ std::string CurrentlyPlayingFile; -int GlobalVolume; -int GlobalCurrentVolume; +int GlobalVolume = -1; +bool GlobalMute = false; bool GlobalPause; bool TimerCreated = false; bool Initialized = false; @@ -122,38 +124,43 @@ void Player_Unpause() GlobalPause = false; } -void Player_Mute() -{ - wprintf("DLL > Mute <%i> <%i>\n", GlobalVolume, GlobalCurrentVolume); - // --------------------------------------------------------------------------------------- - // Set volume. For some reason Playback::Volume::Get() is not updated when we run Output_SetVolume() - // I probably disabled it by mistake, so we only keep track of the volume with GlobalVolume from now on - if(GlobalCurrentVolume > 0) +////////////////////////////////////////////////////////////////////////////////////////// +// Declarations and definitions +// ŻŻŻŻŻŻŻŻŻŻŻŻŻ +/* About the volume: The colume is normally update for the output plugin in Output.cpp and for the + inout plugin (why?) in Playback.cpp with Playback::Volume::Set(). But I don't know how that works + so I only use GlobalVolume to keep track of the volume */ +// ------------------------------ +void Player_Mute(int Vol) +{ + if(GlobalVolume == -1) GlobalVolume = Vol; + wprintf("DLL > Mute <%i> <%i>\n", GlobalVolume, GlobalMute); + + GlobalMute = !GlobalMute; + + // Set volume + if(GlobalMute) { Output_SetVolume( 0 ); - GlobalCurrentVolume = 0; - wprintf("DLL > Volume <%i>\n", GlobalCurrentVolume); + wprintf("DLL > Volume <%i>\n", GlobalMute); } else { - //Output_SetVolume( GlobalVolume ); Output_SetVolume( GlobalVolume ); - GlobalCurrentVolume = GlobalVolume; - wprintf("DLL > Volume <%i>\n", GlobalCurrentVolume); + wprintf("DLL > Volume <%i>\n", GlobalMute); } //wprintf("Volume(%i)\n", Playback::Volume::Get()); - // --------------------------------------------------------------------------------------- } +/////////////////////////////////////// - -void Player_Volume(int a) +void Player_Volume(int Vol) { - GlobalVolume = a; + GlobalVolume = Vol; Output_SetVolume( GlobalVolume ); - wprintf("DLL > Volume <%i> <%i>\n", GlobalVolume, GlobalCurrentVolume); + //wprintf("DLL > Volume <%i> <%i>\n", GlobalVolume, GlobalCurrentVolume); } void ShowConsole() diff --git a/Branches/MusicMod/Player/Src/PlayerExport.h b/Branches/MusicMod/Player/Src/PlayerExport.h index bb95374a91..54ed9fba31 100644 --- a/Branches/MusicMod/Player/Src/PlayerExport.h +++ b/Branches/MusicMod/Player/Src/PlayerExport.h @@ -44,6 +44,6 @@ EXPORT void Player_Play(char *); EXPORT void Player_Stop(); EXPORT void Player_Pause(); EXPORT void Player_Unpause(); -EXPORT void Player_Mute(); -EXPORT void Player_Volume(int); +EXPORT void Player_Mute(int Vol); +EXPORT void Player_Volume(int Vol); diff --git a/Branches/MusicMod/Player/Src/Timer.cpp b/Branches/MusicMod/Player/Src/Timer.cpp index 91081d98bb..e079678481 100644 --- a/Branches/MusicMod/Player/Src/Timer.cpp +++ b/Branches/MusicMod/Player/Src/Timer.cpp @@ -56,7 +56,7 @@ extern bool GlobalPause; // Check if the input plugin is activated if(!active_input_plugin || !active_input_plugin->plugin) { - wprintf("The input plugin is not activated yet\n"); + //wprintf("The input plugin is not activated yet\n"); } else { @@ -73,7 +73,7 @@ extern bool GlobalPause; if ( progress > 0.7 ) // Only show this if we are getting close to the end, for bugtesting // basically { - wprintf("Playback progress <%i of %i>\n", ms_cur, ms_len); + //wprintf("Playback progress <%i of %i>\n", ms_cur, ms_len); } // Because cur never go all the way to len we can't use a == comparison. Insted of this diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 1734db928d..16b38edc9c 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -103,6 +103,7 @@ class CFrame : public wxFrame // ŻŻŻŻŻŻŻŻŻŻ #ifdef MUSICMOD wxToolBarToolBase* mm_ToolMute, * mm_ToolPlay, * mm_ToolLog; + wxSlider * mm_Slider; void MM_UpdateGUI(); void MM_PopulateGUI(); void MM_InitBitmaps(int Theme); void MM_OnPlay(); void MM_OnStop(); diff --git a/Source/MusicMod.sln b/Source/MusicMod.sln index a2b46c6157..6556e59963 100644 --- a/Source/MusicMod.sln +++ b/Source/MusicMod.sln @@ -139,6 +139,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Player", "..\Branches\MusicMod\Player\Player.vcproj", "{0B72B5D6-5D72-4391-84A7-9CCA5392668A}" ProjectSection(ProjectDependencies) = postProject {DE7C596C-CBC4-4278-8909-146D63990803} = {DE7C596C-CBC4-4278-8909-146D63990803} + {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPlayer", "..\Branches\MusicMod\TestPlayer\TestPlayer.vcproj", "{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}" @@ -352,9 +353,11 @@ Global {521498BE-6089-4780-8223-E67C22F4E068}.Debug|x64.ActiveCfg = Debug|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Debug|x64.Build.0 = Debug|x64 {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 + {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|Win32.Build.0 = DebugFast|Win32 {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|x64.ActiveCfg = DebugFast|x64 {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|x64.Build.0 = DebugFast|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Release|Win32.ActiveCfg = Release|Win32 + {521498BE-6089-4780-8223-E67C22F4E068}.Release|Win32.Build.0 = Release|Win32 {521498BE-6089-4780-8223-E67C22F4E068}.Release|x64.ActiveCfg = Release|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Release|x64.Build.0 = Release|x64 {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.Debug|Win32.ActiveCfg = Debug|Win32