From: <hdo...@us...> - 2009-02-09 22:53:42
|
Revision: 1518 http://wired.svn.sourceforge.net/wired/?rev=1518&view=rev Author: hdoomsday Date: 2009-02-09 22:53:37 +0000 (Mon, 09 Feb 2009) Log Message: ----------- fixed include errors appearing with GCC >= 4.3 Modified Paths: -------------- trunk/wired/src/midi/MidiFile.cpp trunk/wired/src/midi/MidiFile.h trunk/wired/src/plugins/beatbox/BeatButton.h trunk/wired/src/plugins/chorus/WvIn.cpp trunk/wired/src/redist/Polyphony.cpp trunk/wired/src/redist/Polyphony.h Modified: trunk/wired/src/midi/MidiFile.cpp =================================================================== --- trunk/wired/src/midi/MidiFile.cpp 2008-08-02 17:14:49 UTC (rev 1517) +++ trunk/wired/src/midi/MidiFile.cpp 2009-02-09 22:53:37 UTC (rev 1518) @@ -1,6 +1,8 @@ // Copyright (C) 2004-2007 by Wired Team // Under the GNU General Public License Version 2, June 1991 +#include <algorithm> + #include "MidiFile.h" #include "Sequencer.h" #include <fcntl.h> @@ -13,6 +15,8 @@ #include <wx/filename.h> #include <iostream> +using namespace std; + void MakeMidiFileName(wxString &filename, unsigned long seqTrackIndex) { wxString ext = wxT("mid"); @@ -141,7 +145,6 @@ ppqn = DEFAULT_MIDI_PPQN; ratio = (double)Seq->SigNumerator * (double)ppqn; - cout << "[MidiTrack] MidiTrack() creating MidiTrack from list of midi events" << endl; cout << " ppqn " << (int)ppqn << endl; cout << " position ratio " << ratio << endl; Modified: trunk/wired/src/midi/MidiFile.h =================================================================== --- trunk/wired/src/midi/MidiFile.h 2008-08-02 17:14:49 UTC (rev 1517) +++ trunk/wired/src/midi/MidiFile.h 2009-02-09 22:53:37 UTC (rev 1518) @@ -11,12 +11,10 @@ #include <wx/file.h> #include <wx/defs.h> -#include <algorithm> #include <vector> #include "midi.h" -using namespace std; using std::vector; // the name of the default midi filename (without extension) Modified: trunk/wired/src/plugins/beatbox/BeatButton.h =================================================================== --- trunk/wired/src/plugins/beatbox/BeatButton.h 2008-08-02 17:14:49 UTC (rev 1517) +++ trunk/wired/src/plugins/beatbox/BeatButton.h 2009-02-09 22:53:37 UTC (rev 1518) @@ -50,7 +50,7 @@ class BeatButton : public wxWindow { public: - BeatButton(wxWindow* parent, wxWindowID id, const wxPoint& pos, + BeatButton(wxWindow* parent, wxWindowID id, const wxPoint& pospoint, const wxSize& size, wxBitmap** bitmaps, unsigned int pos); ~BeatButton(); unsigned int* GetData() { return Data; } Modified: trunk/wired/src/plugins/chorus/WvIn.cpp =================================================================== --- trunk/wired/src/plugins/chorus/WvIn.cpp 2008-08-02 17:14:49 UTC (rev 1517) +++ trunk/wired/src/plugins/chorus/WvIn.cpp 2009-02-09 22:53:37 UTC (rev 1518) @@ -45,11 +45,17 @@ */ /***************************************************/ -#include "WvIn.h" +#include <sys/types.h> #include <sys/stat.h> -#include <sys/types.h> +#include <unistd.h> + +#include <cstdio> +#include <string> #include <math.h> +#include "WvIn.h" + + WvIn :: WvIn() { init(); Modified: trunk/wired/src/redist/Polyphony.cpp =================================================================== --- trunk/wired/src/redist/Polyphony.cpp 2008-08-02 17:14:49 UTC (rev 1517) +++ trunk/wired/src/redist/Polyphony.cpp 2009-02-09 22:53:37 UTC (rev 1518) @@ -1,10 +1,14 @@ // Copyright (C) 2004-2007 by Wired Team // Under the GNU General Public License Version 2, June 1991 +#include <string.h> + #include "Polyphony.h" #define BUFSIZE 4096 +using namespace std; + Polyphony::Polyphony() { buffer_size = BUFSIZE; @@ -35,7 +39,6 @@ Poly *voice; //std::cout << "[POLYPHONY] Setting polyphony to: " << p << std::endl; - fflush(stdout); PolyphonyCount = p; for (j = 0; j < count; j++) { @@ -50,13 +53,10 @@ } } -#include <stdio.h> - void Polyphony::SetBufferSize(int size) { buffer_size = size; //std::cout << "[POLYPHONY] Buffer size: " << buffer_size << std::endl; - fflush(stdout); // OnChangeSettings(); } @@ -70,8 +70,7 @@ return (*i)->Buffer; } //std::cout << "[POLYPHONY] Returning No Buffer !!!" << std::endl; - fflush(stdout); - return (0x0); + return (NULL); } void Polyphony::SetFreeBuffer(float **f) Modified: trunk/wired/src/redist/Polyphony.h =================================================================== --- trunk/wired/src/redist/Polyphony.h 2008-08-02 17:14:49 UTC (rev 1517) +++ trunk/wired/src/redist/Polyphony.h 2009-02-09 22:53:37 UTC (rev 1518) @@ -4,11 +4,8 @@ #ifndef __POLYPHONY_H__ #define __POLYPHONY_H__ -#include <string.h> #include <list> -using namespace std; - typedef struct { bool IsFree; @@ -35,7 +32,7 @@ long buffer_size; int PolyphonyCount; float Volume; - list<Poly *> Voices; + std::list<Poly *> Voices; }; #endif//__POLYPHONY_H__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-03-30 22:03:04
|
Revision: 1526 http://wired.svn.sourceforge.net/wired/?rev=1526&view=rev Author: hdoomsday Date: 2009-03-30 22:02:59 +0000 (Mon, 30 Mar 2009) Log Message: ----------- done some cleanness Modified Paths: -------------- trunk/wired/src/Makefile.am trunk/wired/src/engine/Makefile.am trunk/wired/src/plugins/HostCallback.cpp trunk/wired/src/save/SaveCenter.cpp Modified: trunk/wired/src/Makefile.am =================================================================== --- trunk/wired/src/Makefile.am 2009-03-16 21:13:35 UTC (rev 1525) +++ trunk/wired/src/Makefile.am 2009-03-30 22:02:59 UTC (rev 1526) @@ -22,7 +22,8 @@ -DEPS_LIBS = libs/WiredWidgets/src/.libs/libWiredWidgets.so libs/WiredAkai/src/.libs/libWiredAkai.so +DEPS_LIBS = libs/WiredWidgets/src/.libs/libWiredWidgets.so \ + libs/WiredAkai/src/.libs/libWiredAkai.so wired_LDFLAGS = $(shell wx-config --libs) \ $(shell pkg-config portaudio-2.0 --libs) \ @@ -35,7 +36,8 @@ wired_CPPFLAGS = $(shell wx-config --cflags) \ $(shell xml2-config --cflags) \ @SAMPLERATE_CFLAGS@ \ - -Igui -Iplugins -Ifileloader -Isequencer -Iredist -Iaudio -Iengine -Imixer -Iundo \ + -Igui -Iplugins -Ifileloader -Isequencer -Iredist \ + -Iaudio -Iengine -Imixer -Iundo \ -Imidi -Ieditmidi Modified: trunk/wired/src/engine/Makefile.am =================================================================== --- trunk/wired/src/engine/Makefile.am 2009-03-16 21:13:35 UTC (rev 1525) +++ trunk/wired/src/engine/Makefile.am 2009-03-30 22:02:59 UTC (rev 1526) @@ -1,4 +1,14 @@ -CPPFLAGS = $(shell wx-config --cflags) -I../xml -I../save -I../gui -I../plugins -I../fileloader -I../sequencer -I../redist -I../audio -I../mixer -I../midi -I../midi/portmidi/pm_common -I../midi/portmidi/porttime -I../editmidi -I../undo -I../libs/WiredWidgets/src -I../xml -I../wiredvideo -I../samplerate -I../codec `xml2-config --cflags` -I../ +CPPFLAGS = $(shell wx-config --cflags) \ + -I../xml -I../save -I../gui -I../plugins \ + -I../fileloader -I../sequencer -I../redist \ + -I../audio -I../mixer -I../midi \ + -I../midi/portmidi/pm_common \ + -I../midi/portmidi/porttime \ + -I../editmidi -I../undo \ + -I../libs/WiredWidgets/src \ + -I../xml -I../wiredvideo \ + -I../samplerate -I../codec \ + `xml2-config --cflags` -I../ LDFLAGS = $(shell wx-config --libs) Modified: trunk/wired/src/plugins/HostCallback.cpp =================================================================== --- trunk/wired/src/plugins/HostCallback.cpp 2009-03-16 21:13:35 UTC (rev 1525) +++ trunk/wired/src/plugins/HostCallback.cpp 2009-03-30 22:02:59 UTC (rev 1526) @@ -14,6 +14,8 @@ #include "Plugin.h" #include "HelpCtrl.h" +#include "version.h" + extern Rack *RackPanel; using namespace std; Modified: trunk/wired/src/save/SaveCenter.cpp =================================================================== --- trunk/wired/src/save/SaveCenter.cpp 2009-03-16 21:13:35 UTC (rev 1525) +++ trunk/wired/src/save/SaveCenter.cpp 2009-03-30 22:02:59 UTC (rev 1526) @@ -24,7 +24,7 @@ std::cerr << "SaveCenter destroyed" << std::endl; } -//Implemetation of WiredDocument +//Implementation of WiredDocument void SaveCenter::Save() { //return project specific infos ? @@ -760,19 +760,13 @@ } +// return true if the "path" contain a wired.xml bool SaveCenter::IsProject(wxFileName path) { - wxFileName test; + path.SetName(wxT("wired")); + path.SetExt(wxT("xml")); - test = path; - - test.SetName(wxT("wired")); - test.SetExt(wxT("xml")); - - if(test.FileExists()) - return true; - else - return false; + return (path.FileExists()); } bool SaveCenter::getSaved() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-03-30 22:15:42
|
Revision: 1527 http://wired.svn.sourceforge.net/wired/?rev=1527&view=rev Author: hdoomsday Date: 2009-03-30 22:15:28 +0000 (Mon, 30 Mar 2009) Log Message: ----------- fixed bug 2658801 "Audio initialisation played twice" moved Wizard in MainApp instead MainWindow re-added One-instance check Modified Paths: -------------- trunk/wired/src/engine/AudioEngine.cpp trunk/wired/src/gui/MainApp.cpp trunk/wired/src/gui/MainApp.h trunk/wired/src/gui/MainWindow.cpp trunk/wired/src/gui/MainWindow.h trunk/wired/src/gui/SettingWindow.cpp trunk/wired/src/gui/SettingWindow.h trunk/wired/src/mixer/Mixer.cpp Modified: trunk/wired/src/engine/AudioEngine.cpp =================================================================== --- trunk/wired/src/engine/AudioEngine.cpp 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/engine/AudioEngine.cpp 2009-03-30 22:15:28 UTC (rev 1527) @@ -3,9 +3,13 @@ #include <sndfile.h> #include "AudioEngine.h" +#include "MainApp.h" #include "MainWindow.h" #include "EngineError.h" +#define NDEBUG +#include <assert.h> + const unsigned long standardSampleFormats[] = { paFloat32, paInt32, @@ -29,6 +33,7 @@ AudioEngine::AudioEngine() { + cout << "[AUDIO] AudioEngine construct" << endl; IsOk = false; StreamIsOpened = false; StreamIsStarted = false; @@ -45,8 +50,39 @@ GetAudioSystems(); GetDevices(); - SetDefaultSettings(); + try + { + GetDeviceSettings(); + } + catch (Error::InvalidDeviceSettings) + { + cout << "[MAINWIN] Invalid Device Settings" << endl; + } + // from SetChannels + catch (Error::ChannelsNotSet) + { + cout << "[MAINWIN] Channels Not Set" << endl; + } + // from OpenStream + catch (Error::StreamNotOpen) + { + cout << "[MAINWIN] Stream Not Opened" << endl; + } + catch (std::bad_alloc) + { + cout << "[MAINWIN] out of memory" << endl; + } + catch (std::exception &e) + { + cout << "[MAINWIN] Stdlib failure (" << e.what() << + ") during AudioEngine init, check your code" << endl; + } + catch (...) + { + cout << "[MAINWIN] Unknown AudioEngine error" << endl; + } + cout << "[AUDIO] AudioEngine initialized" << endl; } @@ -167,6 +203,8 @@ void AudioEngine::GetDeviceSettings() { + assert( WiredSettings ); + UserData->Sets = WiredSettings; // assimile a la latence possible @@ -419,11 +457,9 @@ void AudioEngine::AlertDialog(const wxString& from, const wxString& msg) { - - //wxMutexGuiEnter(); - MainWin->AlertDialog(from, msg); - //wxMutexGuiLeave(); - + wxMutexGuiEnter(); + wxGetApp().AlertDialog(from, msg); + wxMutexGuiLeave(); } void AudioEngine::SetChannels(int in, int out) Modified: trunk/wired/src/gui/MainApp.cpp =================================================================== --- trunk/wired/src/gui/MainApp.cpp 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/gui/MainApp.cpp 2009-03-30 22:15:28 UTC (rev 1527) @@ -10,13 +10,17 @@ #include <wx/dirdlg.h> #include <wx/filename.h> #include <wx/image.h> +#include <wx/snglinst.h> +#include <wx/debugrpt.h> #include "MainApp.h" #include "MainWindow.h" #include "Settings.h" #include "SaveCenter.h" +#include "Wizard.h" #include <config.h> +#include "version.h" #ifdef DEBUG_MAINAPP #define LOG { wxFileName __filename__(__FILE__); cout << __filename__.GetFullName() << " : " << __LINE__ << " : " << __FUNCTION__ << endl; } @@ -26,7 +30,7 @@ void AllocationErrorHandler(void) { - cout << "[MAINAPP] Allocation error or not enough memory, aborting" << endl; + cout << "[MAINAPP] Allocation error or not enough memory, aborting" << endl; exit(-1); } @@ -57,85 +61,194 @@ nosplash = false; return (true); } - -bool MainApp::OnInit() + +// check if Wired is already launched +bool MainApp::checkDoubleStart() { + const wxString name = wxString::Format(wxT("wired-%s"), wxGetUserId().c_str()); + wxSingleInstanceChecker *Checker; + + Checker = new wxSingleInstanceChecker(name); + if (Checker->IsAnotherRunning()) + { + cout << "Another instance of Wired is already running, aborting." << endl; + delete Checker; + return (true); + } + delete Checker; + return (false); +} + +// force user to select a directory +wxString MainApp::ChooseSessionDir() +{ LOG; + + wxDirDialog dirDialog(NULL, _("Select a project folder"), wxGetCwd()); + + while(dirDialog.ShowModal() != wxID_OK) + AlertDialog(_("Warning"), + _("You have to select a project folder.")); + + return (dirDialog.GetPath()); +} + +void MainApp::WiredStartSession(wxString sessionDir) +{ + wxFileName path; + + WiredSettings->AddDirToRecent(sessionDir); + path.AssignDir(sessionDir); + path.MakeAbsolute(); + wxFileName::SetCwd(path.GetPath()); + + saveCenter->setProjectPath(path); + + // if we're loading a project from an existing saving directory + if (saveCenter->IsProject(path)) + saveCenter->LoadProject(); +} + +// open a wizard window +void MainApp::ShowWizard() +{ + LOG; + + Wizard wiz; + + wiz.ShowModal(); + if (wxFileName::DirExists(wiz.GetDir())) + WiredStartSession(wiz.GetDir()); + else + WiredStartSession(ChooseSessionDir()); +} + +// show/hide splash +void MainApp::ShowSplash(bool show) +{ + static wxSplashScreen* splash = NULL; + + if (nosplash) + return; + + if ( show ) + { + wxBitmap bitmap; + + if (bitmap.LoadFile(wxString(DATA_DIR, *wxConvCurrent) + wxString(wxT("/wired/ihm/splash/splash.png")), wxBITMAP_TYPE_PNG)) + { + // we keep time-out very high for low cpu + splash = new wxSplashScreen(bitmap, + wxSPLASH_CENTRE_ON_SCREEN + | wxSPLASH_TIMEOUT, + 120000, + NULL, + -1, + wxDefaultPosition, + wxDefaultSize, + wxSIMPLE_BORDER); + splash->Update(); + splash->Refresh(); + // alert dialog can use it before frame loading + wxYield(); + } + } + else + { + // Wired crash if loading time of main frame is longer than splash timeout + if (splash) + splash->Hide(); + } +} + +bool MainApp::wxInitialization() +{ + LOG; + #if wxUSE_ON_FATAL_EXCEPTION wxHandleFatalExceptions(); #endif - wxBitmap bitmap; - wxSplashScreen* splash = NULL; + + // load image handlers #if wxUSE_LIBPNG wxImage::AddHandler(new wxPNGHandler); #endif wxImage::AddHandler(new wxGIFHandler); + + // set static stuff SetAppName(wxT("wired")); + SetUseBestVisual(true); + SetVendorName(wxT("Wired Team")); + // allow use of command line process provided by wxWidgets if (!wxApp::OnInit()) + return false; + return true; +} + +// start point of Wired +bool MainApp::OnInit() +{ + cout << "[MAINAPP] Wired initialization..." << endl; + + // begin with wxWidgets initialization + if (!wxInitialization()) return false; - // used in error dialog + + // this var is used in error dialog MainWin = (MainWindow *) NULL; - // init some conditions variables - m_condAllDone = new wxCondition(m_mutex); + // splash screen - if (!nosplash) - { - if (bitmap.LoadFile(wxString(DATA_DIR, *wxConvCurrent) + wxString(wxT("/wired/ihm/splash/splash.png")), wxBITMAP_TYPE_PNG)) - { - // we keep time-out very high for low cpu - splash = new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, - 120000, NULL, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER); - splash->Update(); - splash->Refresh(); - // alert dialog can use it before frame loading - wxYield(); - } - } -#if 0 - const wxString name = wxString::Format(wxT("wired-%s"), wxGetUserId().c_str()); - Checker = new wxSingleInstanceChecker(name); - if (Checker->IsAnotherRunning()) - { - cout << "Another instance of Wired is already running, aborting." << endl; - return (false); - } - delete Checker; -#endif - SetUseBestVisual(true); - SetVendorName(wxT("Wired Team")); - // Frame = new MainWindow(WIRED_TITLE, wxDefaultPosition, wxGetDisplaySize()); + ShowSplash(); + + // avoid two Wired's launch + if (checkDoubleStart()) + return false; + + // load save/session stuff saveCenter = new SaveCenter(); + WiredSettings = new Settings(); // load settings + + // load wizard + if (wxFileName::DirExists(SessionDir)) + WiredStartSession(SessionDir); + else + ShowWizard(); + + // init cond mutex to do a clean stop + m_condAllDone = new wxCondition(m_mutex); + + // open the main wired window Frame = new MainWindow(WIRED_TITLE, wxDefaultPosition, wxSize(800,600), saveCenter); + + // hide splash screen + ShowSplash(false); + + // .. and show main windows Frame->Show(true); SetTopWindow(Frame); - // Wired crash if loading main frame is more than splash timeout - if (!nosplash && splash) - splash->Hide(); - // now error dialog are based on mainframe + + // now error dialog could be based on mainframe MainWin = Frame; - // its obvious that user can't have deprecated conf with a fresh install - if (WiredSettings->ConfIsDeprecated() && !WiredSettings->IsFirstLaunch()) + + // welcome new users! + if (WiredSettings->IsFirstLaunch()) + ShowWelcome(); + else if (WiredSettings->ConfIsDeprecated()) { wxCommandEvent evt; - MainWin->AlertDialog(_("Warning"), _("Your configuration file is deprecated or empty, settings need to be set.")); + AlertDialog(_("Warning"), _("Your configuration file is deprecated or empty, settings need to be set.")); } - else if (WiredSettings->IsFirstLaunch()) - ShowWelcome(); // open stream, start fileconverter and co if (Frame->Init() != 0) { cerr << "[WIRED] Critical error, initialisation failed" << endl; - // returning false segfault.. so we exit ! - exit(-1); + // returning here segfault or what? + return (false); } - if (wxFileName::DirExists(SessionDir)) - MainWin->WiredStartSession(SessionDir); - else - MainWin->OpenWizard(); return (true); } @@ -152,6 +265,19 @@ msg.ShowModal(); } +void MainApp::AlertDialog(const wxString& from, const wxString& msg) +{ + LOG; + + // print on stdout + cout << "[MAINAPP] Error :" << from.mb_str() << " msg: " << msg.mb_str() << endl; + + // alert user with a dialog popup + wxMessageDialog mdialog(MainWin, msg, from, + wxICON_INFORMATION, wxDefaultPosition); + mdialog.ShowModal(); +} + #if wxUSE_ON_FATAL_EXCEPTION void MainApp::OnFatalException() { @@ -172,15 +298,13 @@ { LOG; cout << "UnhandledException" << endl; - Frame->AlertDialog(_("Critical error"), _("An unhandled exception has occurred, aborting")); + AlertDialog(_("Critical error"), _("An unhandled exception has occurred, aborting")); } int MainApp::OnExit() { LOG; -#if 0 - delete Checker; -#endif + Frame->Destroy(); return (wxApp::OnExit()); } Modified: trunk/wired/src/gui/MainApp.h =================================================================== --- trunk/wired/src/gui/MainApp.h 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/gui/MainApp.h 2009-03-30 22:15:28 UTC (rev 1527) @@ -5,12 +5,9 @@ #define __MAINAPP_H__ #include <wx/app.h> -#include <wx/snglinst.h> -#include <wx/debugrpt.h> #include <wx/thread.h> #include <wx/dynarray.h> -#include <wx/cmdline.h> -#include "version.h" +#include <wx/cmdline.h> WX_DEFINE_ARRAY_PTR(wxThread *, wxArrayThread); @@ -24,21 +21,36 @@ virtual void OnInitCmdLine(wxCmdLineParser& parser); virtual bool OnCmdLineParsed(wxCmdLineParser& parser); + // these popup should be called from every class + void AlertDialog(const wxString& from, const wxString& msg); + wxArrayThread m_threads; wxMutex m_mutex; wxCondition* m_condAllDone; private: - wxString SessionDir; - bool nosplash; + wxString SessionDir; + bool nosplash; MainWindow *Frame; - wxSingleInstanceChecker *Checker; #if wxUSE_ON_FATAL_EXCEPTION void OnFatalException (); #endif void OnUnhandledException (); - void ShowWelcome (); + + // + bool wxInitialization(); + + // popup related + void ShowWelcome(); + void ShowWizard(); + void ShowSplash(bool show = true); + + // wizard related + wxString ChooseSessionDir(); + void WiredStartSession(wxString sessionDir); + // return true if another instance is running + bool checkDoubleStart(); }; static const wxCmdLineEntryDesc g_cmdLineDesc [] = Modified: trunk/wired/src/gui/MainWindow.cpp =================================================================== --- trunk/wired/src/gui/MainWindow.cpp 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/gui/MainWindow.cpp 2009-03-30 22:15:28 UTC (rev 1527) @@ -3,12 +3,10 @@ #include "MainWindow.h" -#ifdef __LINUX__ -# include <unistd.h> -#endif -#include <wx/splitter.h> #include <wx/progdlg.h> #include <wx/utils.h> +#include <wx/splash.h> + #include <algorithm> #include "SequencerGui.h" #include "HostCallback.h" @@ -40,13 +38,14 @@ #include "PluginLoader.h" #include "WiredExternalPluginMgr.h" #include "FileConversion.h" -#include <config.h> #include "Threads.h" #include "MediaLibrary.h" #include "MLTree.h" #include "SaveCenter.h" + +#include <config.h> #include "debug.h" -#include "Wizard.h" +#include "version.h" #ifdef DEBUG_MAINWINDOW #define LOG { wxFileName __filename__(__FILE__); cout << __filename__.GetFullName() << " : " << __LINE__ << " : " << __FUNCTION__ << endl; } @@ -69,8 +68,6 @@ Transport *TransportPanel = NULL; PlugStartInfo StartInfo; vector<PluginLoader *> LoadedPluginsList; -//SaveCenter *saveCenter; -//SaveCenter *saveCenter = NULL; WiredExternalPluginMgr *LoadedExternalPlugins = NULL; MediaLibrary *MediaLibraryPanel = NULL; FileConversion *FileConverter = NULL; @@ -94,9 +91,6 @@ #if wxUSE_STATUSBAR CreateStatusBar(2); #endif - WiredSettings = new Settings(); - - //saveCenter = new SaveCenter(wxGetCwd()); LoadedExternalPlugins = new WiredExternalPluginMgr(); LogWin = new wxLogWindow(this, wxT("Wired log"), false); @@ -343,7 +337,7 @@ { // avoid to flood user, he already knows he has a deprecated config! if (!WiredSettings->ConfIsDeprecated()) - AlertDialog(_("audio engine"), + wxGetApp().AlertDialog(_("audio engine"), _("Could not open audio device : check that the device is not busy (used by another application) and that your audio settings are correct.")); } InitFileConverter(); @@ -491,11 +485,6 @@ { cout << "[MAINWIN] Stream Not Opened" << endl; } - // from nowhere - catch (Error::AudioEngineError) - { - cout << "[MAINWIN] General AudioEngine Error" << endl; - } catch (std::bad_alloc) { cout << "[MAINWIN] oom" << endl; @@ -1618,20 +1607,12 @@ { // avoid to flood user, he already knows he has a deprecated config! if (!WiredSettings->ConfIsDeprecated()) - AlertDialog(_("audio engine"), + wxGetApp().AlertDialog(_("audio engine"), _("Could not open audio device : check that the device is not busy (used by another application) and that your audio settings are correct.")); } } } -void MainWindow::AlertDialog(const wxString& from, const wxString& msg) -{ - LOG; - wxMessageDialog mdialog(MainWin, msg, from, wxICON_INFORMATION, wxDefaultPosition); - - mdialog.ShowModal(); -} - void MainWindow::OnOpenVideo(wxCommandEvent &event) { LOG; @@ -2212,47 +2193,6 @@ MediaLibraryPanel->MLTreeView->OnSave(dlg.GetPath()); } -void MainWindow::OpenWizard() -{ - LOG; - - - Wizard wiz; - - wiz.ShowModal(); - if (wxFileName::DirExists(wiz.GetDir())) - WiredStartSession(wiz.GetDir()); - else - WiredStartSession(ChooseSessionDir()); -} - -wxString MainWindow::ChooseSessionDir() -{ - LOG; - - wxDirDialog dirDialog(NULL, _("Select a project folder"), wxGetCwd()); - - while(dirDialog.ShowModal() != wxID_OK) - AlertDialog(_("Warning"), - _("You have to select a project folder.")); - - return (dirDialog.GetPath()); -} - -void MainWindow::WiredStartSession(wxString sessionDir) -{ - wxFileName path; - - WiredSettings->AddDirToRecent(sessionDir); - path.AssignDir(sessionDir); - path.MakeAbsolute(); - wxFileName::SetCwd(path.GetPath()); - saveCenter->setProjectPath(path); - - if (saveCenter->IsProject(path)) - saveCenter->LoadProject(); -} - BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxSetCursorPos, 313131) END_DECLARE_EVENT_TYPES() Modified: trunk/wired/src/gui/MainWindow.h =================================================================== --- trunk/wired/src/gui/MainWindow.h 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/gui/MainWindow.h 2009-03-30 22:15:28 UTC (rev 1527) @@ -4,26 +4,15 @@ #ifndef __MAINWINDOW_H__ #define __MAINWINDOW_H__ -using namespace std; - -#include <iostream> #include <vector> #include <wx/wxprec.h> #ifndef WX_PRECOMP #include <wx/wx.h> #endif -#include <wx/colour.h> #include <wx/textfile.h> -#include <wx/timer.h> -#include <wx/splash.h> #include <wx/splitter.h> -#include <wx/log.h> -#include <wx/filename.h> -#include <wx/cmdline.h> -#include "version.h" - #define PLUG_MENU_INDEX_START (50000) #define INDEX_MENUITEM_UNDO 0 #define INDEX_MENUITEM_REDO 1 @@ -42,7 +31,7 @@ class MainWindow; extern MainWindow *MainWin; -extern vector<PluginLoader *> LoadedPluginsList; +extern std::vector<PluginLoader *> LoadedPluginsList; extern PlugStartInfo StartInfo; extern wxMutex AudioMutex; extern wxCondition* SeqStopped; @@ -89,7 +78,6 @@ bool NewSession(); void LoadPlugins(); - void AlertDialog(const wxString& from, const wxString& msg); void StartStream(wxCommandEvent &event); void StopStream(wxCommandEvent &event); @@ -137,11 +125,6 @@ void CreatePluginFromUniqueId(wxString UniqueId, wxString name); - /* Shows a wxDirDialog to select a project folder */ - wxString ChooseSessionDir(); - void OpenWizard(); - - void WiredStartSession(wxString sessionDir); wxString m_FrameTitle; protected: friend class MediaLibrary; Modified: trunk/wired/src/gui/SettingWindow.cpp =================================================================== --- trunk/wired/src/gui/SettingWindow.cpp 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/gui/SettingWindow.cpp 2009-03-30 22:15:28 UTC (rev 1527) @@ -6,6 +6,7 @@ #include <wx/imaglist.h> #include <wx/image.h> +#include "MainApp.h" #include "MainWindow.h" #include "SettingWindow.h" #include "AudioEngine.h" @@ -331,9 +332,9 @@ void SettingWindow::OnApplyClick(wxCommandEvent &event) { - if (MainWin->InitAudio(true) < 0) - MainWin->AlertDialog(_("audio engine"), - _("Could not open audio device : check that the device is not busy (used by another application) and that your audio settings are correct.")); + if (MainWin->InitAudio(true) < 0) + wxGetApp().AlertDialog(_("audio engine"), + _("Could not open audio device : check that the device is not busy (used by another application) and that your audio settings are correct.")); AudioLoaded = false; MidiLoaded = false; } Modified: trunk/wired/src/gui/SettingWindow.h =================================================================== --- trunk/wired/src/gui/SettingWindow.h 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/gui/SettingWindow.h 2009-03-30 22:15:28 UTC (rev 1527) @@ -1,9 +1,6 @@ // Copyright (C) 2004-2007 by Wired Team // Under the GNU General Public License Version 2, June 1991 -// Copyright (C) 2004-2006 by Wired Team -// Under the GNU General Public License - #ifndef __SETTINGWINDOW_H__ #define __SETTINGWINDOW_H__ Modified: trunk/wired/src/mixer/Mixer.cpp =================================================================== --- trunk/wired/src/mixer/Mixer.cpp 2009-03-30 22:02:59 UTC (rev 1526) +++ trunk/wired/src/mixer/Mixer.cpp 2009-03-30 22:15:28 UTC (rev 1527) @@ -17,6 +17,7 @@ Mixer::Mixer(WiredDocument* docParent) : WiredDocument(wxT("Mixer"), docParent) { + cout << "[MIXER] Mixer initialization" << endl; VolumeLeft = 1.f; VolumeRight = 1.f; MuteL = false; @@ -170,8 +171,8 @@ { cout << "[MIXER] Mixer Left initialized " << Audio->SamplesPerBuffer << endl; cout << "[MIXER] Mixer Right initialized " << Audio->SamplesPerBuffer << endl; - OutputLeft = new float[4096]; - OutputRight = new float[4096]; + OutputLeft = new float[Audio->SamplesPerBuffer]; + OutputRight = new float[Audio->SamplesPerBuffer]; if (!Input) Input = new float*[PREBUF_NUM]; for (int i = 0; i < PREBUF_NUM; i++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-04-01 00:23:35
|
Revision: 1531 http://wired.svn.sourceforge.net/wired/?rev=1531&view=rev Author: hdoomsday Date: 2009-04-01 00:23:22 +0000 (Wed, 01 Apr 2009) Log Message: ----------- [Engine] reduced latency between actions Modified Paths: -------------- trunk/wired/src/editmidi/ControlChange.cpp trunk/wired/src/editmidi/Note.cpp trunk/wired/src/gui/AudioPattern.cpp trunk/wired/src/gui/FileConversion.cpp trunk/wired/src/gui/Pattern.cpp trunk/wired/src/gui/SeqTrack.cpp trunk/wired/src/gui/SequencerGui.cpp trunk/wired/src/gui/Transport.cpp trunk/wired/src/sequencer/Sequencer.cpp trunk/wired/src/sequencer/Track.cpp Modified: trunk/wired/src/editmidi/ControlChange.cpp =================================================================== --- trunk/wired/src/editmidi/ControlChange.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/editmidi/ControlChange.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -16,7 +16,7 @@ void ControlChange::SetChannel(int channel) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); if (channel > 15) channel = 15; @@ -24,13 +24,11 @@ channel = 0; p->SetToWrite(); e->Msg[0] = ME_CODE(e->Msg[0]) | channel; - - SeqMutex.Unlock(); } void ControlChange::SetController(int controller) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); if (controller > 127) controller = 127; @@ -38,24 +36,20 @@ controller = 0; p->SetToWrite(); e->Msg[1] = controller; - - SeqMutex.Unlock(); } void ControlChange::SetPos(double pos) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); p->SetToWrite(); e->EndPosition = pos; e->Position = pos; - - SeqMutex.Unlock(); } void ControlChange::SetValue(int value) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); if (value > 127) value = 127; @@ -64,7 +58,6 @@ p->SetToWrite(); e->Msg[2] = value; - SeqMutex.Unlock(); } int ControlChange::GetChannel() @@ -89,7 +82,7 @@ void ControlChange::Erase() { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); p->SetToWrite(); for (vector<MidiEvent *>::iterator i = p->Events.begin(); i != p->Events.end(); i++) @@ -100,7 +93,5 @@ break; }//p->Events.begin() + num); } - - SeqMutex.Unlock(); } Modified: trunk/wired/src/editmidi/Note.cpp =================================================================== --- trunk/wired/src/editmidi/Note.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/editmidi/Note.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -16,11 +16,10 @@ void Note::SetDuration(double duration) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); p->SetToWrite(); e->EndPosition = duration + e->Position; - SeqMutex.Unlock(); } double Note::GetDuration() @@ -30,7 +29,7 @@ void Note::SetNote(int note) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); if (note > 127) note = 127; @@ -38,7 +37,6 @@ note = 0; p->SetToWrite(); e->Msg[1] = note; - SeqMutex.Unlock(); } int Note::GetNote() @@ -48,12 +46,11 @@ void Note::SetPos(double pos) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); p->SetToWrite(); e->EndPosition = e->EndPosition - e->Position + pos; e->Position = pos; - SeqMutex.Unlock(); } double Note::GetPos() @@ -68,7 +65,7 @@ void Note::SetChannel(int channel) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); if (channel > 15) channel = 15; @@ -76,12 +73,11 @@ channel = 0; p->SetToWrite(); e->Msg[0] = ME_CODE(e->Msg[0]) | channel; - SeqMutex.Unlock(); } void Note::SetVelocity(int velocity) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); if (velocity > 127) velocity = 127; @@ -89,7 +85,6 @@ velocity = 0; p->SetToWrite(); e->Msg[2] = velocity; - SeqMutex.Unlock(); } int Note::GetVelocity() @@ -99,7 +94,7 @@ void Note::Erase() { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); p->SetToWrite(); for (vector<MidiEvent *>::iterator i = p->Events.begin(); i != p->Events.end(); i++) @@ -110,5 +105,4 @@ break; }//p->Events.begin() + num); } - SeqMutex.Unlock(); } Modified: trunk/wired/src/gui/AudioPattern.cpp =================================================================== --- trunk/wired/src/gui/AudioPattern.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/gui/AudioPattern.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -120,13 +120,15 @@ void AudioPattern::OnBpmChange() { - wxMutexLocker m(SeqMutex); + { + wxMutexLocker m(SeqMutex); #ifdef __DEBUG__ - printf("\tAudioPattern : MeasurePerSample %f , Frames %d\n", - Seq->MeasurePerSample, Wave->GetNumberOfFrames()); + printf("\tAudioPattern : MeasurePerSample %f , Frames %d\n", + Seq->MeasurePerSample, Wave->GetNumberOfFrames()); #endif - Length = Seq->MeasurePerSample * (EndWavePos - StartWavePos); + Length = Seq->MeasurePerSample * (EndWavePos - StartWavePos); + } EndPosition = Position + Length; Update(); } @@ -140,8 +142,6 @@ if (w) { FileName = w->Filename; - wxMutexLocker m(SeqMutex); - OnBpmChange(); } } Modified: trunk/wired/src/gui/FileConversion.cpp =================================================================== --- trunk/wired/src/gui/FileConversion.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/gui/FileConversion.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -101,9 +101,7 @@ break; case AImportFile : cout << "[FILECONVERT] Thread working ! import file" << endl; - SeqMutex.Lock(); ImportWavePattern(Action->SrcFileName); - SeqMutex.Unlock(); cout << "[FILECONVERT] Thread working ! import file ended" << endl; break; default : @@ -302,9 +300,7 @@ void FileConversion::ImportWaveFile(wxString &FileName) { - SeqMutex.Lock(); ImportWavePattern(FileName); - SeqMutex.Unlock(); // EnqueueAction(AImportFile, FileName, wxString(wxT(""))); FileConversionMutex.Unlock(); } Modified: trunk/wired/src/gui/Pattern.cpp =================================================================== --- trunk/wired/src/gui/Pattern.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/gui/Pattern.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -207,13 +207,13 @@ double z; int trackto; double mes; + // can we reduce our critical section ? + wxMutexLocker m(SeqMutex); - if (IsSelected() && (SeqPanel->Tool == ID_TOOL_MOVE_SEQUENCER) && e.Dragging() && (Seq->Tracks[TrackIndex]->GetAudioPattern() != this)) { if (m_click.x != -1) StateMask |= (unsigned char) PATTERN_MASK_DRAGGED; - SeqMutex.Lock(); if ((x = (e.GetPosition().x - m_click.x)) > (max = (long) floor(PATTERN_DRAG_SCROLL_UNIT * SeqPanel->HoriZoomFactor))) x = max; else if (x < -max) @@ -237,7 +237,6 @@ else { SeqPanel->ChangeMouseCursor(wxCursor(wxCURSOR_NO_ENTRY)); - SeqMutex.Unlock(); return; } } @@ -257,7 +256,6 @@ else SeqPanel->SeqView->AutoXScrollReset(); } - SeqMutex.Unlock(); } // else Modified: trunk/wired/src/gui/SeqTrack.cpp =================================================================== --- trunk/wired/src/gui/SeqTrack.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/gui/SeqTrack.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -370,7 +370,6 @@ if (Selected && e.Dragging()) { - SeqMutex.Lock(); z = ((e.m_y - m_click.y) / (h = (long) (TRACK_HEIGHT * SeqPanel->VertZoomFactor))); if (z < 0) if (GetPosition().y < 0) @@ -389,7 +388,6 @@ } else SeqPanel->ChangeSelectedTrackIndex(z); - SeqMutex.Unlock(); } } @@ -449,9 +447,9 @@ Record = true; if (Seq->Playing && Seq->Recording) { - SeqMutex.Lock(); + wxMutexLocker m(SeqMutex); + Seq->PrepareTrackForRecording(Seq->Tracks[Index - 1]); - SeqMutex.Unlock(); } } else Modified: trunk/wired/src/gui/SequencerGui.cpp =================================================================== --- trunk/wired/src/gui/SequencerGui.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/gui/SequencerGui.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -245,20 +245,23 @@ void SequencerGui::DeleteTrack(Track* track) { - // We need to keep SeqMutex locked until re-indexation is done - wxMutexLocker locker(SeqMutex); if (track) { - // we should stop recording or something else instead return - if (track->GetTrackOpt()->Record && Seq->Recording) - return; + // We need to keep SeqMutex locked until re-indexation is done + { + wxMutexLocker locker(SeqMutex); - delete track; - ReindexTrackArray(); + // we should stop recording or something else instead return + if (track->GetTrackOpt()->Record && Seq->Recording) + return; - // Refresh things - UpdateTracks(); + delete track; + ReindexTrackArray(); + + // Refresh things + UpdateTracks(); + } SetScrolling(); AdjustVScrolling(); } @@ -626,22 +629,24 @@ void SequencerGui::DeleteAllTracks() { - wxMutexLocker locker(SeqMutex); - vector<Track *>::iterator i; - vector<Track *>::iterator next; + { + wxMutexLocker locker(SeqMutex); + vector<Track *>::iterator i; + vector<Track *>::iterator next; - i = Seq->Tracks.begin(); - while (i != Seq->Tracks.end()) - { - next = i + 1; - delete (*i); - i = next; - } + i = Seq->Tracks.begin(); + while (i != Seq->Tracks.end()) + { + next = i + 1; + delete (*i); + i = next; + } - // should be unnecessary - Seq->Tracks.clear(); + // should be unnecessary + Seq->Tracks.clear(); - UpdateTracks(); + UpdateTracks(); + } SetScrolling(); } @@ -1124,10 +1129,12 @@ void SequencerGui::Load(SaveElementArray data) { - wxMutexLocker m(SeqMutex); int i; + { + wxMutexLocker m(SeqMutex); - SetCurrentPos(Seq->CurrentPos); + SetCurrentPos(Seq->CurrentPos); + } for (i = 0; i < data.GetCount(); i++) { if (data[i]->getKey() == wxT("HoriZoomFactor")) HoriZoomFactor = data[i]->getValueFloat(); Modified: trunk/wired/src/gui/Transport.cpp =================================================================== --- trunk/wired/src/gui/Transport.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/gui/Transport.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -194,8 +194,8 @@ void Transport::OnStop(wxCommandEvent &WXUNUSED(event)) { + PlayBtn->SetOff();; Seq->Stop(); - PlayBtn->SetOff();; if (RecordBtn->GetOn()) RecordBtn->SetOff(); } @@ -228,11 +228,12 @@ void Transport::OnLoop(wxCommandEvent &WXUNUSED(event)) { - wxMutexLocker m(SeqMutex); + { + wxMutexLocker m(SeqMutex); - Seq->Loop = LoopBtn->GetOn(); + Seq->Loop = LoopBtn->GetOn(); + } Refresh(); - } void Transport::OnMetronome(wxCommandEvent &WXUNUSED(event)) @@ -244,9 +245,11 @@ void Transport::OnBackward(wxCommandEvent &WXUNUSED(event)) { - wxMutexLocker m(SeqMutex); - Seq->SetCurrentPos(0.0); - SeqPanel->SetCurrentPos(Seq->CurrentPos); + { + wxMutexLocker m(SeqMutex); + Seq->SetCurrentPos(0.0); + } + SeqPanel->SetCurrentPos(0.0); } void Transport::OnForward(wxCommandEvent &WXUNUSED(event)) @@ -323,11 +326,12 @@ { if (Seq->SigNumerator < 9) { - wxMutexLocker m(SeqMutex); wxString s; + { + wxMutexLocker m(SeqMutex); - Seq->SetSigNumerator(Seq->SigNumerator + 1); - + Seq->SetSigNumerator(Seq->SigNumerator + 1); + } s.Printf(wxT("%d"), Seq->SigNumerator); SigNumLabel->SetLabel(s); SeqPanel->AdjustHScrolling(); @@ -338,11 +342,12 @@ { if (Seq->SigNumerator > 1) { - wxMutexLocker m(SeqMutex); wxString s; + { + wxMutexLocker m(SeqMutex); - Seq->SetSigNumerator(Seq->SigNumerator - 1); - + Seq->SetSigNumerator(Seq->SigNumerator - 1); + } s.Printf(wxT("%d"), Seq->SigNumerator); SigNumLabel->SetLabel(s); SeqPanel->AdjustHScrolling(); @@ -353,11 +358,12 @@ { if (Seq->SigDenominator < 9) { - wxMutexLocker m(SeqMutex); wxString s; + { + wxMutexLocker m(SeqMutex); - Seq->SetSigDenominator(Seq->SigDenominator + 1); - + Seq->SetSigDenominator(Seq->SigDenominator + 1); + } s.Printf(wxT("%d"), Seq->SigDenominator); SigDenLabel->SetLabel(s); SeqPanel->AdjustHScrolling(); @@ -368,11 +374,12 @@ { if (Seq->SigDenominator > 1) { - wxMutexLocker m(SeqMutex); wxString s; + { + wxMutexLocker m(SeqMutex); - Seq->SetSigDenominator(Seq->SigDenominator - 1); - + Seq->SetSigDenominator(Seq->SigDenominator - 1); + } s.Printf(wxT("%d"), Seq->SigDenominator); SigDenLabel->SetLabel(s); SeqPanel->AdjustHScrolling(); @@ -401,9 +408,11 @@ if (s.ToDouble(&d)) { - SeqMutex.Lock(); - Seq->SetBPM(d); - SeqMutex.Unlock(); + { + wxMutexLocker m(SeqMutex); + + Seq->SetBPM(d); + } SetBpm(d); } Disconnect(Transport_BpmEnter, wxEVT_COMMAND_TEXT_ENTER, (wxObjectEventFunction)(wxEventFunction) @@ -463,8 +472,6 @@ void Transport::Load(SaveElementArray data) { - wxMutexLocker m(SeqMutex); - SetBpm(Seq->BPM); SetSigNumerator(Seq->SigNumerator); SetSigDenominator(Seq->SigDenominator); Modified: trunk/wired/src/sequencer/Sequencer.cpp =================================================================== --- trunk/wired/src/sequencer/Sequencer.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/sequencer/Sequencer.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -26,9 +26,7 @@ #ifdef DEBUG_SEQUENCER #include <wx/filename.h> -#endif -#ifdef DEBUG_SEQUENCER #define LOG { wxFileName __filename__(__FILE__); cout << __filename__.GetFullName() << " : " << __LINE__ << " : " << __FUNCTION__ << endl; } #else #define LOG @@ -117,6 +115,7 @@ while (!TestDestroy()) { // to prevent playing without a valid config + Yield(); AudioMutex.Lock(); if (!Audio->IsOk) { @@ -129,6 +128,7 @@ continue; } AudioMutex.Unlock(); + Yield(); /* - gotten MIDI messages analyze */ MidiMutex.Lock(); @@ -139,12 +139,14 @@ { SeqMutex.Unlock(); Play(); + Yield(); SeqMutex.Lock(); } else if ((*MidiMsg)->Msg[0] == M_STOP) { SeqMutex.Unlock(); Stop(); + Yield(); SeqMutex.Lock(); } else @@ -168,17 +170,18 @@ delete *MidiMsg; } SeqMutex.Unlock(); - Yield(); MidiEvents.clear(); MidiMutex.Unlock(); + Yield(); SeqMutex.Lock(); if (Playing) { - /* moved to end of loop - SeqMutex.Unlock(); - SetCurrentPos(); - SeqMutex.Lock(); - */ + // moved to end of loop +// SeqMutex.Unlock(); +// SetCurrentPos(); +// Yield(); +// SeqMutex.Lock(); + /* Looping */ if (!Exporting && Loop && (CurrentPos >= EndLoopPos)) SetCurrentPos(BeginLoopPos); @@ -282,8 +285,9 @@ SetCurrentPos(); } -// SeqMutex.Unlock(); -// SeqMutex.Lock(); + SeqMutex.Unlock(); + Yield(); + SeqMutex.Lock(); /* - Calls each rack track plug-in's Process function */ for (RacksTrack = RackPanel->RackTracks.begin(); RacksTrack != RackPanel->RackTracks.end(); RacksTrack++) @@ -364,7 +368,6 @@ (*B)->Chan->PushBuffer((*B)->Buffer); } /* Mix->MixOutput() function call */ - //SeqMutex.Lock(); if (Exporting) { if (CurrentPos >= EndLoopPos) @@ -400,15 +403,19 @@ list<Plugin *>::iterator Plug; // don't forget to lock mutex: - wxMutexLocker locker(SeqMutex); + { + wxMutexLocker locker(SeqMutex); - for (RacksTrack = RackPanel->RackTracks.begin(); - RacksTrack != RackPanel->RackTracks.end(); RacksTrack++) - for (Plug = (*RacksTrack)->Racks.begin(); Plug != (*RacksTrack)->Racks.end(); - Plug++) - (*Plug)->Play(); + for (RacksTrack = RackPanel->RackTracks.begin(); + RacksTrack != RackPanel->RackTracks.end(); RacksTrack++) + for (Plug = (*RacksTrack)->Racks.begin(); Plug != (*RacksTrack)->Racks.end(); + Plug++) + (*Plug)->Play(); + } + Playing = true; StartAudioPos = Audio->GetTime(); + /* CurAudioPos = 0; CurrentPos = 0.f; */ if (Recording) @@ -423,38 +430,34 @@ vector<Track *>::iterator T; // don't forget to lock mutex: - wxMutexLocker locker(SeqMutex); + { + wxMutexLocker locker(SeqMutex); - for (RacksTrack = RackPanel->RackTracks.begin(); - RacksTrack != RackPanel->RackTracks.end(); RacksTrack++) - for (Plug = (*RacksTrack)->Racks.begin(); Plug != (*RacksTrack)->Racks.end(); - Plug++) - (*Plug)->Stop(); + for (RacksTrack = RackPanel->RackTracks.begin(); + RacksTrack != RackPanel->RackTracks.end(); RacksTrack++) + for (Plug = (*RacksTrack)->Racks.begin(); Plug != (*RacksTrack)->Racks.end(); + Plug++) + (*Plug)->Stop(); - for (T = Tracks.begin(); T != Tracks.end(); T++) - if ((*T)->IsMidiTrack()) - { - (*T)->GetTrackOpt()->VuValue = 0; - TracksToRefresh.push_back(*T); - } + for (T = Tracks.begin(); T != Tracks.end(); T++) + if ((*T)->IsMidiTrack()) + { + (*T)->GetTrackOpt()->VuValue = 0; + TracksToRefresh.push_back(*T); + } + } Playing = false; + Yield(); //if (WiredVideoObject->asFile == true) WiredVideoObject->StopFile(); - if (Recording) - { - SeqMutex.Unlock(); - FinishRecording(); - - SeqMutex.Lock(); - } + if (Recording) + FinishRecording(); Recording = false; } void Sequencer::Record(bool bRecording) { - wxMutexLocker locker(SeqMutex); - Recording = bRecording; if (Recording) { @@ -477,17 +480,8 @@ void Sequencer::UnregisterTrack(Track *track) { -/*<<<<<<< .working - SeqMutex.Lock(); - t->SetIndex(Tracks.size()); - Tracks.push_back(t); - SeqMutex.Unlock(); -} -======= -*/ wxMutexLocker locker(SeqMutex); vector<Track *>::iterator iterTrack; -//>>>>>>> .merge-right.r1376 for (iterTrack = Tracks.begin(); iterTrack != Tracks.end(); iterTrack++) if (*iterTrack == track) @@ -500,6 +494,7 @@ void Sequencer::PrepareRecording() { vector<Track *>::iterator T; + wxMutexLocker locker(SeqMutex); for (T = Tracks.begin(); T != Tracks.end(); T++) { @@ -557,6 +552,7 @@ void Sequencer::FinishRecording() { vector<Track *>::iterator T; + wxMutexLocker locker(SeqMutex); for (T = Tracks.begin(); T != Tracks.end(); T++) { @@ -566,20 +562,12 @@ { if ((*T)->GetAudioPattern()) (*T)->GetAudioPattern()->StopRecord(); - SeqMutex.Lock(); (*T)->SetAudioPattern(NULL); - - SeqMutex.Unlock(); - } else if ((*T)->IsMidiTrack()) { - SeqMutex.Lock(); - (*T)->SetMidiPattern(NULL); - - SeqMutex.Unlock(); } } } @@ -912,53 +900,39 @@ SampleRateConverter->Init(&Info); if (SampleRateConverter->SaveFile(filename, 2, Audio->SamplesPerBuffer, true)) { - SeqMutex.Lock(); - AllocBuffer(ExportBuf); - SetCurrentPos(BeginLoopPos); + { + wxMutexLocker locker(SeqMutex); + + AllocBuffer(ExportBuf); + SetCurrentPos(BeginLoopPos); + } Exporting = true; Loop = false; - SeqMutex.Unlock(); + Play(); return true; } else { - wxMutexGuiLeave(); return false; } - -// try -// { -// ExportWave = new WriteWaveFile(filename, (int)Audio->SampleRate, 2, -// SF_FORMAT_PCM_16); -// SetCurrentPos(BeginLoopPos); -// -// SeqMutex.Lock(); -// Exporting = true; -// SeqMutex.Unlock(); -// -// Play(); -// } -// catch (...) -// { -// cout << "[SEQUENCER] Could not create export file" << endl; // FIXME error dialog box -// } -// return false; } void Sequencer::StopExport() { Stop(); - SeqMutex.Lock(); - Exporting = false; - if (SampleRateConverter) { + wxMutexLocker locker(SeqMutex); + + Exporting = false; + if (SampleRateConverter) + { SampleRateConverter->EndSaveFile(2); delete SampleRateConverter; SampleRateConverter = NULL; - DeleteBuffer(ExportBuf); + DeleteBuffer(ExportBuf); + } } - SeqMutex.Unlock(); return; } @@ -1021,36 +995,39 @@ } //delete img; - SeqMutex.Lock(); + { + wxMutexLocker locker(SeqMutex); - PlayWavePos = 0; - PlayWave = w; - - SeqMutex.Unlock(); + PlayWavePos = 0; + PlayWave = w; + } } else { WaveFile *w = new WaveFile(filename, false); - SeqMutex.Lock(); - PlayWavePos = 0; - PlayWave = w; - SeqMutex.Unlock(); + + { + wxMutexLocker locker(SeqMutex); + + PlayWavePos = 0; + PlayWave = w; + } } } catch (...) { - SeqMutex.Lock(); - PlayWave = 0; - SeqMutex.Unlock(); + wxMutexLocker locker(SeqMutex); + + PlayWave = NULL; } } void Sequencer::StopFile() { - wxMutexLocker locker(SeqMutex); - if (PlayWave) { + wxMutexLocker locker(SeqMutex); + delete PlayWave; PlayWave = 0x0; } Modified: trunk/wired/src/sequencer/Track.cpp =================================================================== --- trunk/wired/src/sequencer/Track.cpp 2009-03-31 23:00:50 UTC (rev 1530) +++ trunk/wired/src/sequencer/Track.cpp 2009-04-01 00:23:22 UTC (rev 1531) @@ -160,11 +160,13 @@ newPattern = new AudioPattern(this, pos, 0.0f, Index); newPattern->SetDrawColour(PatternColours[ColourIndex]); - SeqMutex.Lock(); - if (newPattern->GetEndPosition() > Seq->EndPos) - Seq->EndPos = newPattern->GetEndPosition(); - SeqMutex.Unlock(); + { + wxMutexLocker m(SeqMutex); + if (newPattern->GetEndPosition() > Seq->EndPos) + Seq->EndPos = newPattern->GetEndPosition(); + } + newPattern->Update(); #ifdef __DEBUG__ printf("Track::CreateAudioPattern(%d, %f) -- OVER (AUDIO)\n", w, pos); @@ -182,12 +184,14 @@ a = new AudioPattern(this, pos, w, Index); a->SetDrawColour(PatternColours[ColourIndex]); - SeqMutex.Lock(); - TrackPattern->Patterns.push_back(a); - if (a->GetEndPosition() > Seq->EndPos) - Seq->EndPos = a->GetEndPosition(); - SeqMutex.Unlock(); + { + wxMutexLocker m(SeqMutex); + TrackPattern->Patterns.push_back(a); + if (a->GetEndPosition() > Seq->EndPos) + Seq->EndPos = a->GetEndPosition(); + } + a->Update(); #ifdef __DEBUG__ printf("Track::AddPattern(%d, %f) -- OVER (AUDIO)\n", w, pos); @@ -238,11 +242,14 @@ newPattern = new MidiPattern(this, 0, t, Index); newPattern->SetDrawColour(PatternColours[ColourIndex]); - wxMutexLocker locker(SeqMutex); + newPattern->Update(); - newPattern->Update(); - if (newPattern->GetEndPosition() > Seq->EndPos) - Seq->EndPos = newPattern->GetEndPosition(); + { + wxMutexLocker locker(SeqMutex); + + if (newPattern->GetEndPosition() > Seq->EndPos) + Seq->EndPos = newPattern->GetEndPosition(); + } #ifdef __DEBUG__ printf("Track::CreateMidiPattern(%d) -- OVER (MIDI)\n", t); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-04-01 00:45:57
|
Revision: 1532 http://wired.svn.sourceforge.net/wired/?rev=1532&view=rev Author: hdoomsday Date: 2009-04-01 00:45:53 +0000 (Wed, 01 Apr 2009) Log Message: ----------- [GUI] Added GPL icons and removed old, unused and ugly bmp Modified Paths: -------------- trunk/wired/src/gui/WavePanel.cpp Added Paths: ----------- trunk/wired/src/data/ihm/toolbar/edit-copy.png trunk/wired/src/data/ihm/toolbar/edit-cut.png trunk/wired/src/data/ihm/toolbar/edit-delete.png trunk/wired/src/data/ihm/toolbar/edit-paste.png trunk/wired/src/data/ihm/toolbar/edit-redo.png trunk/wired/src/data/ihm/toolbar/edit-undo.png Removed Paths: ------------- trunk/wired/src/data/toolbar/ Added: trunk/wired/src/data/ihm/toolbar/edit-copy.png =================================================================== (Binary files differ) Property changes on: trunk/wired/src/data/ihm/toolbar/edit-copy.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/wired/src/data/ihm/toolbar/edit-cut.png =================================================================== (Binary files differ) Property changes on: trunk/wired/src/data/ihm/toolbar/edit-cut.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/wired/src/data/ihm/toolbar/edit-delete.png =================================================================== (Binary files differ) Property changes on: trunk/wired/src/data/ihm/toolbar/edit-delete.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/wired/src/data/ihm/toolbar/edit-paste.png =================================================================== (Binary files differ) Property changes on: trunk/wired/src/data/ihm/toolbar/edit-paste.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/wired/src/data/ihm/toolbar/edit-redo.png =================================================================== (Binary files differ) Property changes on: trunk/wired/src/data/ihm/toolbar/edit-redo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/wired/src/data/ihm/toolbar/edit-undo.png =================================================================== (Binary files differ) Property changes on: trunk/wired/src/data/ihm/toolbar/edit-undo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/wired/src/gui/WavePanel.cpp =================================================================== --- trunk/wired/src/gui/WavePanel.cpp 2009-04-01 00:23:22 UTC (rev 1531) +++ trunk/wired/src/gui/WavePanel.cpp 2009-04-01 00:45:53 UTC (rev 1532) @@ -45,19 +45,31 @@ Toolbar = new wxToolBar(this, ID_TOOLBAR_WAVE, wxPoint(0, 0), wxSize(size.GetWidth(),WAVE_TOOLBAR_HEIGHT ), wxTB_FLAT); - Toolbar->AddTool(ID_TOOL_COPY_WAVE, _("Copy"), wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/copy_up.bmp")), wxBITMAP_TYPE_BMP), - wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/copy_down.bmp")),wxBITMAP_TYPE_BMP), wxITEM_NORMAL, _("Copy"), _("Copy wave"), NULL); - Toolbar->AddTool(ID_TOOL_PASTE_WAVE, _("Paste"), wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/paste_up.bmp")), wxBITMAP_TYPE_BMP), - wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/paste_down.bmp")),wxBITMAP_TYPE_BMP), wxITEM_NORMAL, _("Paste"), _("Paste wave"), NULL); - Toolbar->AddTool(ID_TOOL_CUT_WAVE, _("Cut"), wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/cut_up.bmp")), wxBITMAP_TYPE_BMP), - wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/cut_down.bmp")), wxBITMAP_TYPE_BMP), wxITEM_NORMAL, _("Cut"), _("Cut wave"), NULL); - Toolbar->AddTool(ID_TOOL_DEL_WAVE, _("Delete"), wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/delete.png")), wxBITMAP_TYPE_PNG), - wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/delete.png")), wxBITMAP_TYPE_PNG), wxITEM_NORMAL, _("Delete"), _("Delete"), NULL); + Toolbar->AddTool(ID_TOOL_COPY_WAVE, _("Copy"), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-copy.png")), wxBITMAP_TYPE_PNG), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-copy.png")), wxBITMAP_TYPE_PNG), + wxITEM_NORMAL, _("Copy"), _("Copy wave"), NULL); + Toolbar->AddTool(ID_TOOL_PASTE_WAVE, _("Paste"), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-paste.png")), wxBITMAP_TYPE_PNG), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-paste.png")),wxBITMAP_TYPE_PNG), + wxITEM_NORMAL, _("Paste"), _("Paste wave"), NULL); + Toolbar->AddTool(ID_TOOL_CUT_WAVE, _("Cut"), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-cut.png")), wxBITMAP_TYPE_PNG), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-cut.png")), wxBITMAP_TYPE_PNG), + wxITEM_NORMAL, _("Cut"), _("Cut wave"), NULL); + Toolbar->AddTool(ID_TOOL_DEL_WAVE, _("Delete"), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-delete.png")), wxBITMAP_TYPE_PNG), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-delete.png")), wxBITMAP_TYPE_PNG), + wxITEM_NORMAL, _("Delete"), _("Delete"), NULL); Toolbar->AddSeparator(); - Toolbar->AddTool(ID_TOOL_UNDO_WAVE, _("Undo"), wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/undo.bmp")), wxBITMAP_TYPE_BMP), - wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/undo.bmp")),wxBITMAP_TYPE_BMP), wxITEM_NORMAL, _("Undo"), _("Undo last action"), NULL); - Toolbar->AddTool(ID_TOOL_REDO_WAVE, _("Redo"), wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/redo.bmp")), wxBITMAP_TYPE_BMP), - wxBitmap(wxString(WiredSettings->DataDir + wxT("toolbar/redo.bmp")), wxBITMAP_TYPE_BMP), wxITEM_NORMAL, _("Redo"), _("Redo"), NULL); + Toolbar->AddTool(ID_TOOL_UNDO_WAVE, _("Undo"), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-undo.png")), wxBITMAP_TYPE_PNG), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-undo.png")),wxBITMAP_TYPE_PNG), + wxITEM_NORMAL, _("Undo"), _("Undo last action"), NULL); + Toolbar->AddTool(ID_TOOL_REDO_WAVE, _("Redo"), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-redo.png")), wxBITMAP_TYPE_PNG), + wxBitmap(wxString(WiredSettings->DataDir + wxT("ihm/toolbar/edit-redo.png")), wxBITMAP_TYPE_PNG), + wxITEM_NORMAL, _("Redo"), _("Redo"), NULL); Toolbar->AddSeparator(); for (c = 0; c < NB_CHOICE; c++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-04-27 19:58:49
|
Revision: 1545 http://wired.svn.sourceforge.net/wired/?rev=1545&view=rev Author: hdoomsday Date: 2009-04-27 19:58:42 +0000 (Mon, 27 Apr 2009) Log Message: ----------- [CLEAN] removed FileConversion class from gui/ directory Modified Paths: -------------- trunk/wired/src/fileloader/Makefile.am trunk/wired/src/gui/Makefile.am Added Paths: ----------- trunk/wired/src/fileloader/FileConversion.cpp Removed Paths: ------------- trunk/wired/src/gui/FileConversion.cpp Copied: trunk/wired/src/fileloader/FileConversion.cpp (from rev 1544, trunk/wired/src/gui/FileConversion.cpp) =================================================================== --- trunk/wired/src/fileloader/FileConversion.cpp (rev 0) +++ trunk/wired/src/fileloader/FileConversion.cpp 2009-04-27 19:58:42 UTC (rev 1545) @@ -0,0 +1,352 @@ +// Copyright (C) 2004-2007 by Wired Team +// Under the GNU General Public License Version 2, June 1991 + +#include <wx/string.h> +#include <wx/filename.h> +#include <wx/progdlg.h> + +#include <sndfile.h> + +#include "FileConversion.h" +#include "cAddTrackAction.h" +#include "cImportMidiAction.h" +#include "Sequencer.h" + +FileConversion::FileConversion()// : wxThread() +{ + _ShouldRun = false; +} + +FileConversion::~FileConversion() +{ + //Delete(); +} + +FileConversion FileConversion::operator=(const FileConversion& right) +{ + if (this != &right) + { + _ShouldRun = right._ShouldRun; + _CodecConverter = right._CodecConverter; + _SampleRateConverter = right._SampleRateConverter; + _CodecsExtensions = right._CodecsExtensions; + _WorkingDir = right._WorkingDir; + _BufferSize = right._BufferSize; + _ActionsList = right._ActionsList; + _Parent = right._Parent; + } + return *this; +} + +bool FileConversion::Init(t_samplerate_info *RateInit, wxString &WorkingDir, unsigned long BufferSize, wxWindow *Parent) +{ + _WorkingDir = WorkingDir; + _BufferSize = BufferSize; + _Parent = Parent; + cout << "[FILECONVERT] Loading Codec management..." << endl; + //_CodecConverter.Init(); + //list<string> CodecsListExtensions = _CodecConverter.GetExtension(DECODE); + //list<string>::iterator Iter; + +// for (Iter = CodecsListExtensions.begin(); Iter != CodecsListExtensions.end(); Iter++) +// _CodecsExtensions.insert(_CodecsExtensions.end(), *Iter); + cout << "...done" << endl << "[FILECONVERT] Loading samplerate management..." << endl; + _SampleRateConverter.Init(RateInit); + cout << "...done" << endl; + _ShouldRun = true; + //int res = Create(); + //if (res != wxTHREAD_NO_ERROR) + //return false; + return true; +} + +vector<wxString> *FileConversion::GetCodecsExtensions() +{ + return &_CodecsExtensions; +} + +void FileConversion::Stop() +{ + FileConversionMutex.Unlock(); + //Delete(); +} + +void *FileConversion::Entry() +{ + cout << "[FILECONVERT] Thread started !" << endl; + bool HasChangedPath; + + while(_ShouldRun) + { + FileConversionMutex.Lock(); + cout << "[FILECONVERT] Thread working !" << endl; + if (_ActionsList.empty() == false) + { + FileConversionAction *Action = _ActionsList.front(); + _ActionsList.pop_front(); + cout << "[FILECONVERT] Thread working ! 1" << endl; + switch (Action->TypeAction) + { + case AImportWaveFile : + Decode(Action->SrcFileName); + break; + case AExportWaveFile : + cout << "[FILECONVERT] Encoding is not supported" << endl; + break; + case AConvertSampleRate : + cout << "[FILECONVERT] Thread working ! Samplerate" << endl; + HasChangedPath = false; + ConvertSamplerate(Action->SrcFileName, HasChangedPath); + cout << "[FILECONVERT] Thread working ! Samplerate ended" << endl; + break; + case AImportFile : + cout << "[FILECONVERT] Thread working ! import file" << endl; + ImportWavePattern(Action->SrcFileName); + cout << "[FILECONVERT] Thread working ! import file ended" << endl; + break; + default : +// FileConversionMutex.Lock(); + break; + } + cout << "[FILECONVERT] Thread working ! 2" << endl; + delete Action; + FileConversionMutex.Unlock(); + cout << "[FILECONVERT] Thread has finished his work !" << endl; + } + else + { + cout << "[FILECONVERT] Thread has no work !" << endl; + //FileConversionMutex.Lock(); + } +// if (TestDestroy() == true) +// break; + } + cout << "[FILECONVERT] Thread killed !" << endl; +// return (Wait()); + return NULL; +} + +int FileConversion::GetSndFFormat(PcmType Type) +{ + switch (Type) + { + case UInt8: + return SF_FORMAT_PCM_U8; + case Int8: + return SF_FORMAT_PCM_S8; + case Int16: + return SF_FORMAT_PCM_16; + case Int24: + return SF_FORMAT_PCM_24; + case Float32: + return SF_FORMAT_FLOAT; + default: + return SF_FORMAT_PCM_16; + } +} + +SNDFILE *FileConversion::OpenDecodeFile(t_Pcm &Data, const wxString &DestFileName, + SF_INFO &Info, unsigned long *TotalReaden, int *sf_write_result) +{ + SNDFILE *Result = NULL; + + Info.samplerate = Data.SampleRate; + Info.channels = Data.Channels; + Info.format = 0; + Info.format |= SF_FORMAT_WAV; + Info.format |= GetSndFFormat(Data.PType); + if ((Result = sf_open(DestFileName.mb_str(*wxConvCurrent), SFM_WRITE, &Info)) == NULL) + { + cout << "[FILECONVERT] Codec 2 - Could not open file " << DestFileName.mb_str(); + cout << "} because of error : " << sf_strerror(Result) << endl; + *TotalReaden = 0; + *sf_write_result = 0; + } + return Result; +} + +// return false if decode has started and failed +bool FileConversion::Decode(wxString &FileName) +{ + bool Res= true; + + if (_ShouldRun == false) + return true; + if (_CodecConverter.CanConvert(FileName, DECODE) == true) + { + wxString FileNameLocal(FileName); + t_Pcm Data; + wxFileName RelativeFileName; + wxString DestFileName; + SNDFILE *Result = NULL; + SF_INFO Info; + unsigned long Readen = 0; + unsigned long TotalReaden = 0; + int sf_write_result = 0; + wxProgressDialog ProgressDialog(_("Conversion"), _("Decoding file, please wait."), + PROGRESS_DIALOG_UNIT, NULL, wxPD_SMOOTH | wxPD_ELAPSED_TIME | + wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_REMAINING_TIME | wxPD_APP_MODAL); + + RelativeFileName = FileNameLocal.substr(FileNameLocal.find_last_of(wxT("/"))); + RelativeFileName.SetExt(wxT("wav")); + DestFileName = _WorkingDir + wxString(wxT("/"), *wxConvCurrent) + RelativeFileName.GetFullName(); + Data.pcm = new float[_BufferSize]; + memset(Data.pcm, 0, _BufferSize); + while ((Readen = _CodecConverter.Decode(FileNameLocal, &Data, _BufferSize)) > 0) + { + TotalReaden += Readen; + if (Result == NULL) + if ((Result = OpenDecodeFile(Data, DestFileName, Info, &TotalReaden, &sf_write_result)) == NULL) break; + ProgressDialog.Update((int)(TotalReaden * PROGRESS_DIALOG_UNIT / Data.TotalSample)); + if (Data.PType == Float32) + sf_write_result = sf_write_float(Result, (float *)Data.pcm,Readen); + else + sf_write_result = sf_writef_int(Result, (int *)Data.pcm, Readen); + memset(Data.pcm, 0, _BufferSize); + } + + _CodecConverter.EndDecode(); + delete[] (float *)Data.pcm; + if (!TotalReaden || !sf_write_result) + { + cout << "[FILECONVERT] Codec 1 - Could not write decoded file {" << FileName.mb_str(); + cout << "} because of error : " << sf_strerror(Result) << endl; + Res = false; + } + else + FileName = DestFileName; + ProgressDialog.Update(PROGRESS_DIALOG_UNIT); + sf_close(Result); + } + return Res; +} + +bool FileConversion::ConvertFromCodec(wxString &FileName) +{ + return Decode(FileName); +// EnqueueAction(AImportWaveFile, FileName, wxString(wxT(""))); + //FileConversionMutex.Unlock(); +} + +void FileConversion::ConvertToCodec(wxString &FileName) +{ + wxString empty; + EnqueueAction(AExportWaveFile, FileName, empty); + FileConversionMutex.Unlock(); +} + +bool FileConversion::ConvertSamplerate(wxString &FileName) +{ + bool HasChangedPath; + return ConvertSamplerate(FileName, HasChangedPath); +// EnqueueAction(AConvertSampleRate, FileName, wxString(wxT(""))); +// FileConversionMutex.Unlock(); +} + +bool FileConversion::ConvertSamplerateNoGraph(wxString &FileName) +{ + bool HasChangedPath; + return ConvertSamplerateNoGraph(FileName, HasChangedPath); +// EnqueueAction(AConvertSampleRate, FileName, wxString(wxT(""))); +// FileConversionMutex.Unlock(); +} +bool FileConversion::ConvertSamplerateNoGraph(wxString &FileName, bool &HasChangedPath) +{ + int HasConvertedFile; + + HasConvertedFile = _SampleRateConverter.OpenFileNoGraph(FileName, _Parent); + if (HasConvertedFile == wxID_CANCEL) + return false; + else if (HasConvertedFile == wxID_NO) + return true; + else if (HasConvertedFile == wxID_YES) + { + HasChangedPath = true; + return true; + } + return true; +} +bool FileConversion::ConvertSamplerate(wxString &FileName, bool &HasChangedPath) +{ + int HasConvertedFile; + + HasConvertedFile = _SampleRateConverter.OpenFile(FileName, _Parent); + if (HasConvertedFile == wxID_CANCEL) + return false; + else if (HasConvertedFile == wxID_NO) + return true; + else if (HasConvertedFile == wxID_YES) + { + HasChangedPath = true; + return true; + } + return true; +} + +bool FileConversion::ImportFile(wxString &FileName) +{ + // convert file from current codec to raw data (wav) + if (ConvertFromCodec(FileName)) + { + // if conversion is not canceled, then we import wave file + if (ConvertSamplerate(FileName) == true) + { + ImportWaveFile(FileName); + return (true); + } + } + return (false); +} + +void FileConversion::ImportWaveFile(wxString &FileName) +{ + ImportWavePattern(FileName); +// EnqueueAction(AImportFile, FileName, wxString(wxT(""))); + FileConversionMutex.Unlock(); +} + +void FileConversion::EnqueueAction(FileConversionTypeAction ActionType, wxString &SrcFile, wxString &DstFile) +{ + FileConversionAction *NewAction = new FileConversionAction; + + NewAction->TypeAction = ActionType; + NewAction->SrcFileName = SrcFile; + NewAction->DstFileName = DstFile; + _ActionsList.push_back(NewAction); + FileConversionMutex.Unlock(); +} + +void FileConversion::ImportWavePattern(wxString &FileName) +{ +// wxProgressDialog *Progress = new wxProgressDialog("Loading wave file", "Please wait...", 100, +// NULL, wxPD_AUTO_HIDE | wxPD_CAN_ABORT +// | wxPD_REMAINING_TIME); +// Progress->Update(1); + cActionManager::Global().AddImportWaveAction(FileName, eAudioTrack, true); +// Progress->Update(80); + //CreateUndoRedoMenus(EditMenu); // ?? +// Progress->Update(99); +// delete Progress; +} + +void FileConversion::CopyToWorkingDir(wxString &FileName) +{ + + wxMessageDialog msg(_Parent, _("Do you want to copy this file to your project directory ?"), wxT("Wired"), + wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE); + int res = msg.ShowModal(); + if (res == wxID_OK) + { + wxFileName fn(FileName); + + fn.SetPath(_WorkingDir); + cout << "[FILECONVERT] Will copy File {" << FileName.mb_str() << "} TO {" << fn.GetFullPath().mb_str() << "}" << endl; + if (!wxCopyFile(FileName, fn.GetFullPath())) + { + wxMessageDialog copymsg(_Parent, _("Could not copy file"), wxT("Wired"), wxOK | wxICON_EXCLAMATION | wxCENTRE); + copymsg.ShowModal(); + } + else + FileName = fn.GetFullPath(); + } +} Modified: trunk/wired/src/fileloader/Makefile.am =================================================================== --- trunk/wired/src/fileloader/Makefile.am 2009-04-08 22:20:06 UTC (rev 1544) +++ trunk/wired/src/fileloader/Makefile.am 2009-04-27 19:58:42 UTC (rev 1545) @@ -1,10 +1,33 @@ LDFLAGS = $(shell wx-config --libs) `xml2-config --libs` -CPPFLAGS = $(shell wx-config --cflags) -I../libs/WiredAkai/include -I../gui -I../plugins -I../audio -I../sequencer -I../redist -I../engine -I../mixer -I../midi -I../midi/portmidi/pm_common -I../midi/portmidi/porttime -I../editmidi -I../undo -I../libs/WiredAkai/include -I../save +CPPFLAGS = $(shell wx-config --cflags) \ + -I../libs/WiredAkai/include \ + -I../gui \ + -I../plugins \ + -I../audio \ + -I../sequencer \ + -I../redist \ + -I../engine \ + -I../mixer \ + -I../midi \ + -I../midi/portmidi/pm_common \ + -I../midi/portmidi/porttime \ + -I../editmidi \ + -I../undo \ + -I../samplerate \ + -I../codec \ + -I../libs/WiredWidgets/src \ + -I../xml \ + `xml2-config --cflags ` \ + -I../redist \ + -I../dssi \ + -I../save noinst_LIBRARIES = libfileloader.a libfileloader_a_SOURCES = \ + FileConversion.h \ + FileConversion.cpp \ TreeItemData.cpp \ TreeItemData.h \ akai.h \ Deleted: trunk/wired/src/gui/FileConversion.cpp =================================================================== --- trunk/wired/src/gui/FileConversion.cpp 2009-04-08 22:20:06 UTC (rev 1544) +++ trunk/wired/src/gui/FileConversion.cpp 2009-04-27 19:58:42 UTC (rev 1545) @@ -1,352 +0,0 @@ -// Copyright (C) 2004-2007 by Wired Team -// Under the GNU General Public License Version 2, June 1991 - -#include <wx/string.h> -#include <wx/filename.h> -#include <wx/progdlg.h> - -#include <sndfile.h> - -#include "FileConversion.h" -#include "cAddTrackAction.h" -#include "cImportMidiAction.h" -#include "Sequencer.h" - -FileConversion::FileConversion()// : wxThread() -{ - _ShouldRun = false; -} - -FileConversion::~FileConversion() -{ - //Delete(); -} - -FileConversion FileConversion::operator=(const FileConversion& right) -{ - if (this != &right) - { - _ShouldRun = right._ShouldRun; - _CodecConverter = right._CodecConverter; - _SampleRateConverter = right._SampleRateConverter; - _CodecsExtensions = right._CodecsExtensions; - _WorkingDir = right._WorkingDir; - _BufferSize = right._BufferSize; - _ActionsList = right._ActionsList; - _Parent = right._Parent; - } - return *this; -} - -bool FileConversion::Init(t_samplerate_info *RateInit, wxString &WorkingDir, unsigned long BufferSize, wxWindow *Parent) -{ - _WorkingDir = WorkingDir; - _BufferSize = BufferSize; - _Parent = Parent; - cout << "[FILECONVERT] Loading Codec management..." << endl; - //_CodecConverter.Init(); - //list<string> CodecsListExtensions = _CodecConverter.GetExtension(DECODE); - //list<string>::iterator Iter; - -// for (Iter = CodecsListExtensions.begin(); Iter != CodecsListExtensions.end(); Iter++) -// _CodecsExtensions.insert(_CodecsExtensions.end(), *Iter); - cout << "...done" << endl << "[FILECONVERT] Loading samplerate management..." << endl; - _SampleRateConverter.Init(RateInit); - cout << "...done" << endl; - _ShouldRun = true; - //int res = Create(); - //if (res != wxTHREAD_NO_ERROR) - //return false; - return true; -} - -vector<wxString> *FileConversion::GetCodecsExtensions() -{ - return &_CodecsExtensions; -} - -void FileConversion::Stop() -{ - FileConversionMutex.Unlock(); - //Delete(); -} - -void *FileConversion::Entry() -{ - cout << "[FILECONVERT] Thread started !" << endl; - bool HasChangedPath; - - while(_ShouldRun) - { - FileConversionMutex.Lock(); - cout << "[FILECONVERT] Thread working !" << endl; - if (_ActionsList.empty() == false) - { - FileConversionAction *Action = _ActionsList.front(); - _ActionsList.pop_front(); - cout << "[FILECONVERT] Thread working ! 1" << endl; - switch (Action->TypeAction) - { - case AImportWaveFile : - Decode(Action->SrcFileName); - break; - case AExportWaveFile : - cout << "[FILECONVERT] Encoding is not supported" << endl; - break; - case AConvertSampleRate : - cout << "[FILECONVERT] Thread working ! Samplerate" << endl; - HasChangedPath = false; - ConvertSamplerate(Action->SrcFileName, HasChangedPath); - cout << "[FILECONVERT] Thread working ! Samplerate ended" << endl; - break; - case AImportFile : - cout << "[FILECONVERT] Thread working ! import file" << endl; - ImportWavePattern(Action->SrcFileName); - cout << "[FILECONVERT] Thread working ! import file ended" << endl; - break; - default : -// FileConversionMutex.Lock(); - break; - } - cout << "[FILECONVERT] Thread working ! 2" << endl; - delete Action; - FileConversionMutex.Unlock(); - cout << "[FILECONVERT] Thread has finished his work !" << endl; - } - else - { - cout << "[FILECONVERT] Thread has no work !" << endl; - //FileConversionMutex.Lock(); - } -// if (TestDestroy() == true) -// break; - } - cout << "[FILECONVERT] Thread killed !" << endl; -// return (Wait()); - return NULL; -} - -int FileConversion::GetSndFFormat(PcmType Type) -{ - switch (Type) - { - case UInt8: - return SF_FORMAT_PCM_U8; - case Int8: - return SF_FORMAT_PCM_S8; - case Int16: - return SF_FORMAT_PCM_16; - case Int24: - return SF_FORMAT_PCM_24; - case Float32: - return SF_FORMAT_FLOAT; - default: - return SF_FORMAT_PCM_16; - } -} - -SNDFILE *FileConversion::OpenDecodeFile(t_Pcm &Data, const wxString &DestFileName, - SF_INFO &Info, unsigned long *TotalReaden, int *sf_write_result) -{ - SNDFILE *Result = NULL; - - Info.samplerate = Data.SampleRate; - Info.channels = Data.Channels; - Info.format = 0; - Info.format |= SF_FORMAT_WAV; - Info.format |= GetSndFFormat(Data.PType); - if ((Result = sf_open(DestFileName.mb_str(*wxConvCurrent), SFM_WRITE, &Info)) == NULL) - { - cout << "[FILECONVERT] Codec 2 - Could not open file " << DestFileName.mb_str(); - cout << "} because of error : " << sf_strerror(Result) << endl; - *TotalReaden = 0; - *sf_write_result = 0; - } - return Result; -} - -// return false if decode has started and failed -bool FileConversion::Decode(wxString &FileName) -{ - bool Res= true; - - if (_ShouldRun == false) - return true; - if (_CodecConverter.CanConvert(FileName, DECODE) == true) - { - wxString FileNameLocal(FileName); - t_Pcm Data; - wxFileName RelativeFileName; - wxString DestFileName; - SNDFILE *Result = NULL; - SF_INFO Info; - unsigned long Readen = 0; - unsigned long TotalReaden = 0; - int sf_write_result = 0; - wxProgressDialog ProgressDialog(_("Conversion"), _("Decoding file, please wait."), - PROGRESS_DIALOG_UNIT, NULL, wxPD_SMOOTH | wxPD_ELAPSED_TIME | - wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_REMAINING_TIME | wxPD_APP_MODAL); - - RelativeFileName = FileNameLocal.substr(FileNameLocal.find_last_of(wxT("/"))); - RelativeFileName.SetExt(wxT("wav")); - DestFileName = _WorkingDir + wxString(wxT("/"), *wxConvCurrent) + RelativeFileName.GetFullName(); - Data.pcm = new float[_BufferSize]; - memset(Data.pcm, 0, _BufferSize); - while ((Readen = _CodecConverter.Decode(FileNameLocal, &Data, _BufferSize)) > 0) - { - TotalReaden += Readen; - if (Result == NULL) - if ((Result = OpenDecodeFile(Data, DestFileName, Info, &TotalReaden, &sf_write_result)) == NULL) break; - ProgressDialog.Update((int)(TotalReaden * PROGRESS_DIALOG_UNIT / Data.TotalSample)); - if (Data.PType == Float32) - sf_write_result = sf_write_float(Result, (float *)Data.pcm,Readen); - else - sf_write_result = sf_writef_int(Result, (int *)Data.pcm, Readen); - memset(Data.pcm, 0, _BufferSize); - } - - _CodecConverter.EndDecode(); - delete[] (float *)Data.pcm; - if (!TotalReaden || !sf_write_result) - { - cout << "[FILECONVERT] Codec 1 - Could not write decoded file {" << FileName.mb_str(); - cout << "} because of error : " << sf_strerror(Result) << endl; - Res = false; - } - else - FileName = DestFileName; - ProgressDialog.Update(PROGRESS_DIALOG_UNIT); - sf_close(Result); - } - return Res; -} - -bool FileConversion::ConvertFromCodec(wxString &FileName) -{ - return Decode(FileName); -// EnqueueAction(AImportWaveFile, FileName, wxString(wxT(""))); - //FileConversionMutex.Unlock(); -} - -void FileConversion::ConvertToCodec(wxString &FileName) -{ - wxString empty; - EnqueueAction(AExportWaveFile, FileName, empty); - FileConversionMutex.Unlock(); -} - -bool FileConversion::ConvertSamplerate(wxString &FileName) -{ - bool HasChangedPath; - return ConvertSamplerate(FileName, HasChangedPath); -// EnqueueAction(AConvertSampleRate, FileName, wxString(wxT(""))); -// FileConversionMutex.Unlock(); -} - -bool FileConversion::ConvertSamplerateNoGraph(wxString &FileName) -{ - bool HasChangedPath; - return ConvertSamplerateNoGraph(FileName, HasChangedPath); -// EnqueueAction(AConvertSampleRate, FileName, wxString(wxT(""))); -// FileConversionMutex.Unlock(); -} -bool FileConversion::ConvertSamplerateNoGraph(wxString &FileName, bool &HasChangedPath) -{ - int HasConvertedFile; - - HasConvertedFile = _SampleRateConverter.OpenFileNoGraph(FileName, _Parent); - if (HasConvertedFile == wxID_CANCEL) - return false; - else if (HasConvertedFile == wxID_NO) - return true; - else if (HasConvertedFile == wxID_YES) - { - HasChangedPath = true; - return true; - } - return true; -} -bool FileConversion::ConvertSamplerate(wxString &FileName, bool &HasChangedPath) -{ - int HasConvertedFile; - - HasConvertedFile = _SampleRateConverter.OpenFile(FileName, _Parent); - if (HasConvertedFile == wxID_CANCEL) - return false; - else if (HasConvertedFile == wxID_NO) - return true; - else if (HasConvertedFile == wxID_YES) - { - HasChangedPath = true; - return true; - } - return true; -} - -bool FileConversion::ImportFile(wxString &FileName) -{ - // convert file from current codec to raw data (wav) - if (ConvertFromCodec(FileName)) - { - // if conversion is not canceled, then we import wave file - if (ConvertSamplerate(FileName) == true) - { - ImportWaveFile(FileName); - return (true); - } - } - return (false); -} - -void FileConversion::ImportWaveFile(wxString &FileName) -{ - ImportWavePattern(FileName); -// EnqueueAction(AImportFile, FileName, wxString(wxT(""))); - FileConversionMutex.Unlock(); -} - -void FileConversion::EnqueueAction(FileConversionTypeAction ActionType, wxString &SrcFile, wxString &DstFile) -{ - FileConversionAction *NewAction = new FileConversionAction; - - NewAction->TypeAction = ActionType; - NewAction->SrcFileName = SrcFile; - NewAction->DstFileName = DstFile; - _ActionsList.push_back(NewAction); - FileConversionMutex.Unlock(); -} - -void FileConversion::ImportWavePattern(wxString &FileName) -{ -// wxProgressDialog *Progress = new wxProgressDialog("Loading wave file", "Please wait...", 100, -// NULL, wxPD_AUTO_HIDE | wxPD_CAN_ABORT -// | wxPD_REMAINING_TIME); -// Progress->Update(1); - cActionManager::Global().AddImportWaveAction(FileName, eAudioTrack, true); -// Progress->Update(80); - //CreateUndoRedoMenus(EditMenu); // ?? -// Progress->Update(99); -// delete Progress; -} - -void FileConversion::CopyToWorkingDir(wxString &FileName) -{ - - wxMessageDialog msg(_Parent, _("Do you want to copy this file to your project directory ?"), wxT("Wired"), - wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE); - int res = msg.ShowModal(); - if (res == wxID_OK) - { - wxFileName fn(FileName); - - fn.SetPath(_WorkingDir); - cout << "[FILECONVERT] Will copy File {" << FileName.mb_str() << "} TO {" << fn.GetFullPath().mb_str() << "}" << endl; - if (!wxCopyFile(FileName, fn.GetFullPath())) - { - wxMessageDialog copymsg(_Parent, _("Could not copy file"), wxT("Wired"), wxOK | wxICON_EXCLAMATION | wxCENTRE); - copymsg.ShowModal(); - } - else - FileName = fn.GetFullPath(); - } -} Modified: trunk/wired/src/gui/Makefile.am =================================================================== --- trunk/wired/src/gui/Makefile.am 2009-04-08 22:20:06 UTC (rev 1544) +++ trunk/wired/src/gui/Makefile.am 2009-04-27 19:58:42 UTC (rev 1545) @@ -1,8 +1,29 @@ LDFLAGS = $(shell wx-config --libs) `xml2-config --libs` -# CPPFLAGS = $(shell wx-config --cflags) -I../xml -I../save -I../audio -I../libs/WiredAkai/include -I../plugins -I../fileloader -I/opt/gnome/include -I../sequencer -I../redist -I../engine -I../mixer -I../midi -I../midi/portmidi/pm_common -I../midi/portmidi/porttime -I../asm -I../editmidi -I../undo -I../libs/WiredWidgets/src -I/usr/pkg/include/libxml2/ -I/usr/pkg/include `xml2-config --cflags ` -# XXX merge conflict... -CPPFLAGS = $(shell wx-config --cflags) -I../samplerate -I../xml -I../save -I../audio -I../libs/WiredAkai/include -I../plugins -I../fileloader -I/opt/gnome/include -I../sequencer -I../redist -I../engine -I../mixer -I../midi -I../midi/portmidi/pm_common -I../midi/portmidi/porttime -I../asm -I../editmidi -I../undo -I../libs/WiredWidgets/src -I../wiredvideo -I../codec -I../dssi `xml2-config --cflags ` -I../ +CPPFLAGS = $(shell wx-config --cflags) \ + -I../xml \ + -I../save \ + -I../audio \ + -I../libs/WiredAkai/include \ + -I../plugins \ + -I../fileloader \ + -I../sequencer \ + -I../redist \ + -I../engine \ + -I../mixer \ + -I../midi \ + -I../midi/portmidi/pm_common \ + -I../midi/portmidi/porttime \ + -I../asm \ + -I../editmidi \ + -I../undo \ + -I../libs/WiredWidgets/src \ + -I../wiredvideo \ + -I../dssi \ + -I../codec \ + -I../samplerate \ + `xml2-config --cflags ` \ + -I../ noinst_LIBRARIES = libgui.a @@ -73,8 +94,6 @@ WavePanel.h \ PluginEffect.cpp \ PluginEffect.h \ - FileConversion.h \ - FileConversion.cpp \ FloatingFrame.h \ FloatingFrame.cpp \ ../save/WiredDocument.cpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-04-29 00:04:07
|
Revision: 1547 http://wired.svn.sourceforge.net/wired/?rev=1547&view=rev Author: hdoomsday Date: 2009-04-29 00:03:34 +0000 (Wed, 29 Apr 2009) Log Message: ----------- [UNDO] Added a working undo/redo mechanism: wxCommandProcessor Modified Paths: -------------- trunk/wired/src/gui/MainWindow.cpp trunk/wired/src/gui/MainWindow.h trunk/wired/src/gui/Rack.cpp trunk/wired/src/gui/Rack.h trunk/wired/src/undo/cImportMidiAction.cpp trunk/wired/src/undo/cImportMidiAction.h Modified: trunk/wired/src/gui/MainWindow.cpp =================================================================== --- trunk/wired/src/gui/MainWindow.cpp 2009-04-28 22:15:19 UTC (rev 1546) +++ trunk/wired/src/gui/MainWindow.cpp 2009-04-29 00:03:34 UTC (rev 1547) @@ -6,6 +6,7 @@ #include <wx/progdlg.h> #include <wx/utils.h> #include <wx/splash.h> +#include <wx/cmdproc.h> #include <algorithm> #include "SequencerGui.h" @@ -72,6 +73,7 @@ MediaLibrary *MediaLibraryPanel = NULL; FileConversion *FileConverter = NULL; SettingWindow *SettingsWin = NULL; +wxCommandProcessor *UndoRedo = NULL; wxMutex AudioMutex(wxMUTEX_RECURSIVE); wxCondition *SeqStopped = NULL; @@ -93,6 +95,10 @@ LoadedExternalPlugins = new WiredExternalPluginMgr(); LogWin = new wxLogWindow(this, wxT("Wired log"), false); + // initialize non-audio related stuff: + UndoRedo = new wxCommandProcessor(WiredSettings->maxUndoRedoDepth); + + // initialize audio classes: try { Audio = new AudioEngine(); @@ -160,6 +166,9 @@ // add undo/redo before others menuitem InitUndoRedoMenuItems(); + UndoRedo->SetEditMenu(EditMenu); + EditMenu->Append(wxID_UNDO, _("Undo\tCtrl+Z"))->Enable(false); + EditMenu->Append(wxID_REDO, _("Redo"))->Enable(false); EditMenu->Append(MainWin_Cut, _("C&ut\tCtrl+X")); EditMenu->Append(MainWin_Copy, _("&Copy\tCtrl+C")); EditMenu->Append(MainWin_Paste, _("&Paste\tCtrl+V")); @@ -1163,8 +1172,9 @@ if (p) { cout << "[MAINWIN] Creating rack for plugin: " << p->InitInfo.Name.mb_str() << endl; - cCreateRackAction* action = new cCreateRackAction(&StartInfo, p); - action->Do(); + + CreateRackAction* action = new CreateRackAction(&StartInfo, p); + UndoRedo->Submit(action); } } @@ -1622,6 +1632,16 @@ // cActionManager::Global().AddImportWaveAction(selfile, true, false); } +void MainWindow::OnEditUndo(wxCommandEvent &event) +{ + UndoRedo->Undo(); +} + +void MainWindow::OnEditRedo(wxCommandEvent &event) +{ + UndoRedo->Redo(); +} + void MainWindow::OnUndo(wxCommandEvent &event) { LOG; @@ -2199,6 +2219,8 @@ EVT_MENU(MainWin_MediaLibraryShow, MainWindow::MediaLibraryShow) EVT_MENU(MainWin_SaveML, MainWindow::OnSaveML) EVT_MENU(MainWin_LoadML, MainWindow::OnLoadML) + EVT_MENU(wxID_UNDO, MainWindow::OnEditUndo) + EVT_MENU(wxID_REDO, MainWindow::OnEditRedo) EVT_MENU(MainWin_Undo, MainWindow::OnUndo) EVT_MENU(MainWin_Redo, MainWindow::OnRedo) //EVT_MENU(MainWin_History, MainWindow::OnHistory) @@ -2213,7 +2235,6 @@ EVT_MENU(MainWin_About, MainWindow::OnAbout) EVT_MENU(MainWin_IntHelp, MainWindow::OnIntegratedHelp) EVT_MENU(MainWin_ShowLog, MainWindow::OnShowDebug) - // event EVT_CLOSE(MainWindow::OnClose) EVT_TIMER(MainWin_SeqTimer, MainWindow::OnTimer) Modified: trunk/wired/src/gui/MainWindow.h =================================================================== --- trunk/wired/src/gui/MainWindow.h 2009-04-28 22:15:19 UTC (rev 1546) +++ trunk/wired/src/gui/MainWindow.h 2009-04-29 00:03:34 UTC (rev 1547) @@ -81,6 +81,8 @@ void StartStream(wxCommandEvent &event); void StopStream(wxCommandEvent &event); + void OnEditUndo(wxCommandEvent &event); + void OnEditRedo(wxCommandEvent &event); void OnUndo(wxCommandEvent &event); void OnRedo(wxCommandEvent &event); void OnHistory(wxCommandEvent &event); @@ -267,6 +269,7 @@ MainWin_UndoRedoBeta, MainWin_Undo, MainWin_Redo, + MainWin_UndoRedo, MainWin_History, MainWin_Delete, MainWin_SelectAll, Modified: trunk/wired/src/gui/Rack.cpp =================================================================== --- trunk/wired/src/gui/Rack.cpp 2009-04-28 22:15:19 UTC (rev 1546) +++ trunk/wired/src/gui/Rack.cpp 2009-04-29 00:03:34 UTC (rev 1547) @@ -918,7 +918,7 @@ for (; i > 0; i--) CreateRackTrack(); for (i = 0; i < data.GetCount(); i++) - { + { if (data[i]->getKey() == wxT("RackPlugin")) { #ifdef __DEBUG__ @@ -958,3 +958,28 @@ // EVT_RIGHT_DOWN(Rack::OnClick) // EVT_LEFT_UP(Rack::OnClick) END_EVENT_TABLE() + +/******************** class CreateRackAction ********************/ + +CreateRackAction::CreateRackAction (PlugStartInfo* startInfo, PluginLoader* plugLoader) +: wxCommand(true, HISTORY_LABEL_CREATE_RACK_ACTION) +{ + mPluginLoader = plugLoader; + mStartInfo = startInfo; +} + +bool CreateRackAction::Do () +{ + if (mPluginLoader) + { + _created = RackPanel->AddNewRack(*mStartInfo, mPluginLoader); + return true; + } + return false; +} + +bool CreateRackAction::Undo () +{ + RackPanel->DeleteRack( _created, true ); + return true; +} Modified: trunk/wired/src/gui/Rack.h =================================================================== --- trunk/wired/src/gui/Rack.h 2009-04-28 22:15:19 UTC (rev 1546) +++ trunk/wired/src/gui/Rack.h 2009-04-29 00:03:34 UTC (rev 1547) @@ -6,9 +6,12 @@ #include <wx/wx.h> #include <wx/file.h> +#include <wx/cmdproc.h> #include <list> #include "WiredDocument.h" +#define HISTORY_LABEL_CREATE_RACK_ACTION _("creating rack") + #define UNIT_W (200) #define UNIT_H (100) #define UNIT_S (2) @@ -27,6 +30,22 @@ typedef std::list<RackTrack *> t_ListRackTrack; typedef std::list<Plugin *>::const_iterator t_ListPluginIterator; +/******************** class CreateRackAction ********************/ +class CreateRackAction : public wxCommand +{ +private: + PluginLoader *mPluginLoader; + PlugStartInfo *mStartInfo; + Plugin* _created; + +public: + CreateRackAction (PlugStartInfo*, PluginLoader*); + ~CreateRackAction () {}; + bool Do (); + bool Undo (); + wxString GetName() {return HISTORY_LABEL_CREATE_RACK_ACTION;}; +}; + class RackTrack : public WiredDocument { private: Modified: trunk/wired/src/undo/cImportMidiAction.cpp =================================================================== --- trunk/wired/src/undo/cImportMidiAction.cpp 2009-04-28 22:15:19 UTC (rev 1546) +++ trunk/wired/src/undo/cImportMidiAction.cpp 2009-04-29 00:03:34 UTC (rev 1547) @@ -383,40 +383,3 @@ } return *this; } - -/******************** class cCreateRackAction ********************/ - -cCreateRackAction::cCreateRackAction (PlugStartInfo* startInfo, PluginLoader* plugLoader) -{ - mPluginLoader = plugLoader; - mStartInfo = startInfo; -} - -void cCreateRackAction::Do () -{ - if (mPluginLoader) - { - RackPanel->AddNewRack(*mStartInfo, mPluginLoader); - NotifyActionManager(); - } -} - -void cCreateRackAction::Redo () -{ - Do(); -} - -void cCreateRackAction::Undo () -{ - RackPanel->RemoveLastRackTrack(); -} - -cCreateRackAction cCreateRackAction::operator=(const cCreateRackAction& right) -{ - if (this != &right) - { - mPluginLoader = right.mPluginLoader; - mStartInfo = right.mStartInfo; - } - return *this; -} Modified: trunk/wired/src/undo/cImportMidiAction.h =================================================================== --- trunk/wired/src/undo/cImportMidiAction.h 2009-04-28 22:15:19 UTC (rev 1546) +++ trunk/wired/src/undo/cImportMidiAction.h 2009-04-29 00:03:34 UTC (rev 1547) @@ -15,7 +15,6 @@ #define HISTORY_LABEL_IMPORT_WAVE_ACTION _("importing wave") #define HISTORY_LABEL_IMPORT_MIDI_ACTION _("importing midi") #define HISTORY_LABEL_IMPORT_AKAI_ACTION _("importing AKAI") -#define HISTORY_LABEL_CREATE_RACK_ACTION _("creating rack") #define HISTORY_LABEL_CHANGE_PARAM_EFFECT_ACTION _("changing rack effect parameters") #define INVALID_VALUE -42 @@ -160,28 +159,6 @@ }; -/******************** class cCreateRackAction ********************/ -class cCreateRackAction : public cAction -{ -private: - PluginLoader *mPluginLoader; - PlugStartInfo *mStartInfo; - -public: - cCreateRackAction (PlugStartInfo* startInfo, PluginLoader* plugLoader); - cCreateRackAction (const cCreateRackAction& copy){*this = copy;}; - ~cCreateRackAction () {}; - virtual void Do (); - virtual void Redo (); - virtual void Undo (); - virtual void Accept (cActionVisitor& visitor) - { visitor.Visit (*this); }; - virtual const wxString getHistoryLabel() // Returns History label wstring - {return HISTORY_LABEL_CREATE_RACK_ACTION;}; - - cCreateRackAction operator=(const cCreateRackAction& right); -}; - #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-05-05 19:42:47
|
Revision: 1549 http://wired.svn.sourceforge.net/wired/?rev=1549&view=rev Author: hdoomsday Date: 2009-05-05 19:42:36 +0000 (Tue, 05 May 2009) Log Message: ----------- [CLEAN] moved RackTrack class in a seperate source file Modified Paths: -------------- trunk/wired/src/editmidi/Makefile.am trunk/wired/src/gui/MainWindow.cpp trunk/wired/src/gui/Makefile.am trunk/wired/src/gui/Rack.cpp trunk/wired/src/gui/Rack.h trunk/wired/src/gui/SeqTrack.h trunk/wired/src/sequencer/Makefile.am Added Paths: ----------- trunk/wired/src/gui/RackTrack.cpp trunk/wired/src/gui/RackTrack.h Modified: trunk/wired/src/editmidi/Makefile.am =================================================================== --- trunk/wired/src/editmidi/Makefile.am 2009-04-29 21:59:15 UTC (rev 1548) +++ trunk/wired/src/editmidi/Makefile.am 2009-05-05 19:42:36 UTC (rev 1549) @@ -1,6 +1,26 @@ LDFLAGS = $(shell wx-config --libs) `xml2-config --libs` -CPPFLAGS = $(shell wx-config --cflags) -I../gui -I../plugins -I../fileloader -I../sequencer -I../redist -I../audio -I../engine -I../mixer -I../midi -I../midi/portmidi/pm_common -I../midi/portmidi/porttime -I../undo -I../libs/WiredWidgets/src -I../save -I../wiredvideo -I../samplerate -I../codec -I../xml `xml2-config --cflags` +CPPFLAGS = $(shell wx-config --cflags) \ + -I../gui \ + -I../plugins \ + -I../fileloader \ + -I../sequencer \ + -I../redist \ + -I../audio \ + -I../engine \ + -I../mixer \ + -I../midi \ + -I../midi/portmidi/pm_common \ + -I../midi/portmidi/porttime \ + -I../undo \ + -I../libs/WiredWidgets/src \ + -I../save \ + -I../wiredvideo \ + -I../samplerate \ + -I../codec \ + -I../xml \ + -I../dssi \ + `xml2-config --cflags` if PORTMIDI CPPFLAGS += -I../midi/portmidi/pm_common -I../midi/portmidi/porttime Modified: trunk/wired/src/gui/MainWindow.cpp =================================================================== --- trunk/wired/src/gui/MainWindow.cpp 2009-04-29 21:59:15 UTC (rev 1548) +++ trunk/wired/src/gui/MainWindow.cpp 2009-05-05 19:42:36 UTC (rev 1549) @@ -20,6 +20,7 @@ #include "Transport.h" #include "OptionPanel.h" #include "Rack.h" +#include "RackTrack.h" #include "SeqTrack.h" #include "MixerGui.h" #include "DownButton.h" Modified: trunk/wired/src/gui/Makefile.am =================================================================== --- trunk/wired/src/gui/Makefile.am 2009-04-29 21:59:15 UTC (rev 1548) +++ trunk/wired/src/gui/Makefile.am 2009-05-05 19:42:36 UTC (rev 1549) @@ -66,6 +66,8 @@ Pattern.h \ Rack.cpp \ Rack.h \ + RackTrack.cpp \ + RackTrack.h \ Ruler.cpp \ Ruler.h \ SeqTrack.cpp \ Modified: trunk/wired/src/gui/Rack.cpp =================================================================== --- trunk/wired/src/gui/Rack.cpp 2009-04-29 21:59:15 UTC (rev 1548) +++ trunk/wired/src/gui/Rack.cpp 2009-05-05 19:42:36 UTC (rev 1549) @@ -23,169 +23,6 @@ #endif -/******************** Class RackTrack ********************/ - -RackTrack::RackTrack(Rack *parent, int index) - : WiredDocument(wxT("RackTrack"), (WiredDocument*)parent) -{ - wxString s; - - Parent = parent; - Index = index; - Units = 0; - CurrentBuffer = 0x0; - s.Printf(_("Rack %d"), index + 1); - - Output = Mix->AddChannel(false, true, true); - ChanGui = MixerPanel->AddChannel(Output, s); -} - -RackTrack::~RackTrack() -{ - DeleteAllRacks(); - RemoveChannel(); -} - -void RackTrack::RemoveChannel() -{ - MixerPanel->RemoveChannel(ChanGui); - Mix->RemoveChannel(Output); -} - -Plugin* RackTrack::CreateRack(PlugStartInfo &startinfo, PluginLoader *p) -{ - int xx, yy, xpos, ypos; - static int num = 31000; - Plugin *plug; - - xpos = Parent->GetXPos(Index); - ypos = GetYPos(); - - Parent->CalcScrolledPosition(xpos, ypos, &xx, &yy); - startinfo.Pos = wxPoint(xx, yy); - startinfo.Size = wxSize(p->InitInfo.UnitsX * UNIT_W, p->InitInfo.UnitsY * UNIT_H); - startinfo.saveCenter = saveCenter; - startinfo.parent = this; - plug = p->CreateRack(startinfo); - - if (!plug) - return (NULL); - - if (p->InitInfo.UnitsX > Units) - Units = p->InitInfo.UnitsX; - - // Plug initialization - plug->SetId(num++); - plug->SetBufferSize(Audio->SamplesPerBuffer); - plug->SetSamplingRate(Audio->SampleRate); - plug->Init(); - plug->SetHelpMode(HelpWin->IsShown()); - - if (Seq->Playing) - plug->Play(); - - wxChar str[128]; - wxSnprintf(str, 128, wxT("%d"), ++RackCount); - plug->Name = plug->DefaultName() + wxT(" ") + str; - AddRack(plug); - Parent->ResizeTracks(); - Parent->SetScrolling(); - return (plug); -} - -void RackTrack::SetSelected(Plugin *plugin) -{ - /* - //Dump(); - Racks.remove(SelectedPlugin); - //Dump(); - SelectedPlugin->Hide(); - SeqPanel->RemoveReferenceTo(SelectedPlugin); - //delete SelectedPlugin; - Parent->ResizeTracks(); - Parent->SetScrolling(); - */ - SelectedPlugin = plugin; -} - -void RackTrack::AddRack(Plugin* plug) -{ - wxMutexLocker locker(SeqMutex); - - Racks.push_back(plug); -} - -void RackTrack::RemoveSelectedRack() -{ - Racks.remove(SelectedPlugin); - - SelectedPlugin->Hide(); - SeqPanel->RemoveReferenceTo(SelectedPlugin); - - Parent->ResizeTracks(); -} - -void RackTrack::DeleteAllRacks() -{ - list<Plugin *>::iterator j; - - for (j = Racks.begin(); j != Racks.end(); j++) - { - OptPanel->ClosePlug(*j); - SeqPanel->RemoveReferenceTo(*j); - delete *j; - } - Units = 0; - Racks.clear(); -} - -int RackTrack::GetYPos() -{ - int u = 0; - list<Plugin *>::iterator i; - - for (i = Racks.begin(); i != Racks.end(); i++) - u += (*i)->InitInfo->UnitsY; - return (u * (UNIT_H + UNIT_S)); -} - -void RackTrack::Dump() -{ - cout << " Dumping RackTrack at adress " << this << endl; - cout << " int Units : " << Units << endl; - cout << " Rack* Parent : " << Parent << endl; - cout << " int index : " << Index << endl; - cout << " Channel Output : " << Output << endl; - cout << " ChannelGui* ChanGui : " << ChanGui << endl; - cout << " float **CurrentBuffer : " << CurrentBuffer << endl; - DumpPlugins(); - cout << " End Dumping RackTrack" << endl; -} - -void RackTrack::DumpPlugins() -{ - list<Plugin *>::iterator iterRack; - - for (iterRack = Racks.begin(); iterRack != Racks.end(); iterRack++) - { - cout << " Dumping Plugin at adress " << (*iterRack) << endl; - cout << " Position x : " << (*iterRack)->GetPosition().x << endl; - cout << " Position y : " << (*iterRack)->GetPosition().y << endl; - cout << " Virtual size x : " << (*iterRack)->GetVirtualSize().x << endl; - cout << " Virtual size y : " << (*iterRack)->GetVirtualSize().y << endl; - cout << " End dumping Plugin" << endl; - } -} - -void RackTrack::Save() -{ -} - -void RackTrack::Load(SaveElementArray data) -{ - -} - /******************** Class Rack ********************/ Rack::Rack(wxWindow* parent, wxWindowID id, const wxPoint& pos, Modified: trunk/wired/src/gui/Rack.h =================================================================== --- trunk/wired/src/gui/Rack.h 2009-04-29 21:59:15 UTC (rev 1548) +++ trunk/wired/src/gui/Rack.h 2009-05-05 19:42:36 UTC (rev 1549) @@ -9,6 +9,7 @@ #include <wx/cmdproc.h> #include <list> #include "WiredDocument.h" +#include "RackTrack.h" #define UNIT_W (200) #define UNIT_H (100) @@ -56,45 +57,7 @@ bool Undo(); }; -class RackTrack : public WiredDocument -{ - private: - void RemoveChannel(); - void DeleteAllRacks(); -public: - RackTrack(Rack *parent, int index); - virtual ~RackTrack(); - - // WiredDocument implementation - void Save(); - void Load(SaveElementArray data); - - void AddRack(Plugin* plug); - Plugin* CreateRack(PlugStartInfo &startinfo, PluginLoader *p); - void DeleteRack(Plugin *plug); - int GetYPos(); - void RemoveSelectedRack(); - void SetSelected(Plugin *plugin); - int NbRacks(){return Racks.size();}; - RackTrack operator=(const RackTrack& right); - //void SetSelected(Plugin *plugin); - //int NbRacks(){return Racks.size();}; - // Debug - Shows member variables - // Pas du tout objet, mais plus simple pour l'instant (ca permet de ne pas changer - // l'API du plugin qui va de tte maniere l'etre pour les DSSI) - void Dump(); - void DumpPlugins(); - Plugin* SelectedPlugin; - int Units; - Rack* Parent; - int Index; - std::list<Plugin *> Racks; - Channel* Output; - ChannelGui* ChanGui; - float** CurrentBuffer; -}; - class Rack: public wxScrolledWindow, WiredDocument { public: Added: trunk/wired/src/gui/RackTrack.cpp =================================================================== --- trunk/wired/src/gui/RackTrack.cpp (rev 0) +++ trunk/wired/src/gui/RackTrack.cpp 2009-05-05 19:42:36 UTC (rev 1549) @@ -0,0 +1,172 @@ +// Copyright (C) 2004-2009 by Wired Team +// Under the GNU General Public License Version 2, June 1991 + +#include "RackTrack.h" +#include "Mixer.h" +#include "MixerGui.h" +#include "HelpPanel.h" +#include "OptionPanel.h" +#include "Sequencer.h" + +/******************** Class RackTrack ********************/ + +RackTrack::RackTrack(Rack *parent, int index) + : WiredDocument(wxT("RackTrack"), (WiredDocument*)parent) +{ + wxString s; + + Parent = parent; + Index = index; + Units = 0; + CurrentBuffer = 0x0; + s.Printf(_("Rack %d"), index + 1); + + Output = Mix->AddChannel(false, true, true); + ChanGui = MixerPanel->AddChannel(Output, s); +} + +RackTrack::~RackTrack() +{ + DeleteAllRacks(); + RemoveChannel(); +} + +void RackTrack::RemoveChannel() +{ + MixerPanel->RemoveChannel(ChanGui); + Mix->RemoveChannel(Output); +} + +Plugin* RackTrack::CreateRack(PlugStartInfo &startinfo, PluginLoader *p) +{ + int xx, yy, xpos, ypos; + static int num = 31000; + Plugin *plug; + + xpos = Parent->GetXPos(Index); + ypos = GetYPos(); + + Parent->CalcScrolledPosition(xpos, ypos, &xx, &yy); + startinfo.Pos = wxPoint(xx, yy); + startinfo.Size = wxSize(p->InitInfo.UnitsX * UNIT_W, p->InitInfo.UnitsY * UNIT_H); + startinfo.saveCenter = saveCenter; + startinfo.parent = this; + plug = p->CreateRack(startinfo); + + if (!plug) + return (NULL); + + if (p->InitInfo.UnitsX > Units) + Units = p->InitInfo.UnitsX; + + // Plug initialization + plug->SetId(num++); + plug->SetBufferSize(Audio->SamplesPerBuffer); + plug->SetSamplingRate(Audio->SampleRate); + plug->Init(); + plug->SetHelpMode(HelpWin->IsShown()); + + if (Seq->Playing) + plug->Play(); + + wxChar str[128]; + wxSnprintf(str, 128, wxT("%d"), ++RackCount); + plug->Name = plug->DefaultName() + wxT(" ") + str; + AddRack(plug); + Parent->ResizeTracks(); + Parent->SetScrolling(); + return (plug); +} + +void RackTrack::SetSelected(Plugin *plugin) +{ + /* + //Dump(); + Racks.remove(SelectedPlugin); + //Dump(); + SelectedPlugin->Hide(); + SeqPanel->RemoveReferenceTo(SelectedPlugin); + //delete SelectedPlugin; + Parent->ResizeTracks(); + Parent->SetScrolling(); + */ + SelectedPlugin = plugin; +} + +void RackTrack::AddRack(Plugin* plug) +{ + wxMutexLocker locker(SeqMutex); + + Racks.push_back(plug); +} + +void RackTrack::RemoveSelectedRack() +{ + Racks.remove(SelectedPlugin); + + SelectedPlugin->Hide(); + SeqPanel->RemoveReferenceTo(SelectedPlugin); + + Parent->ResizeTracks(); +} + +void RackTrack::DeleteAllRacks() +{ + list<Plugin *>::iterator j; + + for (j = Racks.begin(); j != Racks.end(); j++) + { + OptPanel->ClosePlug(*j); + SeqPanel->RemoveReferenceTo(*j); + delete *j; + } + Units = 0; + Racks.clear(); +} + +int RackTrack::GetYPos() +{ + int u = 0; + list<Plugin *>::iterator i; + + for (i = Racks.begin(); i != Racks.end(); i++) + u += (*i)->InitInfo->UnitsY; + return (u * (UNIT_H + UNIT_S)); +} + +void RackTrack::Dump() +{ + cout << " Dumping RackTrack at adress " << this << endl; + cout << " int Units : " << Units << endl; + cout << " Rack* Parent : " << Parent << endl; + cout << " int index : " << Index << endl; + cout << " Channel Output : " << Output << endl; + cout << " ChannelGui* ChanGui : " << ChanGui << endl; + cout << " float **CurrentBuffer : " << CurrentBuffer << endl; + DumpPlugins(); + cout << " End Dumping RackTrack" << endl; +} + +void RackTrack::DumpPlugins() +{ + list<Plugin *>::iterator iterRack; + + for (iterRack = Racks.begin(); iterRack != Racks.end(); iterRack++) + { + cout << " Dumping Plugin at adress " << (*iterRack) << endl; + cout << " Position x : " << (*iterRack)->GetPosition().x << endl; + cout << " Position y : " << (*iterRack)->GetPosition().y << endl; + cout << " Virtual size x : " << (*iterRack)->GetVirtualSize().x << endl; + cout << " Virtual size y : " << (*iterRack)->GetVirtualSize().y << endl; + cout << " End dumping Plugin" << endl; + } +} + +void RackTrack::Save() +{ +} + +void RackTrack::Load(SaveElementArray data) +{ + +} Added: trunk/wired/src/gui/RackTrack.h =================================================================== --- trunk/wired/src/gui/RackTrack.h (rev 0) +++ trunk/wired/src/gui/RackTrack.h 2009-05-05 19:42:36 UTC (rev 1549) @@ -0,0 +1,63 @@ +// Copyright (C) 2004-2009 by Wired Team +// Under the GNU General Public License Version 2, June 1991 + +#ifndef __RACKTRACK_H__ +#define __RACKTRACK_H__ + +#include <wx/wxprec.h> +#ifndef WX_PRECOMP + #include <wx/wx.h> +#endif + +#include <list> + +#include "Channel.h" +#include "ChannelGui.h" +#include "WiredDocument.h" +#include "Plugin.h" +#include "PluginLoader.h" + +#include "Rack.h" + +class Rack; + +class RackTrack : public WiredDocument +{ + private: + void RemoveChannel(); + void DeleteAllRacks(); + +public: + RackTrack(Rack *parent, int index); + virtual ~RackTrack(); + + // WiredDocument implementation + void Save(); + void Load(SaveElementArray data); + + void AddRack(Plugin* plug); + Plugin* CreateRack(PlugStartInfo &startinfo, PluginLoader *p); + void DeleteRack(Plugin *plug); + int GetYPos(); + void RemoveSelectedRack(); + void SetSelected(Plugin *plugin); + int NbRacks(){return Racks.size();}; + RackTrack operator=(const RackTrack& right); + //void SetSelected(Plugin *plugin); + //int NbRacks(){return Racks.size();}; + // Debug - Shows member variables + // Pas du tout objet, mais plus simple pour l'instant (ca permet de ne pas changer + // l'API du plugin qui va de tte maniere l'etre pour les DSSI) + void Dump(); + void DumpPlugins(); + Plugin* SelectedPlugin; + int Units; + Rack* Parent; + int Index; + std::list<Plugin *> Racks; + Channel* Output; + ChannelGui* ChanGui; + float** CurrentBuffer; +}; + +#endif // __RACKTRACK_H__ Modified: trunk/wired/src/gui/SeqTrack.h =================================================================== --- trunk/wired/src/gui/SeqTrack.h 2009-04-29 21:59:15 UTC (rev 1548) +++ trunk/wired/src/gui/SeqTrack.h 2009-05-05 19:42:36 UTC (rev 1549) @@ -9,6 +9,7 @@ #include <wx/wx.h> #endif +#include "RackTrack.h" #include "Track.h" #include "WiredDocument.h" Modified: trunk/wired/src/sequencer/Makefile.am =================================================================== --- trunk/wired/src/sequencer/Makefile.am 2009-04-29 21:59:15 UTC (rev 1548) +++ trunk/wired/src/sequencer/Makefile.am 2009-05-05 19:42:36 UTC (rev 1549) @@ -1,6 +1,29 @@ LDFLAGS = $(shell wx-config --libs) -L/usr/pkg/lib/ `xml2-config --libs` -CPPFLAGS = $(shell wx-config --cflags) -I../xml -I../save -I../gui -I../libs/WiredAkai/include -I../plugins -I../fileloader -I../audio -I../redist -I../engine -I../mixer -I../midi -I../midi/portmidi/pm_common -I../midi/portmidi/porttime -I../asm -I../editmidi -I../undo -I.. -I../libs/WiredWidgets/src -I../wiredvideo -I../samplerate -I../codec `xml2-config --cflags` +CPPFLAGS = $(shell wx-config --cflags) \ + -I../xml \ + -I../save \ + -I../gui \ + -I../libs/WiredAkai/include \ + -I../plugins \ + -I../fileloader \ + -I../audio \ + -I../redist \ + -I../engine \ + -I../mixer \ + -I../midi \ + -I../midi/portmidi/pm_common \ + -I../midi/portmidi/porttime \ + -I../asm \ + -I../editmidi \ + -I../undo \ + -I.. \ + -I../libs/WiredWidgets/src \ + -I../wiredvideo \ + -I../samplerate \ + -I../codec \ + -I../dssi \ + `xml2-config --cflags` noinst_LIBRARIES = libsequencer.a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-05-09 22:06:47
|
Revision: 1552 http://wired.svn.sourceforge.net/wired/?rev=1552&view=rev Author: hdoomsday Date: 2009-05-09 22:06:44 +0000 (Sat, 09 May 2009) Log Message: ----------- [COMPIL] added -rpath: no more LD_LIBRARY_PATH is needed Modified Paths: -------------- trunk/wired/src/Makefile.am trunk/wired/src/gui/MainWindow.cpp trunk/wired/src/gui/Rack.cpp trunk/wired/src/libs/WiredAkai/src/Makefile.am trunk/wired/src/libs/WiredWidgets/src/Makefile.am trunk/wired/src/sequencer/Sequencer.cpp Modified: trunk/wired/src/Makefile.am =================================================================== --- trunk/wired/src/Makefile.am 2009-05-09 21:11:30 UTC (rev 1551) +++ trunk/wired/src/Makefile.am 2009-05-09 22:06:44 UTC (rev 1552) @@ -31,6 +31,7 @@ @SAMPLERATE_LIBS@ \ -lsndfile \ -Lfileloader -lfileloader \ + -rpath ${libdir}/wired \ $(DEPS_LIBS) wired_CPPFLAGS = $(shell wx-config --cflags) \ Modified: trunk/wired/src/gui/MainWindow.cpp =================================================================== --- trunk/wired/src/gui/MainWindow.cpp 2009-05-09 21:11:30 UTC (rev 1551) +++ trunk/wired/src/gui/MainWindow.cpp 2009-05-09 22:06:44 UTC (rev 1552) @@ -359,7 +359,7 @@ wxGetApp().m_threads.Add(Seq); SeqTimer = new wxTimer(this, MainWin_SeqTimer); - SeqTimer->Start(40); + SeqTimer->Start(3000); WindowSize = MainWin->GetSize(); WindowPos = MainWin->GetPosition(); Modified: trunk/wired/src/gui/Rack.cpp =================================================================== --- trunk/wired/src/gui/Rack.cpp 2009-05-09 21:11:30 UTC (rev 1551) +++ trunk/wired/src/gui/Rack.cpp 2009-05-09 22:06:44 UTC (rev 1552) @@ -858,6 +858,7 @@ bool DeleteRackAction::Do () { + _deleted->Hide(); return RackPanel->DeleteRack( _deleted, false ); } Modified: trunk/wired/src/libs/WiredAkai/src/Makefile.am =================================================================== --- trunk/wired/src/libs/WiredAkai/src/Makefile.am 2009-05-09 21:11:30 UTC (rev 1551) +++ trunk/wired/src/libs/WiredAkai/src/Makefile.am 2009-05-09 22:06:44 UTC (rev 1552) @@ -4,5 +4,5 @@ pkglib_LTLIBRARIES = libWiredAkai.la -libWiredAkai_la_LDFLAGS = -version-info @LIB_WIREDAKAI_VERSION@ +libWiredAkai_la_LDFLAGS = -rpath ${libdir}/wired -version-info @LIB_WIREDAKAI_VERSION@ libWiredAkai_la_SOURCES = akai.cpp list.cpp Modified: trunk/wired/src/libs/WiredWidgets/src/Makefile.am =================================================================== --- trunk/wired/src/libs/WiredWidgets/src/Makefile.am 2009-05-09 21:11:30 UTC (rev 1551) +++ trunk/wired/src/libs/WiredWidgets/src/Makefile.am 2009-05-09 22:06:44 UTC (rev 1552) @@ -4,7 +4,7 @@ pkglib_LTLIBRARIES = libWiredWidgets.la -libWiredWidgets_la_LDFLAGS = -version-info @LIB_WIREDWIDGETS_VERSION@ +libWiredWidgets_la_LDFLAGS = -rpath ${libdir}/wired -version-info @LIB_WIREDWIDGETS_VERSION@ libWiredWidgets_la_SOURCES = \ ChoiceButton.cpp \ ChoiceButton.h \ Modified: trunk/wired/src/sequencer/Sequencer.cpp =================================================================== --- trunk/wired/src/sequencer/Sequencer.cpp 2009-05-09 21:11:30 UTC (rev 1551) +++ trunk/wired/src/sequencer/Sequencer.cpp 2009-05-09 22:06:44 UTC (rev 1552) @@ -137,17 +137,13 @@ { if (((*MidiMsg)->Msg[0] == M_START) || ((*MidiMsg)->Msg[0] == M_CONT)) { - SeqMutex.Unlock(); Play(); Yield(); - SeqMutex.Lock(); } else if ((*MidiMsg)->Msg[0] == M_STOP) { - SeqMutex.Unlock(); Stop(); Yield(); - SeqMutex.Lock(); } else for (T = Tracks.begin(); T != Tracks.end(); T++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kik...@us...> - 2009-05-25 20:32:25
|
Revision: 1557 http://wired.svn.sourceforge.net/wired/?rev=1557&view=rev Author: kiketloule Date: 2009-05-25 20:31:57 +0000 (Mon, 25 May 2009) Log Message: ----------- [UNDO] Added CreateEffectAction Modified Paths: -------------- trunk/wired/src/gui/MainWindow.cpp trunk/wired/src/gui/PluginEffect.cpp trunk/wired/src/gui/PluginEffect.h trunk/wired/src/undo/cActionManager.cpp trunk/wired/src/undo/cActionManager.h trunk/wired/src/undo/cImportMidiAction.cpp trunk/wired/src/undo/cImportMidiAction.h Modified: trunk/wired/src/gui/MainWindow.cpp =================================================================== --- trunk/wired/src/gui/MainWindow.cpp 2009-05-20 06:51:26 UTC (rev 1556) +++ trunk/wired/src/gui/MainWindow.cpp 2009-05-25 20:31:57 UTC (rev 1557) @@ -21,6 +21,7 @@ #include "OptionPanel.h" #include "Rack.h" #include "RackTrack.h" +#include "PluginEffect.h" #include "SeqTrack.h" #include "MixerGui.h" #include "DownButton.h" @@ -1157,11 +1158,17 @@ LOG; if (LoadedExternalPlugins) { + wxString label = _("creating "); cout << "[MAINWIN] Creating rack for plugin id :" << event.GetId() << endl; PluginLoader *NewPlugin = new PluginLoader(LoadedExternalPlugins, event.GetId(), StartInfo); + label += NewPlugin->InitInfo.Name; - LoadedPluginsList.push_back(NewPlugin); - cActionManager::Global().AddEffectAction(&StartInfo, NewPlugin, true); + if(NewPlugin) + { + LoadedPluginsList.push_back(NewPlugin); + CreateEffectAction *action = new CreateEffectAction(label, &StartInfo, NewPlugin); + UndoRedo->Submit(action); + } } } @@ -1204,9 +1211,12 @@ } if (p) { + wxString label = _("creating "); cout << "[MAINWIN] Creating rack for plugin: " << p->InitInfo.Name.mb_str() << endl; - cActionManager::Global().AddEffectAction(&StartInfo, p, true); - CreateUndoRedoMenus(EditMenu); + + label += p->InitInfo.Name; + CreateEffectAction* action = new CreateEffectAction(label, &StartInfo, p); + UndoRedo->Submit(action); } } Modified: trunk/wired/src/gui/PluginEffect.cpp =================================================================== --- trunk/wired/src/gui/PluginEffect.cpp 2009-05-20 06:51:26 UTC (rev 1556) +++ trunk/wired/src/gui/PluginEffect.cpp 2009-05-25 20:31:57 UTC (rev 1557) @@ -8,10 +8,13 @@ #include <math.h> #include "PluginEffect.h" +#include "Rack.h" + using namespace std; /* DO NOT MODIFY THIS FILE FOR MAKING A PLUGIN. JUST DERIVE FROM THAT CLASS */ + PluginEffect::PluginEffect() { @@ -79,3 +82,30 @@ } +/******************** class cCreateEffectAction ********************/ + +CreateEffectAction::CreateEffectAction (wxString& label, PlugStartInfo* startInfo, PluginLoader* plugLoader) + : wxCommand(true, label) +{ + mPluginLoader = plugLoader; + mStartInfo = startInfo; +} + +bool CreateEffectAction::Do () +{ + bool ret = false; + + if (mPluginLoader) + { + _created = RackPanel->AddNewRack(*mStartInfo, mPluginLoader); + ret = true; + } + + return ret; +} + +bool CreateEffectAction::Undo () +{ + RackPanel->DeleteRack(_created, true); + return true; +} Modified: trunk/wired/src/gui/PluginEffect.h =================================================================== --- trunk/wired/src/gui/PluginEffect.h 2009-05-20 06:51:26 UTC (rev 1556) +++ trunk/wired/src/gui/PluginEffect.h 2009-05-25 20:31:57 UTC (rev 1557) @@ -7,8 +7,33 @@ #include "WaveFile.h" #include <wx/wx.h> #include <wx/textdlg.h> +#include <wx/cmdproc.h> +class PluginLoader; +class Plugin; +typedef struct s_PlugStartInfo PlugStartInfo; +/******************** class CreateEffectAction ********************/ + +class CreateEffectAction : public wxCommand +{ +private: + PluginLoader *mPluginLoader; // Contexte + PlugStartInfo *mStartInfo; // Contexte + + Plugin* _created; + +public: + CreateEffectAction (wxString& label, PlugStartInfo* startInfo, PluginLoader * plugin); + ~CreateEffectAction () {}; + + bool Do (); + bool Undo (); +}; + + +/******************** class PluginEffect ********************/ + class PluginEffect { public: Modified: trunk/wired/src/undo/cActionManager.cpp =================================================================== --- trunk/wired/src/undo/cActionManager.cpp 2009-05-20 06:51:26 UTC (rev 1556) +++ trunk/wired/src/undo/cActionManager.cpp 2009-05-25 20:31:57 UTC (rev 1557) @@ -30,12 +30,6 @@ return *spSingleton; } -void cActionManager::AddEffectAction(PlugStartInfo* startInfo, PluginLoader* plugLoader, bool shouldAdd) -{ - cCreateEffectAction* action = new cCreateEffectAction(startInfo, plugLoader, shouldAdd); - action->Do(); -} - void cActionManager::AddImportWaveAction(const wxString& path, trackType kind, bool selectFromIndex) { cImportWaveAction* action = new cImportWaveAction(path, kind, selectFromIndex); Modified: trunk/wired/src/undo/cActionManager.h =================================================================== --- trunk/wired/src/undo/cActionManager.h 2009-05-20 06:51:26 UTC (rev 1556) +++ trunk/wired/src/undo/cActionManager.h 2009-05-25 20:31:57 UTC (rev 1557) @@ -75,9 +75,6 @@ bool Redo(int id); // Refait la derniere action annulee bool Undo(int id); // Annule la derniere action effectuee void Dump(); // Debug - Dump les donnees membres - void AddEffectAction(PlugStartInfo* startInfo, // Adds a cEffectAction in cActionManager - PluginLoader* plugLoader, - bool shouldAdd); void AddChangeParamsEffectAction(Plugin* plugin, bool shouldSave); // Adds a cChangeParamsEffectAction in cActionManager void AddImportWaveAction(const wxString& path, trackType kind, bool selectFromIndex); // Adds a cImportWaveAction in cActionManager Modified: trunk/wired/src/undo/cImportMidiAction.cpp =================================================================== --- trunk/wired/src/undo/cImportMidiAction.cpp 2009-05-20 06:51:26 UTC (rev 1556) +++ trunk/wired/src/undo/cImportMidiAction.cpp 2009-05-25 20:31:57 UTC (rev 1557) @@ -296,90 +296,3 @@ } return *this; } - -/******************** class cCreateEffectAction ********************/ - -cCreateEffectAction::cCreateEffectAction (PlugStartInfo* startInfo, PluginLoader* plugLoader, - bool shouldAdd) -{ - mPluginLoader = plugLoader; - mStartInfo = startInfo; - mShouldAdd = shouldAdd; - mRackIndex = INVALID_VALUE; -} - -void cCreateEffectAction::Do () -{ - if (mShouldAdd == true) - AddRackEffect(); - else - RemoveRackEffect(); -} - -void cCreateEffectAction::Redo () -{ - Do(); -} - -void cCreateEffectAction::Undo () -{ - if (mShouldAdd == true) - RemoveRackEffect(); - else - AddRackEffect(); -} - -void cCreateEffectAction::AddRackEffect () -{ - if (mPluginLoader) - { - if (mRackIndex < 0) - mRackIndex = RackPanel->RackTracks.size(); - - if (RackPanel->AddNewRack(*mStartInfo, mPluginLoader)) - NotifyActionManager(); - } -} - -const wxString cCreateEffectAction::getHistoryLabel() -{ - wxString result; - - result = HISTORY_LABEL_CREATE_EFFECT_ACTION; - result += wxT(" "); - result += mPluginLoader->InitInfo.Name; - return result; -} - -void cCreateEffectAction::RemoveRackEffect () -{ - if (mRackIndex < 0) - RackPanel->RemoveSelectedRackTrack(); - else - RackPanel->RemoveRackTrack(mRackIndex); - // TODO: Should be identified by StartInfo and PluginLoader - // TODO bis : must delete this undo engine... - NotifyActionManager(); -} - -void cCreateEffectAction::Dump() -{ - std::cout << " Dumping cCreateEffectAction : " << this << std::endl; - std::cout << " PluginLoader *mPluginLoader : " << mPluginLoader << std::endl; - std::cout << " PlugStartInfo *mStartInfo : " << mStartInfo << std::endl; - std::cout << " bool mShouldAdd : " << mShouldAdd << std::endl; - cAction::Dump(); - std::cout << " End Dumping cCreateEffectAction" << std::endl; -} - -cCreateEffectAction cCreateEffectAction::operator=(const cCreateEffectAction& right) -{ - if (this != &right) - { - mPluginLoader = right.mPluginLoader; - mStartInfo = right.mStartInfo; - mShouldAdd = right.mShouldAdd; - mRackIndex = right.mRackIndex; - } - return *this; -} Modified: trunk/wired/src/undo/cImportMidiAction.h =================================================================== --- trunk/wired/src/undo/cImportMidiAction.h 2009-05-20 06:51:26 UTC (rev 1556) +++ trunk/wired/src/undo/cImportMidiAction.h 2009-05-25 20:31:57 UTC (rev 1557) @@ -129,36 +129,5 @@ cChangeParamsEffectAction operator=(const cChangeParamsEffectAction& right); }; - -/******************** class cCreateEffectAction ********************/ - -class cCreateEffectAction : public cAction -{ -private: - PluginLoader *mPluginLoader; // Contexte - PlugStartInfo *mStartInfo; // Contexte - bool mShouldAdd; // True if should add in Do() - int mRackIndex; // Index du rack dans le RackPanel - Abandonne car remove casse les index dsna RackTracks - //RackTrack *mRackTrack; // Effect instance - -public: - cCreateEffectAction (PlugStartInfo* startInfo, PluginLoader * plugin, bool shouldAdd); - cCreateEffectAction (const cCreateEffectAction& copy){*this = copy;}; - ~cCreateEffectAction () {}; - virtual void Do (); // Does action - virtual void Redo (); // Does redo action - virtual void Undo (); // Does undo action - virtual void Accept // Don't known - (cActionVisitor& visitor) { visitor.Visit (*this); }; - virtual const wxString getHistoryLabel(); // Returns History label wstring - void AddRackEffect (); // Adds a rack effect - void RemoveRackEffect (); // Removes a rack effect - void Dump(); // Debug - Draws member variables - - cCreateEffectAction operator=(const cCreateEffectAction& right); -}; - - - #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2009-08-28 15:49:59
|
Revision: 1562 http://wired.svn.sourceforge.net/wired/?rev=1562&view=rev Author: hdoomsday Date: 2009-08-28 15:49:51 +0000 (Fri, 28 Aug 2009) Log Message: ----------- [COMPAT] Added compat for win32. Wired can load plugins. Modified Paths: -------------- trunk/wired/src/engine/Settings.cpp trunk/wired/src/engine/Settings.h trunk/wired/src/plugins/PluginLoader.cpp Modified: trunk/wired/src/engine/Settings.cpp =================================================================== --- trunk/wired/src/engine/Settings.cpp 2009-08-28 15:39:01 UTC (rev 1561) +++ trunk/wired/src/engine/Settings.cpp 2009-08-28 15:49:51 UTC (rev 1562) @@ -25,9 +25,17 @@ #ifdef _WIN32 // exemple : C:\\path\\wired_exe_install_dir\\conf ConfDir = wxStandardPaths::Get().GetDataDir() + wxFileName::GetPathSeparator() + wxT("conf\\"); + // exemple : C:\\path\\wired_exe_install_dir\\data + DataDir = wxStandardPaths::Get().GetDataDir() + wxFileName::GetPathSeparator() + wxT("data\\"); + // exemple : C:\\path\\wired_exe_install_dir\\plugins + PlugDir = wxStandardPaths::Get().GetDataDir() + wxFileName::GetPathSeparator() + wxT("plugins\\"); #else // exemple : /usr/etc/wired/ ConfDir = wxString(wxT(SYSCONF_DIR)) + wxFileName::GetPathSeparator(); + // exemple : /usr/share/wired/ + DataDir = wxString(wxT(DATA_DIR)) + wxT("/wired/"); + // exemple : /usr/lib/ + PlugDir = wxString(wxT(LIB_DIR)) + wxFileName::GetPathSeparator(); #endif PlugConfFile = ConfDir + PLUG_CONF_FILE; f.Assign(PlugConfFile); @@ -38,13 +46,6 @@ PlugConfFile = ConfDir + PLUG_CONF_FILE; } -#ifdef _WIN32 - // exemple : C:\\path\\wired_exe_install_dir\\data - DataDir = wxStandardPaths::Get().GetDataDir() + wxFileName::GetPathSeparator() + wxT(DATA_DIR) + wxFileName::GetPathSeparator(); -#else - // exemple : /usr/share/wired/ - DataDir = wxString(wxT(DATA_DIR)) + wxT("/wired/"); -#endif f.Assign(DataDir); if (!f.DirExists()) Modified: trunk/wired/src/engine/Settings.h =================================================================== --- trunk/wired/src/engine/Settings.h 2009-08-28 15:39:01 UTC (rev 1561) +++ trunk/wired/src/engine/Settings.h 2009-08-28 15:49:51 UTC (rev 1562) @@ -160,6 +160,11 @@ wxString DataDir; /** + * Setting a directory of plugins. + */ + wxString PlugDir; + + /** * Setting a working directory. */ wxString WorkingDir; Modified: trunk/wired/src/plugins/PluginLoader.cpp =================================================================== --- trunk/wired/src/plugins/PluginLoader.cpp 2009-08-28 15:39:01 UTC (rev 1561) +++ trunk/wired/src/plugins/PluginLoader.cpp 2009-08-28 15:49:51 UTC (rev 1562) @@ -34,7 +34,7 @@ cerr << "[PLUGINLOADER] Can't create Plugin" << endl; } -PluginLoader::PluginLoader(wxString filename) : +PluginLoader::PluginLoader(wxString filename) : FileName(filename), handle(wxString(wxT(LIB_DIR)) + wxT("/") + filename) { External = false; @@ -44,7 +44,7 @@ if (!handle.IsLoaded()) { cout << "[PLUGLOADER] Warning : " << - wxString(wxString(wxT(LIB_DIR)) + wxT("/") + filename).mb_str() + wxString(WiredSettings->PlugDir + filename).mb_str() << " can't be loaded" << endl; handle.Load(filename); } @@ -58,26 +58,26 @@ #endif init = (init_t) handle.GetSymbol(PLUG_INIT); - if (!init) + if (!init) { cerr << "[PLUGLOADER] Error: Cannot load symbol : " << PLUG_INIT << endl; handle.Unload(); return ; } destroy = (destroy_t) handle.GetSymbol(PLUG_DESTROY); - if (!destroy) + if (!destroy) { cerr << "[PLUGLOADER] Error: Cannot load symbol : " << PLUG_DESTROY << endl; handle.Unload(); return ; - } + } create = (create_t) handle.GetSymbol(PLUG_CREATE); - if (!create) + if (!create) { cerr << "[PLUGLOADER] Error: Cannot load symbol : " << PLUG_CREATE << endl; handle.Unload(); return ; - } + } // get unique info from plugin (id, name, version, size, ..) InitInfo = init(); @@ -85,7 +85,7 @@ // check version of API if (InitInfo.Version != WIRED_CURRENT_VERSION_API) { - cerr << "[PLUGLOADER] Error: Cannot load plugin " << filename.mb_str() + cerr << "[PLUGLOADER] Error: Cannot load plugin " << filename.mb_str() << ", it has deprecated version of API " << endl; handle.Unload(); return ; @@ -112,7 +112,7 @@ if (ExternalPlug) ExternalPlug->SetInfo(&info); - + return (Plugin*) ExternalPlug; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2010-04-10 21:11:52
|
Revision: 1565 http://wired.svn.sourceforge.net/wired/?rev=1565&view=rev Author: hdoomsday Date: 2010-04-10 21:11:43 +0000 (Sat, 10 Apr 2010) Log Message: ----------- [COMPIL] Moved header to good folder Added Paths: ----------- trunk/wired/src/fileloader/FileConversion.h Removed Paths: ------------- trunk/wired/src/gui/FileConversion.h Copied: trunk/wired/src/fileloader/FileConversion.h (from rev 1564, trunk/wired/src/gui/FileConversion.h) =================================================================== --- trunk/wired/src/fileloader/FileConversion.h (rev 0) +++ trunk/wired/src/fileloader/FileConversion.h 2010-04-10 21:11:43 UTC (rev 1565) @@ -0,0 +1,101 @@ +// Copyright (C) 2004-2007 by Wired Team +// Under the GNU General Public License Version 2, June 1991 + +#ifndef _FILECONVERSION_H_ +#define _FILECONVERSION_H_ + +#include <wx/thread.h> +#include <iostream> +#include <list> +#include <vector> +#include <deque> + +#include "WiredSampleRate.h" +#include "WiredCodec.h" + +#define PROGRESS_DIALOG_UNIT 100 + +using namespace std; + +typedef enum { + AImportWaveFile = 0, + AConvertSampleRate, + AExportWaveFile, + AImportFile +} FileConversionTypeAction; + +typedef struct s_FileConversionAction +{ + FileConversionTypeAction TypeAction; + wxString SrcFileName; + wxString DstFileName; +} FileConversionAction; + +class FileConversion //: public wxThread +{ +public: + FileConversion(); + virtual ~FileConversion(); + FileConversion(const FileConversion& copy){*this = copy;} + FileConversion operator=(const FileConversion& right); + + virtual void *Entry(); + bool Init(t_samplerate_info *RateInit, wxString &WorkingDir, unsigned long BufferSize, wxWindow *Parent); + vector<wxString> *GetCodecsExtensions(); + bool ConvertFromCodec(wxString& FileName); + void ConvertToCodec(wxString& FileName); + bool ConvertSamplerate(wxString& FileName); + bool ConvertSamplerateNoGraph(wxString& FileName); + + // import a wav file + void ImportWaveFile(wxString& FileName); + + // import a file with probably some codec, return false if canceled + bool ImportFile(wxString& FileName); + + void Stop(); + void SetBufferSize(unsigned long Size){_BufferSize = Size; _SampleRateConverter.SetBufferSize(Size);} + void SetSampleRate(unsigned long SampleRate){_SampleRateConverter.SetSampleRate(SampleRate);} + void SetFormat(PaSampleFormat Format){_SampleRateConverter.SetFormat(Format);} +private: + void CopyToWorkingDir(wxString& FileName); + void ImportWavePattern(wxString& FileName); + bool ConvertSamplerate(wxString& FileName, bool &HasChangedPath); + bool ConvertSamplerateNoGraph(wxString& FileName, bool &HasChangedPath); + int GetSndFFormat(PcmType Type); + bool Decode(wxString& FileName); + void EnqueueAction(FileConversionTypeAction ActionType, wxString &SrcFile, wxString &DstFile); + bool _ShouldRun; + WiredSampleRate _SampleRateConverter; + WiredCodec _CodecConverter; + vector<wxString> _CodecsExtensions; + wxString _WorkingDir; + unsigned long _BufferSize; + wxWindow *_Parent; + deque<FileConversionAction *> _ActionsList; + +private: + SNDFILE *OpenDecodeFile(t_Pcm &Data, const wxString &DestFileName, SF_INFO &Info, + unsigned long *TotalReaden, int *sf_write_result); +}; + +static wxMutex FileConversionMutex; + +class AskQuestion +{ +public: + AskQuestion(wxWindow *Parent){_Parent = Parent;} + ~AskQuestion(){}; + + int Ask(const wxString &Question, const wxString &Title) + { + wxMessageDialog msg(_Parent, Question, Title, wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE); + int res = msg.ShowModal(); + msg.Destroy(); + return res; + } +private: + wxWindow *_Parent; +}; + +#endif /*FILECONVERSION_H_*/ Deleted: trunk/wired/src/gui/FileConversion.h =================================================================== --- trunk/wired/src/gui/FileConversion.h 2009-09-01 07:02:53 UTC (rev 1564) +++ trunk/wired/src/gui/FileConversion.h 2010-04-10 21:11:43 UTC (rev 1565) @@ -1,101 +0,0 @@ -// Copyright (C) 2004-2007 by Wired Team -// Under the GNU General Public License Version 2, June 1991 - -#ifndef _FILECONVERSION_H_ -#define _FILECONVERSION_H_ - -#include <wx/thread.h> -#include <iostream> -#include <list> -#include <vector> -#include <deque> - -#include "WiredSampleRate.h" -#include "WiredCodec.h" - -#define PROGRESS_DIALOG_UNIT 100 - -using namespace std; - -typedef enum { - AImportWaveFile = 0, - AConvertSampleRate, - AExportWaveFile, - AImportFile -} FileConversionTypeAction; - -typedef struct s_FileConversionAction -{ - FileConversionTypeAction TypeAction; - wxString SrcFileName; - wxString DstFileName; -} FileConversionAction; - -class FileConversion //: public wxThread -{ -public: - FileConversion(); - virtual ~FileConversion(); - FileConversion(const FileConversion& copy){*this = copy;} - FileConversion operator=(const FileConversion& right); - - virtual void *Entry(); - bool Init(t_samplerate_info *RateInit, wxString &WorkingDir, unsigned long BufferSize, wxWindow *Parent); - vector<wxString> *GetCodecsExtensions(); - bool ConvertFromCodec(wxString& FileName); - void ConvertToCodec(wxString& FileName); - bool ConvertSamplerate(wxString& FileName); - bool ConvertSamplerateNoGraph(wxString& FileName); - - // import a wav file - void ImportWaveFile(wxString& FileName); - - // import a file with probably some codec, return false if canceled - bool ImportFile(wxString& FileName); - - void Stop(); - void SetBufferSize(unsigned long Size){_BufferSize = Size; _SampleRateConverter.SetBufferSize(Size);} - void SetSampleRate(unsigned long SampleRate){_SampleRateConverter.SetSampleRate(SampleRate);} - void SetFormat(PaSampleFormat Format){_SampleRateConverter.SetFormat(Format);} -private: - void CopyToWorkingDir(wxString& FileName); - void ImportWavePattern(wxString& FileName); - bool ConvertSamplerate(wxString& FileName, bool &HasChangedPath); - bool ConvertSamplerateNoGraph(wxString& FileName, bool &HasChangedPath); - int GetSndFFormat(PcmType Type); - bool Decode(wxString& FileName); - void EnqueueAction(FileConversionTypeAction ActionType, wxString &SrcFile, wxString &DstFile); - bool _ShouldRun; - WiredSampleRate _SampleRateConverter; - WiredCodec _CodecConverter; - vector<wxString> _CodecsExtensions; - wxString _WorkingDir; - unsigned long _BufferSize; - wxWindow *_Parent; - deque<FileConversionAction *> _ActionsList; - -private: - SNDFILE *OpenDecodeFile(t_Pcm &Data, const wxString &DestFileName, SF_INFO &Info, - unsigned long *TotalReaden, int *sf_write_result); -}; - -static wxMutex FileConversionMutex; - -class AskQuestion -{ -public: - AskQuestion(wxWindow *Parent){_Parent = Parent;} - ~AskQuestion(){}; - - int Ask(const wxString &Question, const wxString &Title) - { - wxMessageDialog msg(_Parent, Question, Title, wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE); - int res = msg.ShowModal(); - msg.Destroy(); - return res; - } -private: - wxWindow *_Parent; -}; - -#endif /*FILECONVERSION_H_*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2010-05-03 19:22:45
|
Revision: 1568 http://wired.svn.sourceforge.net/wired/?rev=1568&view=rev Author: hdoomsday Date: 2010-05-03 19:22:39 +0000 (Mon, 03 May 2010) Log Message: ----------- [COMPAT] WxEvent fixed under win32: plugin API updated to handle different mouse events instead of only one. Modified Paths: -------------- trunk/wired/src/gui/Rack.cpp trunk/wired/src/gui/Rack.h trunk/wired/src/plugins/HostCallback.cpp trunk/wired/src/redist/Plugin.cpp trunk/wired/src/redist/Plugin.h Modified: trunk/wired/src/gui/Rack.cpp =================================================================== --- trunk/wired/src/gui/Rack.cpp 2010-05-03 17:34:56 UTC (rev 1567) +++ trunk/wired/src/gui/Rack.cpp 2010-05-03 19:22:39 UTC (rev 1568) @@ -38,6 +38,8 @@ copy_plug = NULL; filePath.Printf(wxT("/tmp/.tmpccp")); CleanChildren(); + OldX = 0; + OldY = 0; } Rack::~Rack() @@ -258,143 +260,132 @@ return false; } -void Rack::SetSelected(Plugin *p) +void Rack::SetSelected(Plugin *newSelected) { - t_ListRackTrack::iterator i; - list<Plugin *>::iterator j; - - if (!p) + if(selectedPlugin != newSelected) { - selectedPlugin = 0x0; - selectedTrack = 0x0; + t_ListRackTrack::iterator i; + list<Plugin *>::iterator j; + + // refresh previously selected plugin to delete red borders. + Plugin* oldPlug = selectedPlugin; + selectedPlugin = newSelected; + if(!selectedPlugin) + { + selectedTrack = 0x0; + WasDragging = false; + } + else + { + for (i = RackTracks.begin(); i != RackTracks.end(); i++) + for (j = (*i)->Racks.begin(); j != (*i)->Racks.end(); j++) + if (*j == newSelected) + { + selectedTrack = *i; + selectedTrack->SetSelected(selectedPlugin); + selectedPlugin->Refresh(); + return; + } + } + // refresh once plugin is deselected + if (oldPlug) + oldPlug->Refresh(); } - else if (selectedPlugin != p) +} + +void Rack::OnMotion(wxMouseEvent &event) +{ + // we have to compute destination values + // considering event having absolute coords (rack window) + if (WasDragging && event.Dragging()) { - selectedPlugin = p; - for (i = RackTracks.begin(); i != RackTracks.end(); i++) - for (j = (*i)->Racks.begin(); j != (*i)->Racks.end(); j++) - if (*j == p) - { - selectedTrack = *i; - selectedTrack->SetSelected(selectedPlugin); - return; - } + int tmp_x = event.GetPosition().x - OldX; + int tmp_y = event.GetPosition().y - OldY; + + if(tmp_x < 0) + tmp_x = 0; + if(tmp_y < 0) + tmp_y = 0; + selectedPlugin->Move(wxPoint(tmp_x, tmp_y)); } } -void Rack::OnMotion(wxMouseEvent &event) +void Rack::HandleMotionEvent(Plugin *plug, wxMouseEvent& event) { - if (selectedPlugin && WasDragging && event.Dragging() && event.LeftIsDown()) - { - int tmp_x = 0; - int tmp_y = 0; + // we have to compute destination values + // considering event having relative coords (plugin window) + if (event.Dragging()) + { + int tmp_x = 0; + int tmp_y = 0; - tmp_x = event.GetPosition().x; - tmp_y = event.GetPosition().y; - if(tmp_x < 0) - tmp_x = 0; - if(tmp_y < 0) - tmp_y = 0; - selectedPlugin->Move(wxPoint(tmp_x, tmp_y)); + // event coords are relative to the window that drag occurs + tmp_x = event.GetPosition().x + plug->GetPosition().x - OldX; + tmp_y = event.GetPosition().y + plug->GetPosition().y - OldY; + if(tmp_x < 0) + tmp_x = 0; + if(tmp_y < 0) + tmp_y = 0; + selectedPlugin->Move(wxPoint(tmp_x, tmp_y)); + WasDragging = true; } - else if (event.LeftUp() && WasDragging) - { - t_ListRackTrack::iterator k; - list<Plugin *>::iterator l; - - new_x = (event.GetPosition().x + selectedPlugin->GetPosition().x); - new_y = (event.GetPosition().y + selectedPlugin->GetPosition().y); - // if IsAudio() is false (plugins can't receive audio): we don't allow chaining - if(selectedPlugin->IsAudio() && !DndGetDest(k, l, new_x, new_y, selectedPlugin)) - { - DeleteRack(selectedPlugin, false); - AddLoadedRack(selectedPlugin); - } - ResizeTracks(); - WasDragging = false; - } } -void Rack::HandleMouseEvent(Plugin *plug, wxMouseEvent *event) +void Rack::HandleWheelEvent(Plugin *plug, wxMouseEvent& event) { - t_ListRackTrack::iterator i; - t_ListRackTrack::iterator k; - list<Plugin *>::iterator j; - list<Plugin *>::iterator l; - new_x = 0; - new_y = 0; - int tmp_x = 0; - int tmp_y = 0; - // manage vertical mousewheel - if (event->GetEventType() == wxEVT_MOUSEWHEEL) - { - int x, y, y1, y2, y3; + int x, y, y1, y2, y3; - GetVirtualSize(0x0, &y1); - GetSize(0x0, &y2); - GetViewStart(&x, &y3); - if (y1 > y2) - { - if (event->GetWheelRotation() > 0) - y = -1; - else - y = 1; - Scroll(x, y3 + y); + GetVirtualSize(0x0, &y1); + GetSize(0x0, &y2); + GetViewStart(&x, &y3); + if (y1 > y2) + { + if (event.GetWheelRotation() > 0) + y = -1; + else + y = 1; + Scroll(x, y3 + y); } - } +} - if (event->Button(wxMOUSE_BTN_ANY)) - { - SetSelected(plug); - } +void Rack::HandleLeftUpEvent(Plugin *plug, wxMouseEvent& event) +{ + SetSelected(plug); + if(WasDragging) + { + t_ListRackTrack::iterator k; + list<Plugin *>::iterator l; - if(event->LeftDown()) - { - OldX = event->GetPosition().x; - OldY = event->GetPosition().y; + int new_x = (event.GetPosition().x + plug->GetPosition().x); + int new_y = (event.GetPosition().y + plug->GetPosition().y); + // if IsAudio() is false (plugins can't receive audio): we don't allow chaining + if(plug->IsAudio() && !DndGetDest(k, l, new_x, new_y, plug)) + { + DeleteRack(plug, false); + AddLoadedRack(plug); + } + ResizeTracks(); + WasDragging = false; + } - Plugin *oldplug = selectedPlugin; - SetSelected(plug); - if (oldplug) - oldplug->Refresh(); +} - new_x = (event->GetPosition().x + plug->GetPosition().x); - new_y = (event->GetPosition().y + plug->GetPosition().y); - } - else if (event->Dragging() && event->LeftIsDown()) - { - tmp_x = event->GetPosition().x + plug->GetPosition().x - OldX; - tmp_y = event->GetPosition().y + plug->GetPosition().y - OldY; - if(tmp_x < 0) - tmp_x = 0; - if(tmp_y < 0) - tmp_y = 0; - plug->Move(wxPoint(tmp_x, tmp_y)); - WasDragging = true; - } +void Rack::HandleLeftDownEvent(Plugin *plug, wxMouseEvent& event) +{ + SetSelected(plug); - if(event->RightDown()) - { - SetSelected(plug); - wxPoint p(event->GetPosition().x + plug->GetPosition().x, event->GetPosition().y + plug->GetPosition().y); - PopupMenu(menu, p.x, p.y); - } - else if(event->LeftUp() && WasDragging) - { - new_x = (event->GetPosition().x + plug->GetPosition().x); - new_y = (event->GetPosition().y + plug->GetPosition().y); - // if IsAudio() is false (plugins can't receive audio): we don't allow chaining - if(plug->IsAudio() && !DndGetDest(k, l, new_x, new_y, plug)) - { - DeleteRack(plug, false); - AddLoadedRack(plug); - } - ResizeTracks(); - WasDragging = false; - } + OldX = event.GetPosition().x; + OldY = event.GetPosition().y; } +void Rack::HandleRightDownEvent(Plugin *plug, wxMouseEvent& event) +{ + wxPoint p(event.GetPosition().x + plug->GetPosition().x, event.GetPosition().y + plug->GetPosition().y); + SetSelected(plug); + PopupMenu(menu, p.x, p.y); +} + void Rack::AddPlugToMenu() { vector<PluginLoader *>::iterator i; @@ -416,28 +407,27 @@ } // called from OnPaint()'s plugins (via HostCallback) -void Rack::HandlePaintEvent(Plugin *plug, wxPaintEvent *event) +void Rack::HandlePaintEvent(Plugin *plug, wxPaintEvent& event) { - int xx, yy; - - CalcScrolledPosition(0, 0, &xx, &yy); - if (selectedPlugin == 0x0) - return; + // we add the red border only on selectedPlugin if (selectedPlugin == plug) { - wxPaintDC dc(selectedPlugin); + int xx, yy; + wxPaintDC dc(plug); + PrepareDC(dc); dc.SetPen(wxPen(wxColour(255,0,0), 3, wxSOLID)); dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.DrawRectangle(0 - xx, 0 - yy, selectedPlugin->GetSize().x, selectedPlugin->GetSize().y); + CalcScrolledPosition(0, 0, &xx, &yy); + dc.DrawRectangle(0 - xx, 0 - yy, plug->GetSize().x, plug->GetSize().y); } } // we got new_x and new_y which are mouse dropped positions bool Rack::DndGetDest(t_ListRackTrack::iterator &k, list<Plugin *>::iterator &l, - int &new_x, - int &new_y, + int &dest_x, + int &dest_y, Plugin *plug) { int pos_x = 0; @@ -450,13 +440,13 @@ { // for each RackTrack, we look x coord and width of the Rack pos_x = (pos_x + (*k)->Units * UNIT_W); - if((((pos_x + xx)- ((*k)->Units * UNIT_W)) < new_x) && (new_x < (pos_x + xx)) ) + if((((pos_x + xx)- ((*k)->Units * UNIT_W)) < dest_x) && (dest_x < (pos_x + xx)) ) { // for each Rack linked to the RackTrack, we look y coord and height of the Rack for(l = (*k)->Racks.begin(); l != (*k)->Racks.end(); l++) { pos_y = pos_y + (*l)->InitInfo->UnitsY * UNIT_H; - if((((pos_y + yy) - ((*l)->InitInfo->UnitsY * UNIT_H)) < new_y) && (new_y < (pos_y + yy))) + if((((pos_y + yy) - ((*l)->InitInfo->UnitsY * UNIT_H)) < dest_y) && (dest_y < (pos_y + yy))) { if((*l) == plug) return true; @@ -604,9 +594,9 @@ } -void Rack::HandleKeyEvent(Plugin *plug, wxKeyEvent *event) +void Rack::HandleKeyEvent(Plugin *plug, wxKeyEvent& event) { - if (event->GetKeyCode() == WXK_DOWN) + if (event.GetKeyCode() == WXK_DOWN) { //cout << "[RACKPANEL] key received: down arrow" << endl; } Modified: trunk/wired/src/gui/Rack.h =================================================================== --- trunk/wired/src/gui/Rack.h 2010-05-03 17:34:56 UTC (rev 1567) +++ trunk/wired/src/gui/Rack.h 2010-05-03 19:22:39 UTC (rev 1568) @@ -119,13 +119,19 @@ void AddPlugToMenu(); // bool ProcessEvent(wxEvent& event); - // Handles all mouse events void OnMotion(wxMouseEvent &event); - void HandleMouseEvent(Plugin *plug, wxMouseEvent *event); + + // Handles all mouse events from plugins + void HandleMotionEvent(Plugin *plug, wxMouseEvent& event); + void HandleWheelEvent(Plugin *plug, wxMouseEvent& event); + void HandleLeftUpEvent(Plugin *plug, wxMouseEvent& event); + void HandleLeftDownEvent(Plugin *plug, wxMouseEvent& event); + void HandleRightDownEvent(Plugin *plug, wxMouseEvent& event); + // Handles key events - void HandleKeyEvent(Plugin *plug, wxKeyEvent *event); + void HandleKeyEvent(Plugin *plug, wxKeyEvent& event); // Handles all paint events like onPaint ??? - void HandlePaintEvent(Plugin *plug, wxPaintEvent *event); + void HandlePaintEvent(Plugin *plug, wxPaintEvent& event); // Draws the selection rectangle void SetAudioConfig(long bufferSize, double samplingRate); @@ -139,8 +145,6 @@ int OldX; int OldY; - int new_x; - int new_y; int fd_size; bool is_cut; Modified: trunk/wired/src/plugins/HostCallback.cpp =================================================================== --- trunk/wired/src/plugins/HostCallback.cpp 2010-05-03 17:34:56 UTC (rev 1567) +++ trunk/wired/src/plugins/HostCallback.cpp 2010-05-03 19:22:39 UTC (rev 1568) @@ -50,11 +50,26 @@ switch (param) { - case wiredSendMouseEvent : - RackPanel->HandleMouseEvent(plug, (wxMouseEvent *)value); + case wiredSendMotionEvent : + RackPanel->HandleMotionEvent(plug, *(wxMouseEvent *)value); break; + case wiredSendWheelEvent : + RackPanel->HandleWheelEvent(plug, *(wxMouseEvent *)value); + break; + case wiredSendLeftUpEvent : + RackPanel->HandleLeftUpEvent(plug, *(wxMouseEvent *)value); + break; + case wiredSendLeftDownEvent : + RackPanel->HandleLeftDownEvent(plug, *(wxMouseEvent *)value); + break; + case wiredSendRightDownEvent : + RackPanel->HandleRightDownEvent(plug, *(wxMouseEvent *)value); + break; + case wiredSendKeyEvent : + RackPanel->HandleKeyEvent(plug, *(wxKeyEvent *)value); + break; case wiredSendPaintEvent : - RackPanel->HandlePaintEvent(plug, (wxPaintEvent *)value); + RackPanel->HandlePaintEvent(plug, *(wxPaintEvent *)value); break; case wiredAskUpdateGui : MainWin->AddUpdatePlugin(plug); @@ -84,9 +99,6 @@ HelpWin->Help->Load_Text((*(wxString *)value)); break; } - case wiredSendKeyEvent : - RackPanel->HandleKeyEvent(plug, (wxKeyEvent *)value); - break; case wiredGetBpm : *(float *)value = Seq->BPM; break; Modified: trunk/wired/src/redist/Plugin.cpp =================================================================== --- trunk/wired/src/redist/Plugin.cpp 2010-05-03 17:34:56 UTC (rev 1567) +++ trunk/wired/src/redist/Plugin.cpp 2010-05-03 19:22:39 UTC (rev 1568) @@ -8,49 +8,69 @@ /* DO NOT MODIFY THIS FILE FOR MAKING A PLUGIN. JUST DERIVE FROM THAT CLASS */ -Plugin::Plugin(PlugStartInfo &startinfo, PlugInitInfo *initinfo) +Plugin::Plugin(PlugStartInfo &startinfo, PlugInitInfo *initinfo) : wxWindow(startinfo.Rack, -1, startinfo.Pos, startinfo.Size) -{ +{ InitInfo = initinfo; StartInfo = startinfo; - if (InitInfo) + if (InitInfo) InitInfo->UniqueExternalId = 0; Connect(wxID_ANY, wxEVT_KEY_DOWN, (wxObjectEventFunction)(wxEventFunction) &Plugin::OnKeyEvent); Connect(wxID_ANY, wxEVT_MOUSEWHEEL, (wxObjectEventFunction)(wxEventFunction) - &Plugin::OnMouseEvent); + &Plugin::OnWheelEvent); Connect(wxID_ANY, wxEVT_LEFT_DOWN, (wxObjectEventFunction)(wxEventFunction) - &Plugin::OnMouseEvent); + &Plugin::OnLeftDownEvent); Connect(wxID_ANY, wxEVT_LEFT_UP, (wxObjectEventFunction)(wxEventFunction) - &Plugin::OnMouseEvent); + &Plugin::OnLeftUpEvent); Connect(wxID_ANY, wxEVT_MOTION, (wxObjectEventFunction)(wxEventFunction) - &Plugin::OnMouseEvent); + &Plugin::OnMotionEvent); Connect(wxID_ANY, wxEVT_RIGHT_DOWN, (wxObjectEventFunction)(wxEventFunction) - &Plugin::OnMouseEvent); + &Plugin::OnRightDownEvent); // Connect(wxID_ANY, wxEVT_PAINT, (wxObjectEventFunction)(wxEventFunction) // &Plugin::OnPaintEvent); } -Plugin::~Plugin() -{ +Plugin::~Plugin() +{ if (!Disconnect()) cerr << "[PLUGIN] error disconnecting interface" << endl; CloseOptionalView(); } -void Plugin::OnMouseEvent(wxMouseEvent &event) +void Plugin::OnMotionEvent(wxMouseEvent &event) { - SendMouseEvent(event); + StartInfo.HostCallback(this, wiredSendMotionEvent, (void*)&event); } +void Plugin::OnWheelEvent(wxMouseEvent &event) +{ + StartInfo.HostCallback(this, wiredSendWheelEvent, (void*)&event); +} + +void Plugin::OnLeftUpEvent(wxMouseEvent &event) +{ + StartInfo.HostCallback(this, wiredSendLeftUpEvent, (void*)&event); +} + +void Plugin::OnLeftDownEvent(wxMouseEvent &event) +{ + StartInfo.HostCallback(this, wiredSendLeftDownEvent, (void*)&event); +} + +void Plugin::OnRightDownEvent(wxMouseEvent &event) +{ + StartInfo.HostCallback(this, wiredSendRightDownEvent, (void*)&event); +} + void Plugin::OnKeyEvent(wxKeyEvent &event) { - SendKeyEvent(event); + StartInfo.HostCallback(this, wiredSendKeyEvent, (void *)&event); } void Plugin::OnPaintEvent(wxPaintEvent &event) { - SendPaintEvent(event); + StartInfo.HostCallback(this, wiredSendPaintEvent, (void *)&event); } // Time events @@ -115,29 +135,9 @@ StartInfo.HostCallback(this, wiredSendHelp, (void *)&str); } -void Plugin::SendMouseEvent(wxMouseEvent &event) -{ - StartInfo.HostCallback(this, wiredSendMouseEvent, (void *)&event); -} - -void Plugin::SendKeyEvent(wxKeyEvent &event) -{ - StartInfo.HostCallback(this, wiredSendKeyEvent, (void *)&event); -} - -void Plugin::SendClickEvent(wxMouseEvent &event) -{ - StartInfo.HostCallback(this, wiredSendClickEvent, (void *)&event); -} - -void Plugin::SendPaintEvent(wxPaintEvent &event) -{ - StartInfo.HostCallback(this, wiredSendPaintEvent, (void *)&event); -} - bool Plugin::ShowMidiController(int *MidiData[3]) { - StartInfo.HostCallback(this, wiredShowMidiController, (void *)MidiData); + StartInfo.HostCallback(this, wiredShowMidiController, (void *)MidiData); if (*MidiData[0] == -1) return (false); return (true); @@ -153,7 +153,7 @@ StartInfo.HostCallback(this, wiredCloseOptionalView, 0x0); } -wxString Plugin::OpenFileLoader(wxString title, +wxString Plugin::OpenFileLoader(wxString title, std::vector<wxString> *exts, bool akai) { @@ -164,7 +164,7 @@ bool ak; wxString result; } w_filel; - + w_filel.t = title; w_filel.e = exts; w_filel.ak = akai; @@ -172,7 +172,7 @@ return (w_filel.result); } -wxString Plugin::SaveFileLoader(wxString title, +wxString Plugin::SaveFileLoader(wxString title, std::vector<wxString> *exts) { struct @@ -181,7 +181,7 @@ std::vector<wxString> *e; wxString result; } w_filel; - + w_filel.t = title; w_filel.e = exts; StartInfo.HostCallback(this, wiredSaveFileLoader, (void *)&w_filel); @@ -193,7 +193,7 @@ { wxString s; - StartInfo.HostCallback(0x0, wiredHostProductName, (void *)&s); + StartInfo.HostCallback(0x0, wiredHostProductName, (void *)&s); return (s); } @@ -209,16 +209,16 @@ { wxString s; - StartInfo.HostCallback(0x0, wiredHostVendorName, (void *)&s); + StartInfo.HostCallback(0x0, wiredHostVendorName, (void *)&s); return (s); } wxString Plugin::GetDataDir() { wxString s; - - StartInfo.HostCallback(0x0, wiredGetDataDir, (void *)&s); - return (s); + + StartInfo.HostCallback(0x0, wiredGetDataDir, (void *)&s); + return (s); } bool Plugin::CreateMidiPattern(std::list<SeqCreateEvent *> *l) @@ -257,7 +257,7 @@ _Data[Name] = Value; return true; } - return false; + return false; } const char *WiredPluginData::LoadValue(const wxString& Name) Modified: trunk/wired/src/redist/Plugin.h =================================================================== --- trunk/wired/src/redist/Plugin.h 2010-05-03 17:34:56 UTC (rev 1567) +++ trunk/wired/src/redist/Plugin.h 2010-05-03 19:22:39 UTC (rev 1568) @@ -16,8 +16,8 @@ #ifndef WX_PRECOMP #include <wx/wx.h> #endif -#include <string> -#include <list> +#include <string> +#include <list> #include <vector> #include <map> #include "Plugin.h" @@ -45,10 +45,10 @@ #define WIRED_MAKE_STR(x, y) { x[0] = y[0]; x[1] = y[1]; x[2] = y[2]; x[3] = y[3]; } /* You need to return this struct to the host when it calls the 'init' function */ -typedef struct +typedef struct { // ID of your plugin. Must be *unique* AND ALPHA (not numeric) - char UniqueId[4]; + char UniqueId[4]; // ID of an external plugin. Must not be filled if you want to comply with Wired Old API unsigned long UniqueExternalId; @@ -85,12 +85,12 @@ #define WIRED_MIDI_EVENT 1 /* Structure that is passed when your plugin receives an event (such as MIDI messages) */ -typedef struct +typedef struct { // Event type (i.e WIRED_MIDI_EVENT above) - long Type; + long Type; // The number of frames the event will start on next call to Process() - long DeltaFrames; + long DeltaFrames; // The note length (usually 0, look for note off messages to know the end of a note long NoteLength; // The MIDI data @@ -101,11 +101,11 @@ typedef struct s_SeqCreateEvent { // position relative to pattern position - double Position; + double Position; // length of message - double EndPosition; + double EndPosition; // MIDI Data - int MidiMsg[3]; + int MidiMsg[3]; } SeqCreateEvent; // Parameters code list @@ -119,9 +119,12 @@ // User interface events wiredSendHelp, - wiredSendMouseEvent, + wiredSendMotionEvent, + wiredSendWheelEvent, + wiredSendLeftUpEvent, + wiredSendLeftDownEvent, + wiredSendRightDownEvent, wiredSendKeyEvent, - wiredSendClickEvent, wiredSendPaintEvent, wiredShowOptionalView, wiredCloseOptionalView, @@ -143,7 +146,7 @@ wiredCreateMidiPattern }; -/* Parameter class, used for Wired with Xml compatibility. +/* Parameter class, used for Wired with Xml compatibility. The only two methods you must know are SaveValue and LoadValue. */ @@ -194,25 +197,25 @@ /* Called when the host stopped the sequencer */ virtual void Stop() {} - /* Called by the host when the plugin needs to load existing parameters (such as in a - .wrd file. 'fd' is the file descriptor of the file placed at the correct position, + /* Called by the host when the plugin needs to load existing parameters (such as in a + .wrd file. 'fd' is the file descriptor of the file placed at the correct position, where the plugin should read 'size' bytes of data. */ virtual void Load(int fd, long size) {} - // ...and the xml-compatible one... + // ...and the xml-compatible one... virtual void Load(WiredPluginData& Datas){} - /* Called by the host when the plugin needs to save its parameters. This function + /* Called by the host when the plugin needs to save its parameters. This function should return the size of the data that was written in file descriptor 'fd' */ virtual long Save(int fd) { return (0); } - + // ...and the xml-compatible one... virtual void Save(WiredPluginData& Datas) {} - /* Called when the buffer size of the host changes (it is also called after + /* Called when the buffer size of the host changes (it is also called after initialization of the plugin */ virtual void SetBufferSize(long size) {} - /* Called when the sample rate of the host changes (it is also called after + /* Called when the sample rate of the host changes (it is also called after initialization of the plugin */ virtual void SetSamplingRate(double rate) {} /* Called by the host when the BPM changes */ @@ -222,9 +225,9 @@ /* This is were you do your processing. 'input' is the data you have to process (or not if you are making an instrument) and 'output' whre you should place the - processed or generated. 'input' and 'output' contains two buffers (for stereo) which + processed or generated. 'input' and 'output' contains two buffers (for stereo) which contains 'sample_length' elements */ - virtual void Process(float **input, float **output, long sample_length) + virtual void Process(float **input, float **output, long sample_length) { long i; for (i = 0; i < sample_length; i++) @@ -240,10 +243,10 @@ /* Called by the host to know if the plugin has an optional view or not */ virtual bool HasView() { return false; } /* Called by the host to create the optional view */ - virtual wxWindow *CreateView(wxWindow *zone, wxPoint &pos, wxSize &size) { return 0x0; } + virtual wxWindow *CreateView(wxWindow *zone, wxPoint &pos, wxSize &size) { return 0x0; } /* Called when the optional view needs to be destroyed */ virtual void DestroyView() {} - + /* Is plugin supporting audio data to be sent to it ? */ virtual bool IsAudio() = 0; /* Is plugin supporting MIDI data to be sent to it ? */ @@ -265,13 +268,30 @@ virtual wxString DefaultName() { return _("Rack"); } /* Returns a 32x16 bitmap used for displaying the connected to track plugin */ - virtual wxBitmap *GetBitmap() = 0; + virtual wxBitmap *GetBitmap() = 0; /* Used to know if a keyboard event occured. No need to overload */ + /* Tells the host that a key event occured */ virtual void OnKeyEvent(wxKeyEvent &event); + /* Used to know if a mouse event occured. No need to overload */ - virtual void OnMouseEvent(wxMouseEvent &event); + /* Tells the host that a mouse event occured */ + virtual void OnMotionEvent(wxMouseEvent &event); + /* Used to know if a mouse event occured. No need to overload */ + /* Tells the host that a mouse event occured */ + virtual void OnWheelEvent(wxMouseEvent &event); + /* Used to know if a mouse event occured. No need to overload */ + /* Tells the host that a mouse event occured */ + virtual void OnLeftUpEvent(wxMouseEvent &event); + /* Used to know if a mouse event occured. No need to overload */ + /* Tells the host that a mouse event occured */ + virtual void OnLeftDownEvent(wxMouseEvent &event); + /* Used to know if a mouse event occured. No need to overload */ + /* Tells the host that a mouse event occured */ + virtual void OnRightDownEvent(wxMouseEvent &event); + /* Used to know if a paint event occured. No need to overload */ + /* Tells the host that the plugin needs to be paint */ virtual void OnPaintEvent(wxPaintEvent &event); // Time events @@ -295,19 +315,11 @@ void SetNumberOfParameters(int value); wxString GetParameterName(int index); */ - + // User interface events /* Send help wxString to the Wired help window */ void SendHelp(wxString str); - /* Tells the host that a mouse event occured */ - void SendMouseEvent(wxMouseEvent &event); - /* Tells the host that a key event occured */ - void SendKeyEvent(wxKeyEvent &event); - /* Tells the host that the plugin got selected */ - void SendClickEvent(wxMouseEvent &event); - /* Tells the host that the plugin needs to be paint */ - void SendPaintEvent(wxPaintEvent &event); /* Shows MIDI controller change window, if returns true, MidiData will be filled by the MIDI data received (you need to pass a valid pointer to a int[3] variable */ @@ -319,16 +331,16 @@ void CloseOptionalView(); /* Opens the Wired file loader with given title, extensions, and if it should read - AKAI audio cds/files or not. Returns the selected file name or an empty wstring if + AKAI audio cds/files or not. Returns the selected file name or an empty wstring if cancelled. If 'exts' is NULL, default audio extensions are used. */ - wxString OpenFileLoader(wxString title, - std::vector<wxString> *exts, + wxString OpenFileLoader(wxString title, + std::vector<wxString> *exts, bool akai = false); /* Opens the Wired file loader with given title, extensions, for saving a file. Returns the file name or an empty wstring if cancelled */ - wxString SaveFileLoader(wxString title, + wxString SaveFileLoader(wxString title, std::vector<wxString> *exts); - + // Host info /* Returns the host product name */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2010-05-03 19:26:02
|
Revision: 1569 http://wired.svn.sourceforge.net/wired/?rev=1569&view=rev Author: hdoomsday Date: 2010-05-03 19:25:56 +0000 (Mon, 03 May 2010) Log Message: ----------- [COMPAT] Fixed warning leading probably to a bad behaviour Modified Paths: -------------- trunk/wired/src/engine/Settings.cpp trunk/wired/src/gui/MLTree.cpp trunk/wired/src/gui/MLTree.h trunk/wired/src/gui/SeqTrack.cpp trunk/wired/src/gui/Transport.cpp trunk/wired/src/midi/MidiController.cpp trunk/wired/src/midi/MidiController.h trunk/wired/src/midi/MidiFile.cpp trunk/wired/src/midi/MidiFile.h Modified: trunk/wired/src/engine/Settings.cpp =================================================================== --- trunk/wired/src/engine/Settings.cpp 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/engine/Settings.cpp 2010-05-03 19:25:56 UTC (rev 1569) @@ -362,7 +362,8 @@ recent << wxT("Recent") << i; conf->Write(recent, pathList[i].GetFullPath()); } + return true; } - else - cout << "[SETTINGS] AddDirToRecent() : Can't access conf" << endl; + cout << "[SETTINGS] AddDirToRecent() : Can't access conf" << endl; + return false; } Modified: trunk/wired/src/gui/MLTree.cpp =================================================================== --- trunk/wired/src/gui/MLTree.cpp 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/gui/MLTree.cpp 2010-05-03 19:25:56 UTC (rev 1569) @@ -577,7 +577,7 @@ return (itemToAdd); } -wxTreeItemId MLTree::DelFileInProject(wxString FileToDel, bool expand) +void MLTree::DelFileInProject(wxString FileToDel, bool expand) { LOG; wxFileName fileName(FileToDel); @@ -1032,10 +1032,6 @@ wxTreeItemId itemAdded; int slashPos; - - wxFileName *File = new wxFileName(selfile); - - infos = GetTreeItemStructFromId(item_to_drag); if (infos._label != wxT("")) { @@ -1053,7 +1049,8 @@ _nodes[itemAdded] = infos; return itemAdded; } - } + } + return NULL; } void MLTree::DragAndDrop(wxTreeItemId item) Modified: trunk/wired/src/gui/MLTree.h =================================================================== --- trunk/wired/src/gui/MLTree.h 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/gui/MLTree.h 2010-05-03 19:25:56 UTC (rev 1569) @@ -69,7 +69,7 @@ wxString GetFile () { return (_Selfile); } wxTreeItemId AddFileInProject (wxString FileToAdd, bool expand); - wxTreeItemId DelFileInProject (wxString FileToAdd, bool expand); + void DelFileInProject (wxString FileToAdd, bool expand); void LoadPatch (wxString filename); void OnSave (wxString filename); Modified: trunk/wired/src/gui/SeqTrack.cpp =================================================================== --- trunk/wired/src/gui/SeqTrack.cpp 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/gui/SeqTrack.cpp 2010-05-03 19:25:56 UTC (rev 1569) @@ -57,6 +57,9 @@ case eMidiTrack: str.Printf(wxT("MIDI %d"), ++MidiTrackCount); break; + default: + str.Printf(wxT("Unknown %d"), ++MidiTrackCount); + break; } Text = new wxTextCtrl(this, SeqTrack_OnNameChange, str, wxPoint(6, 8), wxSize(TRACK_WIDTH - 68, 18), wxTE_PROCESS_ENTER); @@ -73,12 +76,20 @@ case eMidiTrack: trackTypeImage = new wxImage(wxString(WiredSettings->DataDir + _("ihm/seqtrack/tracktype-midi.png")), wxBITMAP_TYPE_PNG); break; + default: + trackTypeImage = NULL; + break; } - wxBitmap* trackTypeBitmap = new wxBitmap(*trackTypeImage); - delete trackTypeImage; + if(trackTypeImage) + { + wxBitmap* trackTypeBitmap = new wxBitmap(*trackTypeImage); + delete trackTypeImage; - trackTypeStatic = new wxStaticBitmap(this, -1, *trackTypeBitmap, wxPoint(62, 8)); + trackTypeStatic = new wxStaticBitmap(this, -1, *trackTypeBitmap, wxPoint(62, 8)); + } + else + trackTypeStatic = NULL; // record and mute button wxImage *rec_up = new wxImage(wxString(WiredSettings->DataDir + wxString(REC_UP)), wxBITMAP_TYPE_PNG); @@ -136,7 +147,8 @@ // we overwrite LEFT_DOWN event of these class, but we propagate it on each // parent, recursivly (until any catch has not .Skip() call). - trackTypeStatic->Connect(wxEVT_LEFT_DOWN, wxObjectEventFunction(&SeqTrack::PropagateEvent)); + if(trackTypeStatic) + trackTypeStatic->Connect(wxEVT_LEFT_DOWN, wxObjectEventFunction(&SeqTrack::PropagateEvent)); Vu->Connect(wxEVT_LEFT_DOWN, wxObjectEventFunction(&SeqTrack::PropagateEvent)); // Modified: trunk/wired/src/gui/Transport.cpp =================================================================== --- trunk/wired/src/gui/Transport.cpp 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/gui/Transport.cpp 2010-05-03 19:25:56 UTC (rev 1569) @@ -88,7 +88,7 @@ down_up, down_down); wxString s; - s.Printf(wxT("%d"), Seq->BPM); + s.Printf(wxT("%f"), Seq->BPM); BpmLabel = new TransparentStaticText(this, Transport_BpmClick, s, wxPoint(49, 20), wxSize(-1, 12)); BpmLabel->SetFont(wxFont(11, wxDEFAULT, wxNORMAL, wxNORMAL)); Modified: trunk/wired/src/midi/MidiController.cpp =================================================================== --- trunk/wired/src/midi/MidiController.cpp 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/midi/MidiController.cpp 2010-05-03 19:25:56 UTC (rev 1569) @@ -12,8 +12,8 @@ #define MIDIWIDTH 206 -MidiController::MidiController(wxWindow *parent) : - wxDialog(parent, (wxWindowID)-1, (const wxString&)_("Assign Midi Controller")) +MidiController::MidiController(wxWindow *parent) + : wxDialog(parent, -1, wxString(_("Assign Midi Controller"))) { Centre(); Modified: trunk/wired/src/midi/MidiController.h =================================================================== --- trunk/wired/src/midi/MidiController.h 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/midi/MidiController.h 2010-05-03 19:25:56 UTC (rev 1569) @@ -17,20 +17,20 @@ void OnOkBtnClick(wxCommandEvent &event); void OnCancelBtnClick(wxCommandEvent &event); - + void ProcessMidi(int midi_msg[3]); - - int Type; + + int Type; int Controller; int Value; - + bool Note; - + private: wxSpinCtrl *ChannelCtrl; wxSpinCtrl *ControllerCtrl; wxSpinCtrl *ValueCtrl; - + DECLARE_EVENT_TABLE() }; Modified: trunk/wired/src/midi/MidiFile.cpp =================================================================== --- trunk/wired/src/midi/MidiFile.cpp 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/midi/MidiFile.cpp 2010-05-03 19:25:56 UTC (rev 1569) @@ -46,7 +46,7 @@ /*** Classe MidiFileEvent ***/ /*************************************************************************************/ -MidiFileEvent::MidiFileEvent(unsigned long pos, unsigned char ID, unsigned char channel, +MidiFileEvent::MidiFileEvent(unsigned long pos, unsigned char ID, unsigned char channel, unsigned char p1, unsigned char p2) : Event(pos, ID) { this->Channel = channel; @@ -60,10 +60,10 @@ /*** Classe SysExEvent ***/ /*************************************************************************************/ -SysExEvent::SysExEvent(unsigned long pos, unsigned char ID, unsigned long len, +SysExEvent::SysExEvent(unsigned long pos, unsigned char ID, unsigned long len, unsigned char *data) : Event(pos, ID) { - this->len = len; + this->len = len; this->Type = SYSEX_EVENT_TYPE; this->data = (unsigned char *)malloc(len); this->Pos = pos; @@ -94,16 +94,16 @@ bytesWritten += midiFileHandle.Write(data, len); return (bytesWritten); } - + /*************************************************************************************/ /*** Classe NonMidiEvent ***/ /*************************************************************************************/ -NonMidiEvent::NonMidiEvent(unsigned long pos, unsigned char ID, unsigned long len, - unsigned char *data) : Event(pos, ID) +NonMidiEvent::NonMidiEvent(unsigned long pos, unsigned char ID, unsigned long len, + unsigned char *data) : Event(pos, ID) { - this->len = len; + this->len = len; this->Type = NONMIDI_EVENT_TYPE; this->data = (unsigned char *)malloc(len); this->Pos = pos; @@ -124,8 +124,8 @@ bytesWritten += midiFileHandle.Write(data, len); return (bytesWritten); } - + /*************************************************************************************/ /*** Classe MidiTrack ***/ /*************************************************************************************/ @@ -172,7 +172,7 @@ _filename = wxT(""); vector<MidiEvent *> evts; MaxPos = len; - + MidiTrack(evts, PPQN, _filename, Seq->Tracks.size()); } @@ -236,7 +236,7 @@ #ifdef __DEBUG__ cout << " is midi 1" << endl; #endif - Events.push_back(new MidiFileEvent(abs, ME_CODE(evttype), ME_CHANNEL(evttype), + Events.push_back(new MidiFileEvent(abs, ME_CODE(evttype), ME_CHANNEL(evttype), p1, buffer[ofs++])); break; case ME_PRGMCHANGE: @@ -244,7 +244,7 @@ #ifdef __DEBUG__ cout << " is midi 2" << endl; #endif - Events.push_back(new MidiFileEvent(abs, ME_CODE(evttype), ME_CHANNEL(evttype), + Events.push_back(new MidiFileEvent(abs, ME_CODE(evttype), ME_CHANNEL(evttype), p1, 0)); break; } @@ -435,7 +435,7 @@ /*** Classe MidiFile ***/ /*************************************************************************************/ -MidiFile::MidiFile(wxString filename, unsigned long long seqTrackIndex) +MidiFile::MidiFile(wxString filename, long long seqTrackIndex) { NbTracks = 0; Division = 0; @@ -586,7 +586,7 @@ { perror("[MidiFile] read"); MIDIFile.Close(); - return; + return; } Type = htons(Type); NbTracks = htons(NbTracks); Modified: trunk/wired/src/midi/MidiFile.h =================================================================== --- trunk/wired/src/midi/MidiFile.h 2010-05-03 19:22:39 UTC (rev 1568) +++ trunk/wired/src/midi/MidiFile.h 2010-05-03 19:25:56 UTC (rev 1569) @@ -225,7 +225,7 @@ class MidiFile { public: - MidiFile(wxString filename, unsigned long long wiredTrackIndex = -1); + MidiFile(wxString filename, long long wiredTrackIndex = -1); ~MidiFile(); void ReadMidiFile(); @@ -233,7 +233,7 @@ bool InsertMidiTrack(MidiTrack *track, unsigned short noTrack = 0); long GetNumberOfTracks() { return NbTracks; } long GetDivision() { return Division; } - MidiTrack *GetTrack(int num) { if ((num >= 0) && (num < NbTracks) && num < Tracks.size()) + MidiTrack *GetTrack(int num) { if ((num >= 0) && (num < (int)NbTracks) && num < (int)Tracks.size()) return Tracks[num]; else return NULL; } wxString GetFileName() { return (filename); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2010-05-03 19:27:28
|
Revision: 1570 http://wired.svn.sourceforge.net/wired/?rev=1570&view=rev Author: hdoomsday Date: 2010-05-03 19:27:21 +0000 (Mon, 03 May 2010) Log Message: ----------- [GUI] Added dialogbox if Wired was not installed. Modified Paths: -------------- trunk/wired/src/engine/version.h trunk/wired/src/gui/MainApp.cpp Modified: trunk/wired/src/engine/version.h =================================================================== --- trunk/wired/src/engine/version.h 2010-05-03 19:25:56 UTC (rev 1569) +++ trunk/wired/src/engine/version.h 2010-05-03 19:27:21 UTC (rev 1570) @@ -8,7 +8,7 @@ #define WIRED_TITLE (wxT("Wired 0.7.0")) #define WIRED_VERSION (wxT("0.7.0")) -#define WIRED_BUGS (wxT("http://sourceforge.net/projects/wired")) -#define WIRED_FORUMS (wxT("https://sourceforge.net/forum/?group_id=120022")) +#define WIRED_URL_BUGS (wxT("http://sourceforge.net/projects/wired")) +#define WIRED_URL_FORUMS (wxT("https://sourceforge.net/forum/?group_id=120022")) #endif // __VERSION_H__ Modified: trunk/wired/src/gui/MainApp.cpp =================================================================== --- trunk/wired/src/gui/MainApp.cpp 2010-05-03 19:25:56 UTC (rev 1569) +++ trunk/wired/src/gui/MainApp.cpp 2010-05-03 19:27:21 UTC (rev 1570) @@ -179,6 +179,17 @@ // alert dialog can use it before frame loading wxYield(); } + else + { + wxString errorText; + errorText = wxT("No images found. Have you correctly installed shared data ?\n" + "Please launch \"make install\" if you are on Linux or \"copydata.bat\"" + " if you are on Windows.\n" + "If failed, try to install with Wired Installer or submit issue to developers.\n" + "WIRED_URL_BUGS"); + errorText.Replace(wxT("WIRED_URL_BUGS"), WIRED_URL_BUGS); + AlertDialog(wxT("MainApp"), errorText); + } } else { @@ -289,11 +300,11 @@ { LOG; wxString welcome; - welcome = wxT("Welcome to WIRED_NAME vWIRED_VERSION !\nPlease note that WIRED_NAME is still under heavy development and that some of its features may not work fully and/or correctly yet.\n\nYour first step will be to configure your soundcard settings in the Edit/Settings dialog. Select your device, a 32 bits float sample format (as it is the only working option right now) and any sample rate and latency that your sound card supports. Please note that the smaller the latency value is set, the more real time WIRED_NAME will perform but setting it too low will cause drops and glitches. You can try different values and see which one is the best for your soundcard (2048 samples per buffer will be ok in most cases).\n\nYou will find a contextual Help at the bottom right corner of the WIRED_NAME window. If you move your mouse over a control, it will show you the help associated with this item. You can replace it by the WIRED_NAME Mixer by clicking on the tool icon in the top right corner of this area.\n\nIf you find any bug, please make a bug report at :\nWIRED_BUGS\n\nIf you need help or want to discuss about WIRED_NAME, pleast visit our web site and our forum :\nWIRED_FORUMS\nAny feedback is also appreciated.\n\nEnjoy the free music experience !"); + welcome = wxT("Welcome to WIRED_NAME vWIRED_VERSION !\nPlease note that WIRED_NAME is still under heavy development and that some of its features may not work fully and/or correctly yet.\n\nYour first step will be to configure your soundcard settings in the Edit/Settings dialog. Select your device, a 32 bits float sample format (as it is the only working option right now) and any sample rate and latency that your sound card supports. Please note that the smaller the latency value is set, the more real time WIRED_NAME will perform but setting it too low will cause drops and glitches. You can try different values and see which one is the best for your soundcard (2048 samples per buffer will be ok in most cases).\n\nYou will find a contextual Help at the bottom right corner of the WIRED_NAME window. If you move your mouse over a control, it will show you the help associated with this item. You can replace it by the WIRED_NAME Mixer by clicking on the tool icon in the top right corner of this area.\n\nIf you find any bug, please make a bug report at :\nWIRED_URL_BUGS\n\nIf you need help or want to discuss about WIRED_NAME, pleast visit our web site and our forum :\nWIRED_URL_FORUMS\nAny feedback is also appreciated.\n\nEnjoy the free music experience !"); welcome.Replace(wxT("WIRED_VERSION"), WIRED_VERSION); welcome.Replace(wxT("WIRED_NAME"), WIRED_NAME); - welcome.Replace(wxT("WIRED_BUGS"), WIRED_BUGS); - welcome.Replace(wxT("WIRED_FORUMS"), WIRED_FORUMS); + welcome.Replace(wxT("WIRED_URL_BUGS"), WIRED_URL_BUGS); + welcome.Replace(wxT("WIRED_URL_FORUMS"), WIRED_URL_FORUMS); wxMessageDialog msg(MainWin, welcome, WIRED_NAME, wxOK | wxICON_INFORMATION | wxCENTRE); msg.ShowModal(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hdo...@us...> - 2010-07-08 21:14:10
|
Revision: 1575 http://wired.svn.sourceforge.net/wired/?rev=1575&view=rev Author: hdoomsday Date: 2010-07-08 21:14:04 +0000 (Thu, 08 Jul 2010) Log Message: ----------- [COMPILE] Resolved issues with recent gcc Modified Paths: -------------- trunk/wired/src/editmidi/EditNote.cpp trunk/wired/src/libs/WiredWidgets/src/StaticBitmap.cpp Modified: trunk/wired/src/editmidi/EditNote.cpp =================================================================== --- trunk/wired/src/editmidi/EditNote.cpp 2010-05-31 18:02:58 UTC (rev 1574) +++ trunk/wired/src/editmidi/EditNote.cpp 2010-07-08 21:14:04 UTC (rev 1575) @@ -92,7 +92,7 @@ } } -BEGIN_EVENT_TABLE(EditNote, wxControl) +BEGIN_EVENT_TABLE(EditNote, wxPanel) EVT_PAINT(EditNote::OnPaint) EVT_MOTION(EditNote::OnMouseMove) EVT_LEFT_UP(EditNote::OnLeftUp) Modified: trunk/wired/src/libs/WiredWidgets/src/StaticBitmap.cpp =================================================================== --- trunk/wired/src/libs/WiredWidgets/src/StaticBitmap.cpp 2010-05-31 18:02:58 UTC (rev 1574) +++ trunk/wired/src/libs/WiredWidgets/src/StaticBitmap.cpp 2010-07-08 21:14:04 UTC (rev 1575) @@ -4,7 +4,7 @@ #include "StaticBitmap.h" -BEGIN_EVENT_TABLE(StaticBitmap, wxStaticText) +BEGIN_EVENT_TABLE(StaticBitmap, wxStaticBitmap) EVT_MOUSE_EVENTS(StaticBitmap::OnMouseEvent) END_EVENT_TABLE() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |