diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index 4c8d95a7c..c697c10c4 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -820,7 +820,7 @@ void AudioDisplay::SetFile(wxString file, VideoProvider *vproviderLOL) { provider = AudioProviderFactory::GetAudioProvider(file); // Get player - player = AudioPlayer::GetAudioPlayer(); + player = AudioPlayerFactory::GetAudioPlayer(); player->SetDisplayTimer(&UpdateTimer); player->SetProvider(provider); player->OpenStream(); @@ -931,7 +931,7 @@ void AudioDisplay::Play(int start,int end) { provider = AudioProviderFactory::GetAudioProvider(VideoContext::Get()->videoName, 0); // Get player - player = AudioPlayer::GetAudioPlayer(); + player = AudioPlayerFactory::GetAudioPlayer(); player->SetDisplayTimer(&UpdateTimer); player->SetProvider(provider); player->OpenStream(); diff --git a/aegisub/audio_player.cpp b/aegisub/audio_player.cpp index ad2b3cf57..094da8f84 100644 --- a/aegisub/audio_player.cpp +++ b/aegisub/audio_player.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro +// Copyright (c) 2005-2007, Rodrigo Braz Monteiro // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -37,14 +37,8 @@ /////////// // Headers #include -#include "setup.h" -#if USE_PORTAUDIO == 1 -#include "audio_player_portaudio.h" -#endif -#if USE_DIRECTSOUND == 1 -#include "audio_player_dsound.h" -#endif -#include "audio_provider.h" +#include "audio_player.h" +#include "options.h" /////////////// @@ -117,30 +111,31 @@ void AudioPlayer::OnStopAudio(wxCommandEvent &event) { ////////////// // Get player -AudioPlayer* AudioPlayer::GetAudioPlayer() { - // Prepare - AudioPlayer *player = NULL; +AudioPlayer* AudioPlayerFactory::GetAudioPlayer() { + // List of providers + wxArrayString list = GetFactoryList(Options.AsText(_T("Audio player"))); - try { - // Get DirectSound player - #if USE_DIRECTSOUND == 1 - player = new DirectSoundPlayer; - #endif + // None available + if (list.Count() == 0) throw _T("No audio players are available."); - // Get PortAudio player - #if USE_PORTAUDIO == 1 - if (!player) player = new PortAudioPlayer; - #endif - } - catch (...) { - delete player; - player = NULL; - throw; + // Get provider + wxString error; + for (unsigned int i=0;iCreatePlayer(); + if (player) return player; + } + catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); } + catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); } + catch (...) { error += list[i] + _T(" factory: Unknown error\n"); } } - // Got player? - if (!player) throw _T("Unable to create audio player."); - - // Return - return player; + // Failed + throw error; } + + +////////// +// Static +template std::map* AegisubFactory::factories=NULL; + diff --git a/aegisub/audio_player.h b/aegisub/audio_player.h index e8dec850e..4e2ce13d9 100644 --- a/aegisub/audio_player.h +++ b/aegisub/audio_player.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro +// Copyright (c) 2005-2007, Rodrigo Braz Monteiro // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ /////////// // Headers #include +#include "factory.h" ////////////// @@ -86,12 +87,24 @@ public: AudioProvider *GetProvider(); void SetDisplayTimer(wxTimer *timer); - static AudioPlayer* GetAudioPlayer(); DECLARE_EVENT_TABLE() }; +/////////// +// Factory +class AudioPlayerFactory : public AegisubFactory { +protected: + virtual AudioPlayer *CreatePlayer()=0; + AudioPlayerFactory(wxString name) { RegisterFactory(name); } + +public: + virtual ~AudioPlayerFactory() {} + static AudioPlayer *GetAudioPlayer(); +}; + + ///////// // Event DECLARE_EVENT_TYPE(wxEVT_STOP_AUDIO, -1) diff --git a/aegisub/audio_player_dsound.cpp b/aegisub/audio_player_dsound.cpp index 61a8e961d..8874c3296 100644 --- a/aegisub/audio_player_dsound.cpp +++ b/aegisub/audio_player_dsound.cpp @@ -39,14 +39,98 @@ /////////// // Headers -#include "setup.h" -#if USE_DIRECTSOUND == 1 #include +#include "audio_player.h" #include "audio_provider.h" -#include "audio_player_dsound.h" #include "utils.h" #include "main.h" #include "frame_main.h" +#include "audio_player.h" +#include +#include + + +///////////// +// Libraries +#pragma comment(lib, "dsound.lib") +#pragma comment(lib, "dxguid.lib") + + +////////////// +// Prototypes +class DirectSoundPlayer; + + +////////// +// Thread +class DirectSoundPlayerThread : public wxThread { +private: + DirectSoundPlayer *parent; + HANDLE stopnotify; + +public: + void Stop(); // Notify thread to stop audio playback. Thread safe. + DirectSoundPlayerThread(DirectSoundPlayer *parent); + ~DirectSoundPlayerThread(); + + wxThread::ExitCode Entry(); +}; + + +//////////////////// +// Portaudio player +class DirectSoundPlayer : public AudioPlayer { + friend class DirectSoundPlayerThread; + +private: + volatile bool playing; + float volume; + int offset; + DWORD bufSize; + + volatile __int64 playPos; + __int64 startPos; + volatile __int64 endPos; + DWORD startTime; + + IDirectSound8 *directSound; + IDirectSoundBuffer8 *buffer; + + bool FillBuffer(bool fill); + + DirectSoundPlayerThread *thread; + +public: + DirectSoundPlayer(); + ~DirectSoundPlayer(); + + void OpenStream(); + void CloseStream(); + + void Play(__int64 start,__int64 count); + void Stop(bool timerToo=true); + bool IsPlaying() { return playing; } + + __int64 GetStartPosition() { return startPos; } + __int64 GetEndPosition() { return endPos; } + __int64 GetCurrentPosition(); + void SetEndPosition(__int64 pos); + void SetCurrentPosition(__int64 pos); + + void SetVolume(double vol) { volume = vol; } + double GetVolume() { return volume; } + + //wxMutex *GetMutex() { return &DSMutex; } +}; + + +/////////// +// Factory +class DirectSoundPlayerFactory : public AudioPlayerFactory { +public: + AudioPlayer *CreatePlayer() { return new DirectSoundPlayer(); } + DirectSoundPlayerFactory() : AudioPlayerFactory(_T("dsound")) {} +} registerDirectSoundPlayer; /////////////// @@ -379,5 +463,3 @@ void DirectSoundPlayerThread::Stop() { // Increase the stopnotify by one, causing a wait for it to succeed SetEvent(stopnotify); } - -#endif diff --git a/aegisub/audio_player_dsound.h b/aegisub/audio_player_dsound.h deleted file mode 100644 index d1f3ee286..000000000 --- a/aegisub/audio_player_dsound.h +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2006, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ----------------------------------------------------------------------------- -// -// AEGISUB -// -// Website: http://aegisub.cellosoft.com -// Contact: mailto:zeratul@cellosoft.com -// - - -#pragma once - - -/////////// -// Headers -#include "setup.h" -#if USE_DIRECTSOUND == 1 -#include "audio_player.h" -#include -#include - - -////////////// -// Prototypes -class DirectSoundPlayer; - - -////////// -// Thread -class DirectSoundPlayerThread : public wxThread { -private: - DirectSoundPlayer *parent; - HANDLE stopnotify; - -public: - void Stop(); // Notify thread to stop audio playback. Thread safe. - DirectSoundPlayerThread(DirectSoundPlayer *parent); - ~DirectSoundPlayerThread(); - - wxThread::ExitCode Entry(); -}; - - -//////////////////// -// Portaudio player -class DirectSoundPlayer : public AudioPlayer { - friend class DirectSoundPlayerThread; - -private: - volatile bool playing; - float volume; - int offset; - DWORD bufSize; - - volatile __int64 playPos; - __int64 startPos; - volatile __int64 endPos; - DWORD startTime; - - IDirectSound8 *directSound; - IDirectSoundBuffer8 *buffer; - - bool FillBuffer(bool fill); - - DirectSoundPlayerThread *thread; - -public: - DirectSoundPlayer(); - ~DirectSoundPlayer(); - - void OpenStream(); - void CloseStream(); - - void Play(__int64 start,__int64 count); - void Stop(bool timerToo=true); - bool IsPlaying() { return playing; } - - __int64 GetStartPosition() { return startPos; } - __int64 GetEndPosition() { return endPos; } - __int64 GetCurrentPosition(); - void SetEndPosition(__int64 pos); - void SetCurrentPosition(__int64 pos); - - void SetVolume(double vol) { volume = vol; } - double GetVolume() { return volume; } - - //wxMutex *GetMutex() { return &DSMutex; } -}; - -#endif diff --git a/aegisub/audio_player_portaudio.cpp b/aegisub/audio_player_portaudio.cpp index 5104f0aff..3d9755f99 100644 --- a/aegisub/audio_player_portaudio.cpp +++ b/aegisub/audio_player_portaudio.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro +// Copyright (c) 2005-2007, Rodrigo Braz Monteiro // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -36,11 +36,84 @@ /////////// // Headers -#include "setup.h" -#if USE_PORTAUDIO == 1 -#include "audio_player_portaudio.h" +#include "audio_player.h" #include "audio_provider.h" #include "utils.h" +extern "C" { +#include +} + +#ifdef HAVE_PA_GETSTREAMTIME +#define Pa_StreamTime Pa_GetStreamTime /* PortAudio v19 */ +#define PaTimestamp PaTime +#endif + + +/////////// +// Library +#if __VISUALC__ >= 1200 +#pragma comment(lib,"portaudio.lib") +#endif + + +//////////////////// +// Portaudio player +class PortAudioPlayer : public AudioPlayer { +private: + static int pa_refcount; + wxMutex PAMutex; + volatile bool stopping; + //bool softStop; + bool playing; + float volume; + + volatile __int64 playPos; + volatile __int64 startPos; + volatile __int64 endPos; + void *stream; + PaTimestamp paStart; + volatile __int64 realPlayPos; + +#ifndef HAVE_PA_GETSTREAMTIME + static int paCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, PaTimestamp outTime, void *userData); +#else + static int paCallback(const void *inputBuffer, void *outputBuffer, + unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo *timei, + PaStreamCallbackFlags flags, void *userData); +#endif + +public: + PortAudioPlayer(); + ~PortAudioPlayer(); + + void OpenStream(); + void CloseStream(); + + void Play(__int64 start,__int64 count); + void Stop(bool timerToo=true); + bool IsPlaying() { return playing; } + + __int64 GetStartPosition() { return startPos; } + __int64 GetEndPosition() { return endPos; } + __int64 GetCurrentPosition() { return realPlayPos; } + void SetEndPosition(__int64 pos) { endPos = pos; } + void SetCurrentPosition(__int64 pos) { playPos = pos; realPlayPos = pos; } + + void SetVolume(double vol) { volume = vol; } + double GetVolume() { return volume; } + + wxMutex *GetMutex() { return &PAMutex; } +}; + + +/////////// +// Factory +class PortAudioPlayerFactory : public AudioPlayerFactory { +public: + AudioPlayer *CreatePlayer() { return new PortAudioPlayer(); } + PortAudioPlayerFactory() : AudioPlayerFactory(_T("portaudio")) {} +} registerPortAudioPlayer; ///////////////////// @@ -205,4 +278,3 @@ void PortAudioPlayer::CloseStream() { } catch (...) {} } -#endif diff --git a/aegisub/audio_player_portaudio.h b/aegisub/audio_player_portaudio.h deleted file mode 100644 index 0937fe55d..000000000 --- a/aegisub/audio_player_portaudio.h +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ----------------------------------------------------------------------------- -// -// AEGISUB -// -// Website: http://aegisub.cellosoft.com -// Contact: mailto:zeratul@cellosoft.com -// - - -#pragma once - - -/////////// -// Headers -#include "setup.h" -#if USE_PORTAUDIO == 1 -#include "audio_player.h" -extern "C" { -#include -} - -#ifdef HAVE_PA_GETSTREAMTIME -#define Pa_StreamTime Pa_GetStreamTime /* PortAudio v19 */ -#define PaTimestamp PaTime -#endif - -//////////////////// -// Portaudio player -class PortAudioPlayer : public AudioPlayer { -private: - static int pa_refcount; - wxMutex PAMutex; - volatile bool stopping; - //bool softStop; - bool playing; - float volume; - - volatile __int64 playPos; - volatile __int64 startPos; - volatile __int64 endPos; - void *stream; - PaTimestamp paStart; - volatile __int64 realPlayPos; - -#ifndef HAVE_PA_GETSTREAMTIME - static int paCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, PaTimestamp outTime, void *userData); -#else - static int paCallback(const void *inputBuffer, void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo *timei, - PaStreamCallbackFlags flags, void *userData); -#endif - -public: - PortAudioPlayer(); - ~PortAudioPlayer(); - - void OpenStream(); - void CloseStream(); - - void Play(__int64 start,__int64 count); - void Stop(bool timerToo=true); - bool IsPlaying() { return playing; } - - __int64 GetStartPosition() { return startPos; } - __int64 GetEndPosition() { return endPos; } - __int64 GetCurrentPosition() { return realPlayPos; } - void SetEndPosition(__int64 pos) { endPos = pos; } - void SetCurrentPosition(__int64 pos) { playPos = pos; realPlayPos = pos; } - - void SetVolume(double vol) { volume = vol; } - double GetVolume() { return volume; } - - wxMutex *GetMutex() { return &PAMutex; } -}; - -#endif diff --git a/aegisub/dialog_options.cpp b/aegisub/dialog_options.cpp index b5ab56388..11841bad1 100644 --- a/aegisub/dialog_options.cpp +++ b/aegisub/dialog_options.cpp @@ -90,6 +90,7 @@ DialogOptions::DialogOptions(wxWindow *parent) wxPanel *editPage = new wxPanel(book,-1); wxPanel *videoPage = new wxPanel(book,-1); wxPanel *audioPage = new wxPanel(book,-1); + wxPanel *audioAdvPage = new wxPanel(book,-1); wxPanel *displayPage = new wxPanel(book,-1); wxPanel *autoPage = new wxPanel(book,-1); wxPanel *hotkeysPage = new wxPanel(book,-1); @@ -435,10 +436,8 @@ DialogOptions::DialogOptions(wxWindow *parent) // Sizers wxSizer *audioMainSizer = new wxBoxSizer(wxVERTICAL); wxSizer *audioSizer1 = new wxStaticBoxSizer(wxVERTICAL,audioPage,_("Options")); - wxSizer *audioSizer2 = new wxStaticBoxSizer(wxVERTICAL,audioPage,_("Advanced - EXPERT USERS ONLY")); wxFlexGridSizer *audioSizer3 = new wxFlexGridSizer(4,2,5,5); wxFlexGridSizer *audioSizer4 = new wxFlexGridSizer(4,2,5,5); - wxFlexGridSizer *audioSizer5 = new wxFlexGridSizer(4,2,5,5); wxControl *control; // First sizer @@ -485,42 +484,10 @@ DialogOptions::DialogOptions(wxWindow *parent) audioSizer4->Add(control,1,wxEXPAND,0); audioSizer4->AddGrowableCol(0,1); - // Third sizer - wxString choices2[3] = { _("None (NOT RECOMMENDED)"), _("RAM"), _("Hard Disk") }; - control = new wxComboBox(audioPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices2,wxCB_READONLY | wxCB_DROPDOWN); - Bind(control,_T("Audio Cache")); - audioSizer5->Add(new wxStaticText(audioPage,-1,_("Cache type: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); - audioSizer5->Add(control,1,wxEXPAND,0); - wxString choices3[3] = { _T("ConvertToMono"), _T("GetLeftChannel"), _T("GetRightChannel") }; - control = new wxComboBox(audioPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices3,wxCB_DROPDOWN); - Bind(control,_T("Audio Downmixer")); - audioSizer5->Add(new wxStaticText(audioPage,-1,_("Avisynth down-mixer: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); - audioSizer5->Add(control,1,wxEXPAND,0); - control = new wxTextCtrl(audioPage,-1); - Bind(control,_T("Audio HD Cache Location")); - audioSizer5->Add(new wxStaticText(audioPage,-1,_("HD cache path: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); - audioSizer5->Add(control,1,wxEXPAND,0); - control = new wxTextCtrl(audioPage,-1); - Bind(control,_T("Audio HD Cache Name")); - audioSizer5->Add(new wxStaticText(audioPage,-1,_("HD cache name: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); - audioSizer5->Add(control,1,wxEXPAND,0); - control = new wxTextCtrl(audioPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,0,NumValidator()); - Bind(control,_T("Audio Spectrum Cutoff")); - audioSizer5->Add(new wxStaticText(audioPage,-1,_("Spectrum cutoff: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); - audioSizer5->Add(control,1,wxEXPAND,0); - control = new wxTextCtrl(audioPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,0,NumValidator()); - Bind(control,_T("Audio Spectrum Window")); - audioSizer5->Add(new wxStaticText(audioPage,-1,_("Spectrum FFT window exponent: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); - audioSizer5->Add(control,1,wxEXPAND,0); - audioSizer5->AddGrowableCol(0,1); - // Sizers audioSizer1->Add(audioSizer3,0,wxEXPAND | wxALL,5); audioSizer1->Add(audioSizer4,1,wxEXPAND | wxALL,5); - audioSizer2->Add(new wxStaticText(audioPage,-1,_("WARNING: Changing these settings might result in bugs,\ncrashes, glitches and/or movax.\nDon't touch these unless you know what you're doing.")),0,wxEXPAND | wxALL,5); - audioSizer2->Add(audioSizer5,1,wxEXPAND | wxALL,5); audioMainSizer->Add(audioSizer1,0,wxEXPAND | wxALL,0); - audioMainSizer->Add(audioSizer2,0,wxEXPAND | wxTOP,5); audioMainSizer->AddStretchSpacer(1); audioMainSizer->Fit(audioPage); audioPage->SetSizer(audioMainSizer); @@ -578,6 +545,67 @@ DialogOptions::DialogOptions(wxWindow *parent) displayPage->SetSizer(displayMainSizer); } + // Audio advanced page + { + // Sizers + wxFlexGridSizer *audioAdvSizer1 = new wxFlexGridSizer(6,2,5,5); + wxSizer *audioAdvSizer2 = new wxStaticBoxSizer(wxVERTICAL,audioAdvPage,_("Advanced - EXPERT USERS ONLY")); + wxSizer *audioAdvSizer3 = new wxBoxSizer(wxVERTICAL); + + // Controls + wxControl *control; + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("Audio provider: ")),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10); + control = new wxComboBox(audioAdvPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,AudioProviderFactory::GetFactoryList(),wxCB_DROPDOWN | wxCB_READONLY); + Bind(control,_T("Audio provider"),1); + audioAdvSizer1->Add(control,1,wxEXPAND); + + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("Audio player: ")),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10); + control = new wxComboBox(audioAdvPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,AudioPlayerFactory::GetFactoryList(),wxCB_DROPDOWN | wxCB_READONLY); + Bind(control,_T("Audio player"),1); + audioAdvSizer1->Add(control,1,wxEXPAND); + + wxString choices2[3] = { _("None (NOT RECOMMENDED)"), _("RAM"), _("Hard Disk") }; + control = new wxComboBox(audioAdvPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices2,wxCB_READONLY | wxCB_DROPDOWN); + Bind(control,_T("Audio Cache")); + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("Cache type: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); + audioAdvSizer1->Add(control,1,wxEXPAND,0); + + wxString choices3[3] = { _T("ConvertToMono"), _T("GetLeftChannel"), _T("GetRightChannel") }; + control = new wxComboBox(audioAdvPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices3,wxCB_DROPDOWN); + Bind(control,_T("Audio Downmixer")); + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("Avisynth down-mixer: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); + audioAdvSizer1->Add(control,1,wxEXPAND,0); + + control = new wxTextCtrl(audioAdvPage,-1); + Bind(control,_T("Audio HD Cache Location")); + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("HD cache path: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); + audioAdvSizer1->Add(control,1,wxEXPAND,0); + control = new wxTextCtrl(audioAdvPage,-1); + + Bind(control,_T("Audio HD Cache Name")); + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("HD cache name: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); + audioAdvSizer1->Add(control,1,wxEXPAND,0); + + control = new wxTextCtrl(audioAdvPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,0,NumValidator()); + Bind(control,_T("Audio Spectrum Cutoff")); + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("Spectrum cutoff: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); + audioAdvSizer1->Add(control,1,wxEXPAND,0); + + control = new wxTextCtrl(audioAdvPage,-1,_T(""),wxDefaultPosition,wxDefaultSize,0,NumValidator()); + Bind(control,_T("Audio Spectrum Window")); + audioAdvSizer1->Add(new wxStaticText(audioAdvPage,-1,_("Spectrum FFT window exponent: ")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,5); + audioAdvSizer1->Add(control,1,wxEXPAND,0); + audioAdvSizer1->AddGrowableCol(0,1); + + // Main sizer + audioAdvSizer2->Add(new wxStaticText(audioAdvPage,-1,_("WARNING: Changing these settings might result in bugs,\ncrashes, glitches and/or movax.\nDon't touch these unless you know what you're doing.")),0,wxEXPAND | wxALL,5); + audioAdvSizer2->Add(audioAdvSizer1,1,wxEXPAND | wxALL,5); + audioAdvSizer3->Add(audioAdvSizer2,0,wxEXPAND); + audioAdvSizer3->AddStretchSpacer(1); + audioAdvSizer3->Fit(audioAdvPage); + audioAdvPage->SetSizer(audioAdvSizer3); + } + // Automation page { // Sizers @@ -664,6 +692,7 @@ DialogOptions::DialogOptions(wxWindow *parent) book->AddPage(videoPage,_("Video"),true); book->AddPage(audioPage,_("Audio"),true); book->AddSubPage(displayPage,_("Display"),true); + book->AddSubPage(audioAdvPage,_("Advanced"),true); book->AddPage(autoPage,_("Automation"),true); book->AddPage(hotkeysPage,_("Hotkeys"),true); #ifdef wxUSE_TREEBOOK diff --git a/aegisub/options.cpp b/aegisub/options.cpp index 35bdc1743..5c5ef4706 100644 --- a/aegisub/options.cpp +++ b/aegisub/options.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro +// Copyright (c) 2005-2007, Rodrigo Braz Monteiro // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -172,6 +172,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) { // Audio Advanced SetModificationType(MOD_AUDIO_RELOAD); SetInt(_T("Audio Cache"),1); + SetText(_T("Audio Player"),_T("dsound")); SetText(_T("Audio Provider"),_T("avisynth")); SetText(_T("Audio Downmixer"),_T("ConvertToMono")); SetText(_T("Audio HD Cache Location"),_T("default")); diff --git a/aegisub/setup.cpp b/aegisub/setup.cpp index 90f9be437..d0a65f36b 100644 --- a/aegisub/setup.cpp +++ b/aegisub/setup.cpp @@ -83,13 +83,6 @@ #endif // wxWidgets -///////////// -// Scintilla -#ifdef __WXDEBUG__ -#else -#endif - - //////////////////////////// // Standard Win32 Libraries #pragma comment(lib, "Vfw32.lib") @@ -100,30 +93,6 @@ #pragma comment(lib, "wsock32.lib") -/////////////// -// DirectSound -#if USE_DIRECTSOUND == 1 -#pragma comment(lib, "dsound.lib") -#pragma comment(lib, "dxguid.lib") -#endif - - -///////////// -// PortAudio -#if USE_PORTAUDIO == 1 -#pragma comment(lib,"portaudio.lib") -#endif - - -/////// -// Lua -//#ifdef __WXDEBUG__ -//#pragma comment(lib,"lua503d.lib") -//#else -//#pragma comment(lib,"lua503.lib") -//#endif - - //////////// // Hunspell #if USE_HUNSPELL == 1