Changed the audio player interface to use pluggable factories and added audio player/provider to options (in a new page, where all advanced audio options were moved to)

Originally committed to SVN as r1107.
This commit is contained in:
Rodrigo Braz Monteiro 2007-04-22 01:23:25 +00:00
parent c6722b0587
commit b2f2cf2d7f
10 changed files with 272 additions and 331 deletions

View File

@ -820,7 +820,7 @@ void AudioDisplay::SetFile(wxString file, VideoProvider *vproviderLOL) {
provider = AudioProviderFactory::GetAudioProvider(file); provider = AudioProviderFactory::GetAudioProvider(file);
// Get player // Get player
player = AudioPlayer::GetAudioPlayer(); player = AudioPlayerFactory::GetAudioPlayer();
player->SetDisplayTimer(&UpdateTimer); player->SetDisplayTimer(&UpdateTimer);
player->SetProvider(provider); player->SetProvider(provider);
player->OpenStream(); player->OpenStream();
@ -931,7 +931,7 @@ void AudioDisplay::Play(int start,int end) {
provider = AudioProviderFactory::GetAudioProvider(VideoContext::Get()->videoName, 0); provider = AudioProviderFactory::GetAudioProvider(VideoContext::Get()->videoName, 0);
// Get player // Get player
player = AudioPlayer::GetAudioPlayer(); player = AudioPlayerFactory::GetAudioPlayer();
player->SetDisplayTimer(&UpdateTimer); player->SetDisplayTimer(&UpdateTimer);
player->SetProvider(provider); player->SetProvider(provider);
player->OpenStream(); player->OpenStream();

View File

@ -1,4 +1,4 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro // Copyright (c) 2005-2007, Rodrigo Braz Monteiro
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -37,14 +37,8 @@
/////////// ///////////
// Headers // Headers
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include "setup.h" #include "audio_player.h"
#if USE_PORTAUDIO == 1 #include "options.h"
#include "audio_player_portaudio.h"
#endif
#if USE_DIRECTSOUND == 1
#include "audio_player_dsound.h"
#endif
#include "audio_provider.h"
/////////////// ///////////////
@ -117,30 +111,31 @@ void AudioPlayer::OnStopAudio(wxCommandEvent &event) {
////////////// //////////////
// Get player // Get player
AudioPlayer* AudioPlayer::GetAudioPlayer() { AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
// Prepare // List of providers
AudioPlayer *player = NULL; wxArrayString list = GetFactoryList(Options.AsText(_T("Audio player")));
// None available
if (list.Count() == 0) throw _T("No audio players are available.");
// Get provider
wxString error;
for (unsigned int i=0;i<list.Count();i++) {
try { try {
// Get DirectSound player AudioPlayer *player = GetFactory(list[i])->CreatePlayer();
#if USE_DIRECTSOUND == 1 if (player) return player;
player = new DirectSoundPlayer;
#endif
// Get PortAudio player
#if USE_PORTAUDIO == 1
if (!player) player = new PortAudioPlayer;
#endif
} }
catch (...) { catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
delete player; catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
player = NULL; catch (...) { error += list[i] + _T(" factory: Unknown error\n"); }
throw;
} }
// Got player? // Failed
if (!player) throw _T("Unable to create audio player."); throw error;
// Return
return player;
} }
//////////
// Static
template <class AudioPlayerFactory> std::map<wxString,AudioPlayerFactory*>* AegisubFactory<AudioPlayerFactory>::factories=NULL;

View File

@ -1,4 +1,4 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro // Copyright (c) 2005-2007, Rodrigo Braz Monteiro
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -40,6 +40,7 @@
/////////// ///////////
// Headers // Headers
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include "factory.h"
////////////// //////////////
@ -86,12 +87,24 @@ public:
AudioProvider *GetProvider(); AudioProvider *GetProvider();
void SetDisplayTimer(wxTimer *timer); void SetDisplayTimer(wxTimer *timer);
static AudioPlayer* GetAudioPlayer();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
///////////
// Factory
class AudioPlayerFactory : public AegisubFactory<AudioPlayerFactory> {
protected:
virtual AudioPlayer *CreatePlayer()=0;
AudioPlayerFactory(wxString name) { RegisterFactory(name); }
public:
virtual ~AudioPlayerFactory() {}
static AudioPlayer *GetAudioPlayer();
};
///////// /////////
// Event // Event
DECLARE_EVENT_TYPE(wxEVT_STOP_AUDIO, -1) DECLARE_EVENT_TYPE(wxEVT_STOP_AUDIO, -1)

View File

@ -39,14 +39,98 @@
/////////// ///////////
// Headers // Headers
#include "setup.h"
#if USE_DIRECTSOUND == 1
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include "audio_player.h"
#include "audio_provider.h" #include "audio_provider.h"
#include "audio_player_dsound.h"
#include "utils.h" #include "utils.h"
#include "main.h" #include "main.h"
#include "frame_main.h" #include "frame_main.h"
#include "audio_player.h"
#include <mmsystem.h>
#include <dsound.h>
/////////////
// 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 // Increase the stopnotify by one, causing a wait for it to succeed
SetEvent(stopnotify); SetEvent(stopnotify);
} }
#endif

View File

@ -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 <mmsystem.h>
#include <dsound.h>
//////////////
// 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

View File

