summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/WinterSpeak/general
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/!NotAdopted/WinterSpeak/general')
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/debug/debug.h21
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/debug/debug_file.h94
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/debug/debug_window.h111
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/general.dsp214
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/general.dsw33
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/general.rc104
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.cpp157
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.h62
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/observer/observer.cpp19
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/observer/observer.h30
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/observer/subject.cpp77
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/observer/subject.h52
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/optimise/aggressive_optimise.h29
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/resource.h22
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.cpp327
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.h103
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.cpp57
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.h44
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.cpp311
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.h97
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.cpp99
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.h50
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.cpp17
-rw-r--r--plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.h88
24 files changed, 2218 insertions, 0 deletions
diff --git a/plugins/!NotAdopted/WinterSpeak/general/debug/debug.h b/plugins/!NotAdopted/WinterSpeak/general/debug/debug.h
new file mode 100644
index 0000000000..a50189cf97
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/debug/debug.h
@@ -0,0 +1,21 @@
+#ifndef guard_general_debug_debug_h
+#define guard_general_debug_debug_h
+//==============================================================================
+
+//------------------------------------------------------------------------------
+#ifdef _DEBUG
+
+ #include <iostream>
+
+ #define CLASSCERR(string) (std::cerr << this << " " << string << std::endl)
+ #define CERR(string) (std::cerr << " " << string << std::endl)
+
+#else
+
+ #define CLASSCERR(string)
+ #define CERR(string)
+
+#endif
+
+//==============================================================================
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/debug/debug_file.h b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_file.h
new file mode 100644
index 0000000000..1e5c9f7671
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_file.h
@@ -0,0 +1,94 @@
+#ifndef guard_general_debug_debug_file_h
+#define guard_general_debug_debug_file_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#ifdef _DEBUG
+//==============================================================================
+
+#include <fstream>
+
+//------------------------------------------------------------------------------
+template <class charT, class traits = std::char_traits<charT> >
+class FileStreamBuf : public std::basic_streambuf<charT, traits>
+{
+ public:
+ FileStreamBuf()
+ :
+ m_output()
+ {
+// m_output.open("speak_output.txt", std::ios_base::app);
+ m_output.open("speak_output.txt");
+ }
+
+ ~FileStreamBuf()
+ {
+ m_output.close();
+ }
+
+ protected:
+ virtual int_type overflow(int_type c)
+ {
+ if (!traits_type::eq_int_type(c, traits_type::eof()))
+ {
+ m_buffer += c;
+
+ if (c == '\n')
+ {
+ m_output << m_buffer.c_str();
+ m_output.flush();
+
+ m_buffer.erase();
+ }
+
+ return c;
+ }
+
+ return traits_type::not_eof(c);
+ }
+
+ private:
+ // assignment and copy are undefined in iostreams and so we hide them.
+ FileStreamBuf(const FileStreamBuf &);
+ FileStreamBuf & operator=(const FileStreamBuf &);
+
+ std::ofstream m_output;
+ std::string m_buffer;
+};
+
+//------------------------------------------------------------------------------
+class DebugFile : public std::ostream
+{
+ public:
+ DebugFile()
+ :
+ std::basic_ostream<char>(&m_stream_buf)
+ {
+ // redirect cerr to our debug window
+ std::cerr = *this;
+ }
+
+ virtual ~DebugFile()
+ {
+ m_stream_buf.pubsync();
+ }
+
+ private:
+ FileStreamBuf<char> m_stream_buf;
+
+ DebugFile(const DebugFile &);
+ DebugFile & operator=(const DebugFile &);
+};
+
+//==============================================================================
+//
+// Summary : Output debug to a file
+//
+// Description : Provides a target to place our debugging information
+//
+//==============================================================================
+
+#endif
+
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/debug/debug_window.h b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_window.h
new file mode 100644
index 0000000000..43f15e4522
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_window.h
@@ -0,0 +1,111 @@
+#ifndef guard_general_debug_debug_window_h
+#define guard_general_debug_debug_window_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#ifdef _DEBUG
+//==============================================================================
+
+#include <windows.h>
+
+#include <iostream>
+#include <string>
+
+//------------------------------------------------------------------------------
+template <class charT, class traits = std::char_traits<charT> >
+class WindowStreamBuf : public std::basic_streambuf<charT, traits>
+{
+ public:
+ WindowStreamBuf()
+ {
+ // create the window to put our debug into
+ m_debug_window = CreateWindow(
+ "Listbox",
+ "Debug Window",
+ WS_OVERLAPPEDWINDOW | WS_VSCROLL,
+ 5,
+ 5,
+ 400,
+ 600,
+ (HWND) NULL,
+ (HMENU) NULL,
+ NULL,
+ (LPVOID) NULL);
+
+ ShowWindow(m_debug_window, SW_SHOW);
+ }
+
+ protected:
+ virtual int_type overflow(int_type c)
+ {
+ if (!traits_type::eq_int_type(c, traits_type::eof()))
+ {
+ if (c == '\n')
+ {
+ // add the string to the window
+ SendMessage(m_debug_window, LB_ADDSTRING, 0,
+ (long)m_buffer.c_str());
+
+ // select the last string added
+ int c = SendMessage(m_debug_window, LB_GETCOUNT, 0,
+ (long)m_buffer.c_str());
+ SendMessage(m_debug_window, LB_SETCURSEL, c - 1, 0);
+
+ m_buffer.erase(m_buffer.begin(), m_buffer.end());
+ }
+ else
+ {
+ m_buffer += c;
+ }
+
+ return c;
+ }
+
+ return traits_type::not_eof(c);
+ }
+
+ private:
+ // assignment and copy are undefined in iostreams and so we hide them.
+ WindowStreamBuf(const WindowStreamBuf &);
+ WindowStreamBuf & operator=(const WindowStreamBuf &);
+
+ HWND m_debug_window;
+ std::string m_buffer;
+};
+
+//------------------------------------------------------------------------------
+class DebugWindow : public std::ostream
+{
+ public:
+ DebugWindow()
+ :
+ std::basic_ostream<char>(&m_stream_buf)
+ {
+ // redirect cerr to our debug window
+ std::cerr = *this;
+ }
+
+ virtual ~DebugWindow()
+ {
+ m_stream_buf.pubsync();
+ }
+
+ private:
+ WindowStreamBuf<char> m_stream_buf;
+
+ DebugWindow(const DebugWindow &);
+ DebugWindow & operator=(const DebugWindow &);
+};
+
+//==============================================================================
+//
+// Summary : Create a debug window
+//
+// Description : Provides a target to place our debugging information
+//
+//==============================================================================
+
+#endif
+
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/general.dsp b/plugins/!NotAdopted/WinterSpeak/general/general.dsp
new file mode 100644
index 0000000000..f268d44f9a
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/general.dsp
@@ -0,0 +1,214 @@
+# Microsoft Developer Studio Project File - Name="general" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=general - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "general.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "general.mak" CFG="general - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "general - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "general - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/general/vc_project", SKBAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "general - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Build\Release"
+# PROP Intermediate_Dir "Build\Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"
+# ADD RSC /l 0xc09 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "general - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Build\Debug"
+# PROP Intermediate_Dir "Build\Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gi /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"
+# ADD RSC /l 0xc09 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "general - Win32 Release"
+# Name "general - Win32 Debug"
+# Begin Group "Source"
+
+# PROP Default_Filter ""
+# Begin Group "optimize"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\optimise\aggressive_optimise.h
+# End Source File
+# End Group
+# Begin Group "text_to_speech"
+
+# PROP Default_Filter ""
+# Begin Group "speech_api_51"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51_lexicon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51_lexicon.h
+# End Source File
+# End Group
+# Begin Group "speech_api_40a"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a_lexicon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a_lexicon.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\text_to_speech\text_to_speech\text_to_speech.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\text_to_speech\text_to_speech.h
+# End Source File
+# End Group
+# Begin Group "debug"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\debug\debug.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\debug\debug_file.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\debug\debug_window.h
+# End Source File
+# End Group
+# Begin Group "observer"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\observer\observer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\observer\observer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\observer\subject.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\observer\subject.h
+# End Source File
+# End Group
+# Begin Group "multimedia"
+
+# PROP Default_Filter ""
+# Begin Group "winamp_2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\multimedia\winamp_2\winamp_2.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\multimedia\winamp_2\winamp_2.h
+# End Source File
+# End Group
+# End Group
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\general.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/plugins/!NotAdopted/WinterSpeak/general/general.dsw b/plugins/!NotAdopted/WinterSpeak/general/general.dsw
new file mode 100644
index 0000000000..7c17a5108b
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/general.dsw
@@ -0,0 +1,33 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "general"=.\general.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+ begin source code control
+ "$/general", AIBAAAAA
+ .
+ end source code control
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/plugins/!NotAdopted/WinterSpeak/general/general.rc b/plugins/!NotAdopted/WinterSpeak/general/general.rc
new file mode 100644
index 0000000000..9a0dee8466
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/general.rc
@@ -0,0 +1,104 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_TTS_LEXICON DIALOG DISCARDABLE 0, 0, 262, 186
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL "List2",IDC_TTS_LEXICON_LIST,"SysListView32",LVS_REPORT |
+ WS_BORDER | WS_TABSTOP,7,7,247,135
+ EDITTEXT IDC_TTS_LEXICON_ORIGINAL,7,147,118,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_TTS_LEXICON_FINAL,131,147,123,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Add",IDC_TTS_LEXICON_ADD,61,164,50,15
+ PUSHBUTTON "Remove",IDC_TTS_LEXICON_REMOVE,116,164,50,15
+ PUSHBUTTON "Test",IDC_TTS_LEXICON_TEST,7,164,50,15
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_TTS_LEXICON, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 254
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 179
+ HORZGUIDE, 142
+ HORZGUIDE, 147
+ HORZGUIDE, 164
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.cpp b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.cpp
new file mode 100644
index 0000000000..7ee65580ad
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.cpp
@@ -0,0 +1,157 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include "winamp_2.h"
+
+#include <general/debug/debug.h>
+
+#include <frontend.h>
+
+namespace
+{
+ const int WINAMP_PLAY = WINAMP_BUTTON2;
+ const int WINAMP_PAUSE = WINAMP_BUTTON3;
+ const int WINAMP_STOP = WINAMP_BUTTON4;
+}
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+Winamp2::Winamp2()
+ :
+ m_state(PlayState_Unknown)
+{
+ CLASSCERR("Winamp2::Winamp2");
+}
+
+//------------------------------------------------------------------------------
+Winamp2::~Winamp2()
+{
+ CLASSCERR("Winamp2::~Winamp2");
+}
+
+//------------------------------------------------------------------------------
+void
+Winamp2::play()
+{
+ CLASSCERR("Winamp2::play");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ m_state = getState();
+ SendMessage(handle, WM_COMMAND, WINAMP_PLAY, 0);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+Winamp2::stop()
+{
+ CLASSCERR("Winamp2::stop");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ m_state = getState();
+ SendMessage(handle, WM_COMMAND, WINAMP_STOP, 0);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+Winamp2::pause()
+{
+ CLASSCERR("Winamp2::pause");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ m_state = getState();
+
+ if (PlayState_Playing == m_state)
+ {
+ SendMessage(handle, WM_COMMAND, WINAMP_PAUSE, 0);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+Winamp2::PlayState
+Winamp2::restoreState()
+{
+ CLASSCERR("Winamp2::restoreState");
+
+ switch (m_state)
+ {
+ case PlayState_Playing:
+ play();
+ break;
+
+ case PlayState_Stopped:
+ stop();
+ break;
+
+ case PlayState_Paused:
+ pause();
+ break;
+ }
+
+ return m_state;
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+bool
+Winamp2::getHandle(HWND &handle)
+{
+ handle = FindWindow("Winamp v1.x", NULL);
+
+ bool ret = true;
+
+ if (NULL == handle)
+ {
+ ret = false;
+ }
+
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+Winamp2::PlayState
+Winamp2::getState()
+{
+ CLASSCERR("Winamp2::getState");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ int state = SendMessage(handle, WM_WA_IPC, 0, IPC_ISPLAYING);
+
+ switch (state)
+ {
+ case 0:
+ return PlayState_Stopped;
+ break;
+
+ case 1:
+ return PlayState_Playing;
+ break;
+
+ case 3:
+ return PlayState_Paused;
+ break;
+ }
+ }
+
+ return PlayState_Unknown;
+}
+
+//==============================================================================
+
diff --git a/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.h b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.h
new file mode 100644
index 0000000000..372d1e38d9
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.h
@@ -0,0 +1,62 @@
+#ifndef guard_general_multimedia_winamp_2_winamp_2_h
+#define guard_general_multimedia_winamp_2_winamp_2_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <windows.h>
+
+class Winamp2
+{
+ public:
+ Winamp2();
+ ~Winamp2();
+
+ enum PlayState
+ {
+ PlayState_Unknown,
+ PlayState_Stopped,
+ PlayState_Playing,
+ PlayState_Paused,
+ };
+
+ //--------------------------------------------------------------------------
+ // Description : play/pause/stop the current song
+ //--------------------------------------------------------------------------
+ void play();
+ void stop();
+ void pause();
+
+ //--------------------------------------------------------------------------
+ // Description : restore winamp to its previoud play state
+ // Return : the play state winamp has been restored to
+ //--------------------------------------------------------------------------
+ PlayState restoreState();
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : get the handle to the winamp application
+ // Parameters : handle - where to place the handle
+ // Returns : true - the handle was found
+ // false - the handle wasn't found
+ //--------------------------------------------------------------------------
+ bool getHandle(HWND &handle);
+
+ //--------------------------------------------------------------------------
+ // Description : get the current state of the winamp application
+ //--------------------------------------------------------------------------
+ PlayState getState();
+
+ PlayState m_state;
+};
+
+//==============================================================================
+//
+// Summary : Control Winamp 2.x
+//
+// Description : Allows remote control over numberous winamp 2.x setting
+// including volume, play, pause, stop etc.
+//
+//==============================================================================
+
+#endif
diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/observer.cpp b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.cpp
new file mode 100644
index 0000000000..99e0b3a081
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.cpp
@@ -0,0 +1,19 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include "observer.h"
+
+#include "subject.h"
+
+#include <general/debug/debug.h>
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+Observer::~Observer()
+{
+ CLASSCERR("Observer::~Observer");
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/observer.h b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.h
new file mode 100644
index 0000000000..9f93ea91f1
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.h
@@ -0,0 +1,30 @@
+#ifndef guard_general_observer_observer_observer_h
+#define guard_general_observer_observer_observer_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+class Subject;
+
+class Observer
+{
+ public:
+ virtual ~Observer();
+
+ //--------------------------------------------------------------------------
+ // Description : Called by a subject that this observer is observing
+ // to signify a change in state
+ // Parameters : subject - the subject that changed
+ //--------------------------------------------------------------------------
+ virtual void update(Subject &subject) = 0;
+};
+
+//==============================================================================
+//
+// Summary : Observer side of the observer pattern
+//
+// Description :
+//
+//==============================================================================
+
+#endif
diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/subject.cpp b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.cpp
new file mode 100644
index 0000000000..e28c66c44b
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.cpp
@@ -0,0 +1,77 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include "subject.h"
+
+#include <general/debug/debug.h>
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+Subject::Subject()
+ :
+ m_observer_list()
+{
+ CLASSCERR("Subject::Subject");
+}
+
+//------------------------------------------------------------------------------
+Subject::~Subject()
+{
+ CLASSCERR("Subject::~Subject");
+}
+
+//------------------------------------------------------------------------------
+void
+Subject::notify()
+{
+ CLASSCERR("Subject::notify");
+
+ // call update for all observers in the list
+ for (std::list<Observer *>::iterator iter = m_observer_list.begin();
+ iter != m_observer_list.end();
+ ++iter)
+ {
+ (*iter)->update(*this);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+Subject::attach(Observer &observer)
+{
+ CLASSCERR("Subject::attach(" << &observer << ")");
+
+ for (std::list<Observer *>::iterator iter = m_observer_list.begin();
+ iter != m_observer_list.end();
+ ++iter)
+ {
+ if (*iter == &observer)
+ {
+ return;
+ }
+ }
+
+ m_observer_list.push_back(&observer);
+}
+
+//------------------------------------------------------------------------------
+void
+Subject::detach(const Observer &observer)
+{
+ CLASSCERR("Subject::detach(" << &observer << ")");
+
+ for (std::list<Observer *>::iterator iter = m_observer_list.begin();
+ iter != m_observer_list.end();
+ ++iter)
+ {
+ if (*iter == &observer)
+ {
+ m_observer_list.erase(iter);
+ }
+ }
+}
+
+//==============================================================================
+
diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/subject.h b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.h
new file mode 100644
index 0000000000..a086e80765
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.h
@@ -0,0 +1,52 @@
+#ifndef guard_general_observer_subject_h
+#define guard_general_observer_subject_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include "observer.h"
+
+#include <list>
+
+class Subject
+{
+ public:
+ Subject();
+ virtual ~Subject();
+
+ //--------------------------------------------------------------------------
+ // Description : Notify all observers of a state change
+ //--------------------------------------------------------------------------
+ void notify();
+
+ //--------------------------------------------------------------------------
+ // Description : Attach an observer to the subject
+ // Parameters : observer - the observer
+ //--------------------------------------------------------------------------
+ void attach(Observer &observer);
+
+ //--------------------------------------------------------------------------
+ // Description : Detach an observer from the subject
+ // Parameters : observer - the observer
+ //--------------------------------------------------------------------------
+ void detach(const Observer &observer);
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : Disallow assignment operator and copy constructor
+ //--------------------------------------------------------------------------
+ Subject(const Subject &rhs);
+ const Subject & operator=(const Subject &rhs);
+
+ std::list<Observer *> m_observer_list;
+};
+
+//==============================================================================
+//
+// Summary : Subject side of the observer pattern
+//
+// Description : Instances of this class are what is observered by observers
+//
+//==============================================================================
+
+#endif
diff --git a/plugins/!NotAdopted/WinterSpeak/general/optimise/aggressive_optimise.h b/plugins/!NotAdopted/WinterSpeak/general/optimise/aggressive_optimise.h
new file mode 100644
index 0000000000..6494bf6eb9
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/optimise/aggressive_optimise.h
@@ -0,0 +1,29 @@
+#ifndef guard_aggressive_optimise_h
+#define guard_aggressive_optimise_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#ifdef NDEBUG
+
+// we define the WIN32_LEAN_AND_MEAN tag so that the quick windows
+// macros and functions are used. Using this should make a slight
+// performance improvement (even though we probably won't see it
+// in this program).
+#define WIN32_LEAN_AND_MEAN
+
+#pragma comment(linker,"/RELEASE")
+#pragma comment(linker,"/FILEALIGN:0x200")
+
+#endif
+
+//==============================================================================
+//
+// Summary : aggresively optimise the binary for size
+//
+// Description : uses various linker switches to decrease the size of the
+// binary
+//
+//==============================================================================
+
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/resource.h b/plugins/!NotAdopted/WinterSpeak/general/resource.h
new file mode 100644
index 0000000000..cd10886cff
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/resource.h
@@ -0,0 +1,22 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by general.rc
+//
+#define IDD_TTS_LEXICON 201
+#define IDC_TTS_LEXICON_LIST 2001
+#define IDC_TTS_LEXICON_ORIGINAL 2002
+#define IDC_TTS_LEXICON_FINAL 2003
+#define IDC_TTS_LEXICON_ADD 2004
+#define IDC_TTS_LEXICON_REMOVE 2005
+#define IDC_TTS_LEXICON_TEST 2006
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 202
+#define _APS_NEXT_COMMAND_VALUE 42001
+#define _APS_NEXT_CONTROL_VALUE 2007
+#define _APS_NEXT_SYMED_VALUE 202
+#endif
+#endif
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.cpp
new file mode 100644
index 0000000000..4c0a82c9e5
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.cpp
@@ -0,0 +1,327 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_40a.h"
+#include "speech_api_40a_lexicon.h"
+
+#include <general/debug/debug.h>
+
+#include <windows.h>
+#include <initguid.h>
+#include <speech.h>
+
+#include <sstream>
+#include <memory>
+
+//------------------------------------------------------------------------------
+SpeechApi40a::SpeechApi40a()
+ :
+ m_tts_central(0),
+ m_tts_attribs(0),
+ m_state(TextToSpeech::State_Unloaded),
+ m_voice(""),
+ m_volume(50),
+ m_pitch(50),
+ m_rate(50)
+{
+ CLASSCERR("SpeechApi40a::SpeechApi40a");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi40a::~SpeechApi40a()
+{
+ CLASSCERR("SpeechApi40a::~SpeechApi40a");
+
+ unload();
+
+ CoUninitialize();
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::isAvailable()
+{
+ CLASSCERR("SpeechApi40a::isAvailable");
+
+ CoInitialize(NULL);
+
+ PITTSENUM pITTSEnum;
+ bool ret = true;
+
+ // create the enumerator
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL,
+ IID_ITTSEnum, (void**)&pITTSEnum)))
+ {
+ ret = false;
+ }
+ else
+ {
+ pITTSEnum->Release();
+ }
+
+ CLASSCERR("SpeechApi40a::isAvailable return " << (ret?"T":"F"));
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::load()
+{
+ CLASSCERR("SpeechApi40a::load");
+
+ if (isLoaded())
+ {
+ return true;
+ }
+
+ return loadWithVoice(std::string(m_voice));
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::unload()
+{
+ CLASSCERR("SpeechApi40a::unload");
+
+ if (m_tts_attribs)
+ {
+ m_tts_attribs->Release();
+ m_tts_attribs = 0;
+ }
+
+ if (m_tts_central)
+ {
+ m_tts_central->Release();
+ m_tts_central = 0;
+ }
+
+ m_state = TextToSpeech::State_Unloaded;
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::isLoaded() const
+{
+ return (TextToSpeech::State_Loaded == m_state);
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::say(const std::string &sentence)
+{
+ CLASSCERR("SpeechApi40a::say(" << sentence << ")");
+
+ bool ret = true;
+
+ if (!isLoaded())
+ {
+ ret = false;
+ }
+ else
+ {
+ SDATA data;
+ data.dwSize = sentence.size();
+ data.pData = (char *)sentence.c_str();
+ m_tts_central->TextData(CHARSET_TEXT, 0, data, NULL, IID_ITTSBufNotifySinkA);
+ }
+
+ CLASSCERR("SpeechApi40a::say() return " << (ret?"T":"F"));
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setVolume(int volume)
+{
+ m_volume = volume;
+
+ if (!isLoaded())
+ {
+ return true;
+ }
+
+ DWORD new_vol = volume / 100.0 * 0xffff;
+ new_vol |= new_vol << 16;
+
+ if (FAILED(m_tts_attribs->VolumeSet(new_vol)))
+ {
+ CLASSCERR("SpeechApi40a::setVolume() failed");
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setPitch(int pitch)
+{
+ m_pitch = pitch;
+
+ // valid range is 50 to 350
+ if (isLoaded() && FAILED(m_tts_attribs->PitchSet(pitch * 3.0 + 50)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setRate(int rate)
+{
+ m_rate = rate;
+
+ // valid range is 50 to 350
+ if (isLoaded() && FAILED(m_tts_attribs->SpeedSet(rate * 3.0 + 50)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setVoice(const std::string &voice)
+{
+ CLASSCERR("SpeechApi40a::setVoice(" << voice << ")");
+
+ m_voice = voice;
+
+ if (!isLoaded())
+ {
+ return true;
+ }
+
+ unload();
+ return load();
+}
+
+//------------------------------------------------------------------------------
+std::vector<std::string>
+SpeechApi40a::getVoices() const
+{
+ CLASSCERR("SpeechApi40a::getVoice");
+
+ std::vector<std::string> ret;
+
+ PITTSENUM pITTSEnum = NULL;
+ TTSMODEINFO inf;
+
+ CoInitialize(NULL);
+
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL,
+ IID_ITTSEnum, (void**)&pITTSEnum)))
+ {
+ CLASSCERR("SpeechApi40a::getVoice failed to create enum");
+ return ret;
+ }
+
+ while (!pITTSEnum->Next(1, &inf, NULL))
+ {
+ ret.push_back(inf.szModeName);
+ }
+
+ pITTSEnum->Release();
+
+ CLASSCERR("SpeechApi40a::getVoice return");
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::lexiconDialog(HWND window)
+{
+ CLASSCERR("SpeechApi40a::lexiconDialog");
+
+ // open the dialog
+ SpeechApi40aLexicon dialog(window, m_tts_central);
+
+ if (!dialog.display())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+std::string
+SpeechApi40a::getDescription()
+{
+ CERR("SpeechApi40a::getDescription");
+
+ return "Microsoft SAPI v4.0";
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::loadWithVoice(std::string &voice)
+{
+ CLASSCERR("SpeechApi40a::loadWithVoice(" << voice << ")");
+
+ CoInitialize(NULL);
+
+ PITTSENUM pITTSEnum;
+ TTSMODEINFO inf;
+ LPUNKNOWN pAudioDest;
+
+ // create the enumerator
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL,
+ IID_ITTSEnum, (void**)&pITTSEnum)))
+ {
+ CLASSCERR("SpeechApi40a::createTtsEngine() failed to create enum");
+ return false;
+ }
+
+ // iterate through the voices until we find the right one
+ while (!pITTSEnum->Next(1, &inf, NULL))
+ {
+ if (inf.szModeName == voice)
+ {
+ break;
+ }
+ }
+
+ if (FAILED(CoCreateInstance(CLSID_MMAudioDest, NULL, CLSCTX_ALL,
+ IID_IAudioMultiMediaDevice, (void**)&pAudioDest)))
+ {
+ CLASSCERR("SpeechApi40a::createTtsEngine() failed to create audio dest");
+ pITTSEnum->Release();
+ return false;
+ }
+
+ // select that voice
+ if (FAILED(pITTSEnum->Select(inf.gModeID, &m_tts_central, pAudioDest)))
+ {
+ CLASSCERR("SpeechApi40a::createTtsEngine() failed to select voice");
+ pITTSEnum->Release();
+ return NULL;
+ }
+
+ m_tts_central->QueryInterface(IID_ITTSAttributes, (LPVOID *)&m_tts_attribs);
+
+ pITTSEnum->Release();
+
+ // we made it
+ m_state = TextToSpeech::State_Loaded;
+
+ // configure the new voice
+ setVolume(m_volume);
+ setRate(m_rate);
+ setPitch(m_pitch);
+
+ CLASSCERR("SpeechApi40a::loadWithVoice() return successful");
+ return true;
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.h
new file mode 100644
index 0000000000..4d3a40abb4
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.h
@@ -0,0 +1,103 @@
+#ifndef guard_general_text_to_speech_speech_api_40a_speech_api_40_h
+#define guard_general_text_to_speech_speech_api_40a_speech_api_40_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <general/text_to_speech/text_to_speech/text_to_speech.h>
+
+struct ITTSCentralA;
+struct ITTSAttributesA;
+
+class SpeechApi40a : public TextToSpeech
+{
+ public:
+ SpeechApi40a();
+ virtual ~SpeechApi40a();
+
+ //--------------------------------------------------------------------------
+ // Description : is the api available for use
+ // Return : true - it is available
+ // false - it is not available
+ //--------------------------------------------------------------------------
+ virtual bool isAvailable();
+
+ //--------------------------------------------------------------------------
+ // Description : load/unload/reload the speech api
+ // Return : true - the action succeeded
+ // false - the action failed
+ //--------------------------------------------------------------------------
+ virtual bool load();
+ virtual bool unload();
+
+ //--------------------------------------------------------------------------
+ // Description : check if the speech api is loaded
+ // Return : true - the speech_api is loaded
+ // false - its not loaded
+ //--------------------------------------------------------------------------
+ virtual bool isLoaded() const;
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ virtual bool say(const std::string &sentence);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice settings
+ // Parameters : range from 0 to 100
+ //--------------------------------------------------------------------------
+ virtual bool setVolume(int volume);
+ virtual bool setPitch(int pitch);
+ virtual bool setRate(int rate);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice
+ //--------------------------------------------------------------------------
+ virtual bool setVoice(const std::string &voice);
+
+ //--------------------------------------------------------------------------
+ // Description : get the available voices
+ //--------------------------------------------------------------------------
+ virtual std::vector<std::string> getVoices() const;
+
+ //--------------------------------------------------------------------------
+ // Description : open the lexicon dialog for this engine
+ // Parameters : window - handle to the parent window
+ // Return : true - dialog completely successfully
+ // false - dialog failed
+ //--------------------------------------------------------------------------
+ virtual bool lexiconDialog(HWND window);
+
+ //--------------------------------------------------------------------------
+ // Description : get the description of the tts engine
+ //--------------------------------------------------------------------------
+ static std::string getDescription();
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : load the speech api with the specified voice
+ //--------------------------------------------------------------------------
+ bool loadWithVoice(std::string &voice);
+
+ ITTSCentralA *m_tts_central;
+ ITTSAttributesA *m_tts_attribs;
+
+ TextToSpeech::State m_state;
+ std::string m_voice;
+ int m_volume;
+ int m_pitch;
+ int m_rate;
+};
+
+//==============================================================================
+//
+// Summary : API encapsulation
+//
+// Description : This encapsulates the SAPI 4.0a interface
+//
+//==============================================================================
+
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.cpp
new file mode 100644
index 0000000000..5dd8bbdb22
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.cpp
@@ -0,0 +1,57 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_40a_lexicon.h"
+
+#include <general/debug/debug.h>
+
+#include <windows.h>
+#include <speech.h>
+
+//------------------------------------------------------------------------------
+SpeechApi40aLexicon::SpeechApi40aLexicon(HWND window,
+ ITTSCentralA *tts_central)
+ :
+ m_window(window),
+ m_tts_central(tts_central)
+{
+ CLASSCERR("SpeechApi40aLexicon::SpeechApi40aLexicon");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi40aLexicon::~SpeechApi40aLexicon()
+{
+ CLASSCERR("SpeechApi40aLexicon::~SpeechApi40aLexicon");
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40aLexicon::display()
+{
+ if (!m_tts_central)
+ {
+ return false;
+ }
+
+ ITTSDialogs *tts_dialogs = 0;
+
+ m_tts_central->QueryInterface(IID_ITTSDialogs, (void**)&tts_dialogs);
+
+ if (!tts_dialogs)
+ {
+ return false;
+ }
+
+ if (NOERROR != tts_dialogs->LexiconDlg(m_window, NULL))
+ {
+ return false;
+ }
+
+ tts_dialogs->Release();
+ return true;
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.h
new file mode 100644
index 0000000000..8b36a05364
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.h
@@ -0,0 +1,44 @@
+#ifndef guard_general_text_to_speech_speech_api_40a_speech_api_40a_lexicon_h
+#define guard_general_text_to_speech_speech_api_40a_speech_api_40a_lexicon_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <wtypes.h>
+
+struct ITTSCentralA;
+
+class SpeechApi40aLexicon
+{
+ public:
+ //--------------------------------------------------------------------------
+ // Description : Constuctor
+ // Parameters : window - handle to the parent window
+ // tts_central - pointer to the tts_central engine to use
+ //--------------------------------------------------------------------------
+ SpeechApi40aLexicon(HWND window, ITTSCentralA *tts_central);
+
+ ~SpeechApi40aLexicon();
+
+ //--------------------------------------------------------------------------
+ // Description : display the lexicon dialog
+ // Return : true - display ok
+ // false - display failed
+ //--------------------------------------------------------------------------
+ bool display();
+
+ private:
+ HWND m_window;
+ ITTSCentralA *m_tts_central;
+};
+
+//==============================================================================
+//
+// Summary : Lexicon dialog
+//
+// Description : Displays the lexicon dialog for the speech api 4.0a which
+// allows the user to add/remove/edit the user lexicon database
+//
+//==============================================================================
+
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.cpp
new file mode 100644
index 0000000000..4c28167f76
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.cpp
@@ -0,0 +1,311 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_51.h"
+
+#include <general/debug/debug.h>
+#include <general/text_to_speech/speech_api_51/speech_api_51_lexicon.h>
+
+#include <sapi.h>
+#include <sphelper.h>
+
+#include <sstream>
+#include <memory>
+
+namespace
+{
+
+//------------------------------------------------------------------------------
+// Description : implement callback
+//------------------------------------------------------------------------------
+/*class Sapi51Callback : public ISpNotifyCallback
+{
+ public:
+ Sapi51Callback();
+
+ virtual STDMETHODIMP NotifyCallback(WPARAM wParam, LPARAM lParam)
+ {
+
+ return S_OK;
+ }
+};*/
+
+}
+
+//------------------------------------------------------------------------------
+SpeechApi51::SpeechApi51()
+ :
+ m_sapi(0),
+ m_state(TextToSpeech::State_Unloaded),
+ m_voice(""),
+ m_volume(50),
+ m_pitch(50),
+ m_rate(50)
+{
+ CLASSCERR("SpeechApi51::SpeechApi51");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi51::~SpeechApi51()
+{
+ CLASSCERR("SpeechApi51::~SpeechApi51");
+
+ unload();
+
+ CoUninitialize();
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::isAvailable()
+{
+ CLASSCERR("SpeechApi51::isAvailable");
+
+ CoInitialize(NULL);
+
+ ISpVoice *sapi;
+ bool ret = true;
+
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice,
+ reinterpret_cast<void **>(&sapi))))
+ {
+ ret = false;
+ }
+ else
+ {
+ sapi->Release();
+ }
+
+ CLASSCERR("SpeechApi51::isAvailable return " << (ret?"T":"F"));
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::load()
+{
+ CLASSCERR("SpeechApi51::load");
+
+ if (isLoaded())
+ {
+ CLASSCERR("SpeechApi51::load engine already loaded");
+ return true;
+ }
+
+ CoInitialize(NULL);
+
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice,
+ reinterpret_cast<void **>(&m_sapi))))
+ {
+ CLASSCERR("SpeechApi51::load could not initialise sapi");
+ return false;
+ }
+
+ m_state = TextToSpeech::State_Loaded;
+
+ // adjust the volume and rate settings
+ setVoice(m_voice);
+ setVolume(m_volume);
+ setRate(m_rate);
+
+ CLASSCERR("SpeechApi51::load return success");
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::unload()
+{
+ CLASSCERR("SpeechApi51::unload");
+
+ if (isLoaded())
+ {
+ m_sapi->Release();
+ m_sapi = 0;
+ }
+
+ m_state = TextToSpeech::State_Unloaded;
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::isLoaded() const
+{
+ return (TextToSpeech::State_Loaded == m_state);
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::say(const std::string &sentence)
+{
+ CLASSCERR("SpeechApi51::say(" << sentence << ")");
+
+ if (!isLoaded())
+ {
+ CLASSCERR("SpeechApi51::say() engine not loaded");
+ return false;
+ }
+
+ // prepend the pitch setting
+ std::stringstream output;
+ output << "<pitch middle='" << m_pitch << "'/> " << sentence;
+
+ std::auto_ptr<wchar_t> sapi_sentence(new wchar_t[output.str().size() + 1]);
+ mbstowcs(sapi_sentence.get(), output.str().c_str(), output.str().size() + 1);
+
+ // speak the sentence
+ if (FAILED(m_sapi->Speak(sapi_sentence.get(), SPF_IS_XML | SPF_ASYNC, NULL)))
+ {
+ CLASSCERR("SpeechApi51::say() failed to speak sentence");
+ return false;
+ }
+
+ CLASSCERR("SpeechApi51::say() succeeded");
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setVolume(int volume)
+{
+ m_volume = volume;
+
+ if (isLoaded() && FAILED(m_sapi->SetVolume(volume)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setPitch(int pitch)
+{
+ m_pitch = (pitch / 5) - 10;
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setRate(int rate)
+{
+ m_rate = rate;
+
+ // convert it to the range -10 to 10
+ if (isLoaded() && FAILED(m_sapi->SetRate((rate / 5.0) - 10)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setVoice(const std::string &voice)
+{
+ CLASSCERR("SpeechApi51::setVoice(" << voice << ")");
+
+ m_voice = voice;
+
+ if (!isLoaded())
+ {
+ CLASSCERR("SpeechApi51::setVoice() engine not loaded");
+ return true;
+ }
+
+ // get a voice enumerator
+ CComPtr<IEnumSpObjectTokens> cpEnum;
+ if (FAILED(SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum)))
+ {
+ CLASSCERR("SpeechApi51::setVoice failed to load enumerator");
+ return false;
+ }
+
+ // iterate through the list till we find a matching voice
+ ISpObjectToken *voice_token;
+ while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ {
+ CSpDynamicString voice_str;
+
+ if (SUCCEEDED(SpGetDescription(voice_token, &voice_str))
+ && (voice == voice_str.CopyToChar()))
+ {
+ m_sapi->SetVoice(voice_token);
+ CLASSCERR("SpeechApi51::setVoice() voice found");
+ return true;
+ }
+ }
+
+ CLASSCERR("SpeechApi51::setVoice() voice not found");
+ return false;
+}
+
+//------------------------------------------------------------------------------
+std::vector<std::string>
+SpeechApi51::getVoices() const
+{
+ CLASSCERR("SpeechApi51::getVoices");
+
+ std::vector<std::string> ret;
+
+ CoInitialize(NULL);
+
+ // get a voice enumerator
+ CComPtr<IEnumSpObjectTokens> cpEnum;
+ if (S_OK != SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum))
+ {
+ CLASSCERR("SpeechApi51::getVoices failed to load enumerator");
+ return ret;
+ }
+
+ // iterate through the voices and add them to the string vector
+ ISpObjectToken *voice_token;
+ while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ {
+ CSpDynamicString voice_str;
+
+ if (SUCCEEDED(SpGetDescription(voice_token, &voice_str)))
+ {
+ ret.push_back(voice_str.CopyToChar());
+ }
+ }
+
+ CLASSCERR("SpeechApi51::getVoices return");
+ return ret;
+}
+
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::lexiconDialog(HWND window)
+{
+ CLASSCERR("SpeechApi51::lexiconDialog");
+
+ // open the dialog
+ SpeechApi51Lexicon dialog(window);
+
+ if (!dialog.display())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+std::string
+SpeechApi51::getDescription()
+{
+ CERR("SpeechApi51::getDescription");
+
+ return "Microsoft SAPI v5.1";
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.h
new file mode 100644
index 0000000000..a6f1fef3e2
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.h
@@ -0,0 +1,97 @@
+#ifndef guard_general_text_to_speech_speech_api_51_speech_api_51_h
+#define guard_general_text_to_speech_speech_api_51_speech_api_51_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <general/text_to_speech/text_to_speech/text_to_speech.h>
+
+struct ISpVoice;
+class Sapi51Callback;
+
+class SpeechApi51 : public TextToSpeech
+{
+ public:
+ SpeechApi51();
+ virtual ~SpeechApi51();
+
+ //--------------------------------------------------------------------------
+ // Description : is the api available for use
+ // Return : true - it is available
+ // false - it is not available
+ //--------------------------------------------------------------------------
+ virtual bool isAvailable();
+
+ //--------------------------------------------------------------------------
+ // Description : load/unload/reload the speech api
+ // Return : true - the action succeeded
+ // false - the action failed
+ //--------------------------------------------------------------------------
+ virtual bool load();
+ virtual bool unload();
+
+ //--------------------------------------------------------------------------
+ // Description : check if the speech api is loaded
+ // Return : true - the speech_api is loaded
+ // false - its not loaded
+ //--------------------------------------------------------------------------
+ virtual bool isLoaded() const;
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ virtual bool say(const std::string &sentence);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice settings
+ // Parameters : range from 0 to 100
+ //--------------------------------------------------------------------------
+ virtual bool setVolume(int volume);
+ virtual bool setPitch(int pitch);
+ virtual bool setRate(int rate);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice
+ //--------------------------------------------------------------------------
+ virtual bool setVoice(const std::string &voice);
+
+ //--------------------------------------------------------------------------
+ // Description : get the available voices
+ //--------------------------------------------------------------------------
+ virtual std::vector<std::string> getVoices() const;
+
+ //--------------------------------------------------------------------------
+ // Description : open the lexicon dialog for this engine
+ // Parameters : window - handle to the parent window
+ // Return : true - dialog completely successfully
+ // false - dialog failed
+ //--------------------------------------------------------------------------
+ virtual bool lexiconDialog(HWND window);
+
+ //--------------------------------------------------------------------------
+ // Description : get the description of the tts engine
+ //--------------------------------------------------------------------------
+ static std::string getDescription();
+
+ private:
+ ISpVoice *m_sapi;
+
+ TextToSpeech::State m_state;
+ std::string m_voice;
+ int m_volume;
+ int m_pitch;
+ int m_rate;
+};
+
+//==============================================================================
+//
+// Summary : API encapsulation
+//
+// Description : This encapsulates the SAPI 5.1 interface
+//
+//==============================================================================
+
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.cpp
new file mode 100644
index 0000000000..79581a62c9
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.cpp
@@ -0,0 +1,99 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_51_lexicon.h"
+
+#include "speech_api_51.h"
+
+#include <general/debug/debug.h>
+#include <general/resource.h>
+
+#include <windows.h>
+//#include <sapi.h>
+//#include <sphelper.h>
+
+extern HINSTANCE g_hInst;
+
+//------------------------------------------------------------------------------
+SpeechApi51Lexicon::SpeechApi51Lexicon(HWND window)
+ :
+ m_parent_window(window),
+ m_window(0)
+{
+ CLASSCERR("SpeechApi51Lexicon::SpeechApi51Lexicon");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi51Lexicon::~SpeechApi51Lexicon()
+{
+ CLASSCERR("SpeechApi51Lexicon::~SpeechApi51Lexicon");
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51Lexicon::display()
+{
+ CLASSCERR("SpeechApi51Lexicon::display");
+
+ m_window = CreateDialog(
+ g_hInst,
+ MAKEINTRESOURCE(IDD_TTS_LEXICON),
+ m_parent_window,
+ dialogEvent);
+
+ if (!m_window)
+ {
+ return false;
+ }
+
+ ShowWindow(m_window, SW_SHOW);
+
+/* WNDCLASS wc;
+
+ wc.style = 0;
+! wc.lpfnWndProc = (WNDPROC)MainWndProc; // Window procedure for this class.
+ wc.cbClsExtra = 0; // No per-class extra data.
+! wc.cbWndExtra = 0; // No per-window extra data.
+ wc.hInstance = hInstance; // Application that owns the class.
+ wc.hIcon = NULL;
+ wc.hCursor = NULL;
+ wc.hbrBackground = NULL;
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "Comdlg32WClass"; // Name used in call to CreateWindow.
+
+ return (RegisterClass(&wc));*/
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+INT_PTR CALLBACK
+SpeechApi51Lexicon::dialogEvent(HWND hwndDlg, UINT uMsg, WPARAM wParam,
+ LPARAM lParam)
+{
+
+ return TRUE;
+}
+
+//------------------------------------------------------------------------------
+void
+SpeechApi51Lexicon::addLexicon()
+{
+}
+
+//------------------------------------------------------------------------------
+void
+SpeechApi51Lexicon::deleteLexicon()
+{
+}
+
+//------------------------------------------------------------------------------
+void
+SpeechApi51Lexicon::displayLexicon()
+{
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.h
new file mode 100644
index 0000000000..f0a240fb67
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.h
@@ -0,0 +1,50 @@
+#ifndef guard_general_text_to_speech_speech_api_51_speech_api_51_lexicon_h
+#define guard_general_text_to_speech_speech_api_51_speech_api_51_lexicon_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <wtypes.h>
+
+class SpeechApi51;
+
+class SpeechApi51Lexicon
+{
+ public:
+ //--------------------------------------------------------------------------
+ // Description : Constuctor
+ // Parameters : window - handle to the parent window
+ //--------------------------------------------------------------------------
+ SpeechApi51Lexicon(HWND window);
+
+ ~SpeechApi51Lexicon();
+
+ //--------------------------------------------------------------------------
+ // Description : display the lexicon dialog
+ // Return : true - display ok
+ // false - display failed
+ //--------------------------------------------------------------------------
+ bool display();
+
+ private:
+ static INT_PTR CALLBACK dialogEvent(HWND hwndDlg, UINT uMsg,
+ WPARAM wParam, LPARAM lParam);
+
+ void addLexicon();
+ void deleteLexicon();
+ void displayLexicon();
+
+ HWND m_parent_window;
+ HWND m_window;
+};
+
+//==============================================================================
+//
+// Summary : Lexicon dialog
+//
+// Description : Displays the lexicon dialog for the speech api 5.1 which
+// allows the user to add/remove/edit the user lexicon database
+//
+//==============================================================================
+
+#endif \ No newline at end of file
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.cpp
new file mode 100644
index 0000000000..ffc4cdc78e
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.cpp
@@ -0,0 +1,17 @@
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include "text_to_speech.h"
+
+//------------------------------------------------------------------------------
+TextToSpeech::TextToSpeech()
+{
+}
+
+//------------------------------------------------------------------------------
+TextToSpeech::~TextToSpeech()
+{
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.h
new file mode 100644
index 0000000000..36a59d9692
--- /dev/null
+++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.h
@@ -0,0 +1,88 @@
+#ifndef guard_general_text_to_speech_text_to_speech_text_to_speech_h
+#define guard_general_text_to_speech_text_to_speech_text_to_speech_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <wtypes.h>
+#include <string>
+#include <vector>
+
+class TextToSpeech
+{
+ public:
+ enum State
+ {
+ State_Loaded,
+ State_Unloaded,
+ };
+
+ TextToSpeech();
+ virtual ~TextToSpeech();
+
+ //--------------------------------------------------------------------------
+ // Description : is the api available for use
+ // Return : true - it is available
+ // false - it is not available
+ //--------------------------------------------------------------------------
+ virtual bool isAvailable() = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : load/unload/reload the speech api
+ // Return : true - the action succeeded
+ // false - the action failed
+ //--------------------------------------------------------------------------
+ virtual bool load() = 0;
+ virtual bool unload() = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : check if the speech api is loaded
+ // Return : true - the speech_api is loaded
+ // false - its not loaded
+ //--------------------------------------------------------------------------
+ virtual bool isLoaded() const = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ virtual bool say(const std::string &sentence) = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice settings
+ // Parameters : range from 0 to 100
+ //--------------------------------------------------------------------------
+ virtual bool setVolume(int volume) = 0;
+ virtual bool setPitch(int pitch) = 0;
+ virtual bool setRate(int rate) = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice
+ //--------------------------------------------------------------------------
+ virtual bool setVoice(const std::string &voice) = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : get the available voices
+ //--------------------------------------------------------------------------
+ virtual std::vector<std::string> getVoices() const = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : open the lexicon dialog for this engine
+ // Parameters : window - handle to the parent window
+ // Return : true - dialog completely successfully
+ // false - dialog failed
+ //--------------------------------------------------------------------------
+ virtual bool lexiconDialog(HWND window) = 0;
+};
+
+//==============================================================================
+//
+// Summary : ABC for text to speech engines
+//
+// Description : Define the interface for the engine so i can polymorph
+//
+//==============================================================================
+
+#endif \ No newline at end of file