@ -1,4 +1,4 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro // Copyright (c) 2005-2007, Rodrigo Braz Monteiro
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -36,11 +36,84 @@
/////////// ///////////
// Headers // Headers
#include "setup.h" #include "audio_player.h"
#if USE_PORTAUDIO == 1
#include "audio_player_portaudio.h"
#include "audio_provider.h" #include "audio_provider.h"
#include "utils.h" #include "utils.h"
extern "C" {
#include <portaudio.h>
}
#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 (...) {} } catch (...) {}
} }
#endif

View File

@ -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 <portaudio.h>
}
#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

View File

@ -90,6 +90,7 @@ DialogOptions::DialogOptions(wxWindow *parent)
wxPanel *editPage = new wxPanel(book,-1); wxPanel *editPage = new wxPanel(book,-1);
wxPanel *videoPage = new wxPanel(book,-1); wxPanel *videoPage = new wxPanel(book,-1);
wxPanel *audioPage = new wxPanel(book,-1); wxPanel *audioPage = new wxPanel(book,-1);
wxPanel *audioAdvPage = new wxPanel(book,-1);
wxPanel *displayPage = new wxPanel(book,-1); wxPanel *displayPage = new wxPanel(book,-1);
wxPanel *autoPage = new wxPanel(book,-1); wxPanel *autoPage = new wxPanel(book,-1);
wxPanel *hotkeysPage = new wxPanel(book,-1); wxPanel *hotkeysPage = new wxPanel(book,-1);
@ -435,10 +436,8 @@ DialogOptions::DialogOptions(wxWindow *parent)
// Sizers // Sizers
wxSizer *audioMainSizer = new wxBoxSizer(wxVERTICAL); wxSizer *audioMainSizer = new wxBoxSizer(wxVERTICAL);
wxSizer *audioSizer1 = new wxStaticBoxSizer(wxVERTICAL,audioPage,_("Options")); 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 *audioSizer3 = new wxFlexGridSizer(4,2,5,5);
wxFlexGridSizer *audioSizer4 = new wxFlexGridSizer(4,2,5,5); wxFlexGridSizer *audioSizer4 = new wxFlexGridSizer(4,2,5,5);
wxFlexGridSizer *audioSizer5 = new wxFlexGridSizer(4,2,5,5);
wxControl *control; wxControl *control;
// First sizer // First sizer
@ -485,42 +484,10 @@ DialogOptions::DialogOptions(wxWindow *parent)
audioSizer4->Add(control,1,wxEXPAND,0); audioSizer4->Add(control,1,wxEXPAND,0);
audioSizer4->AddGrowableCol(0,1); 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 // Sizers
audioSizer1->Add(audioSizer3,0,wxEXPAND | wxALL,5); audioSizer1->Add(audioSizer3,0,wxEXPAND | wxALL,5);
audioSizer1->Add(audioSizer4,1,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(audioSizer1,0,wxEXPAND | wxALL,0);
audioMainSizer->Add(audioSizer2,0,wxEXPAND | wxTOP,5);
audioMainSizer->AddStretchSpacer(1); audioMainSizer->AddStretchSpacer(1);
audioMainSizer->Fit(audioPage); audioMainSizer->Fit(audioPage);
audioPage->SetSizer(audioMainSizer); audioPage->SetSizer(audioMainSizer);
@ -578,6 +545,67 @@ DialogOptions::DialogOptions(wxWindow *parent)
displayPage->SetSizer(displayMainSizer); 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 // Automation page
{ {
// Sizers // Sizers
@ -664,6 +692,7 @@ DialogOptions::DialogOptions(wxWindow *parent)
book->AddPage(videoPage,_("Video"),true); book->AddPage(videoPage,_("Video"),true);
book->AddPage(audioPage,_("Audio"),true); book->AddPage(audioPage,_("Audio"),true);
book->AddSubPage(displayPage,_("Display"),true); book->AddSubPage(displayPage,_("Display"),true);
book->AddSubPage(audioAdvPage,_("Advanced"),true);
book->AddPage(autoPage,_("Automation"),true); book->AddPage(autoPage,_("Automation"),true);
book->AddPage(hotkeysPage,_("Hotkeys"),true); book->AddPage(hotkeysPage,_("Hotkeys"),true);
#ifdef wxUSE_TREEBOOK #ifdef wxUSE_TREEBOOK

View File

@ -1,4 +1,4 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro // Copyright (c) 2005-2007, Rodrigo Braz Monteiro
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -172,6 +172,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) {
// Audio Advanced // Audio Advanced
SetModificationType(MOD_AUDIO_RELOAD); SetModificationType(MOD_AUDIO_RELOAD);
SetInt(_T("Audio Cache"),1); SetInt(_T("Audio Cache"),1);
SetText(_T("Audio Player"),_T("dsound"));
SetText(_T("Audio Provider"),_T("avisynth")); SetText(_T("Audio Provider"),_T("avisynth"));
SetText(_T("Audio Downmixer"),_T("ConvertToMono")); SetText(_T("Audio Downmixer"),_T("ConvertToMono"));
SetText(_T("Audio HD Cache Location"),_T("default")); SetText(_T("Audio HD Cache Location"),_T("default"));

View File

@ -83,13 +83,6 @@
#endif // wxWidgets #endif // wxWidgets
/////////////
// Scintilla
#ifdef __WXDEBUG__
#else
#endif
//////////////////////////// ////////////////////////////
// Standard Win32 Libraries // Standard Win32 Libraries
#pragma comment(lib, "Vfw32.lib") #pragma comment(lib, "Vfw32.lib")
@ -100,30 +93,6 @@
#pragma comment(lib, "wsock32.lib") #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 // Hunspell
#if USE_HUNSPELL == 1 #if USE_HUNSPELL == 1