Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions Installer/ElevenLabsKeyDlg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#include "framework.h"
#include "Installer.h"
#include "RegKey.h"

INT_PTR CALLBACK ElevenLabsKeyDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
{
RegKey key;
key.Open(HKEY_CURRENT_USER, L"Software\\NaturalVoiceSAPIAdapter\\Enumerator", KEY_QUERY_VALUE);

SetDlgItemTextW(hDlg, IDC_ELEVENLABS_API_KEY, key.GetString(L"ElevenLabsApiKey").c_str());

// Populate model combobox
HWND hModel = GetDlgItem(hDlg, IDC_ELEVENLABS_MODEL);
const LPCWSTR models[] = {
L"eleven_multilingual_v2",
L"eleven_turbo_v2_5",
L"eleven_turbo_v2",
L"eleven_monolingual_v1",
};
for (auto* m : models)
SendMessageW(hModel, CB_ADDSTRING, 0, (LPARAM)m);

std::wstring curModel = key.GetString(L"ElevenLabsModel");
if (curModel.empty()) curModel = L"eleven_multilingual_v2";
int sel = (int)SendMessageW(hModel, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)curModel.c_str());
if (sel < 0)
{
// Model not in list — add it and select it
sel = (int)SendMessageW(hModel, CB_ADDSTRING, 0, (LPARAM)curModel.c_str());
}
SendMessageW(hModel, CB_SETCURSEL, sel >= 0 ? sel : 0, 0);

return TRUE;
}

case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
{
RegKey key;
key.Create(HKEY_CURRENT_USER, L"Software\\NaturalVoiceSAPIAdapter\\Enumerator", KEY_SET_VALUE);

WCHAR buf[512];
GetDlgItemTextW(hDlg, IDC_ELEVENLABS_API_KEY, buf, 512);
key.SetString(L"ElevenLabsApiKey", buf);

HWND hModel = GetDlgItem(hDlg, IDC_ELEVENLABS_MODEL);
int sel = (int)SendMessageW(hModel, CB_GETCURSEL, 0, 0);
if (sel >= 0)
{
SendMessageW(hModel, CB_GETLBTEXT, sel, (LPARAM)buf);
key.SetString(L"ElevenLabsModel", buf);
}

EndDialog(hDlg, IDOK);
return TRUE;
}
case IDCANCEL:
EndDialog(hDlg, IDCANCEL);
return TRUE;
}
break;

case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case NM_CLICK:
case NM_RETURN:
ShellExecuteW(nullptr, nullptr,
L"https://elevenlabs.io/app/settings/api-keys",
nullptr, nullptr, SW_SHOWNORMAL);
break;
}
break;
}
return (INT_PTR)FALSE;
}
Binary file modified Installer/Installer.rc
Binary file not shown.
2 changes: 2 additions & 0 deletions Installer/Installer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@
<ItemGroup>
<ClCompile Include="AboutDlg.cpp" />
<ClCompile Include="AzureKeyDlg.cpp" />
<ClCompile Include="ElevenLabsKeyDlg.cpp" />
<ClCompile Include="PollyKeyDlg.cpp" />
<ClCompile Include="Install.cpp" />
<ClCompile Include="LangDlg.cpp" />
<ClCompile Include="MainDlg.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions Installer/Installer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
<ClCompile Include="AzureKeyDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ElevenLabsKeyDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PollyKeyDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AboutDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
33 changes: 31 additions & 2 deletions Installer/MainDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
INT_PTR CALLBACK AboutDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK LangDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK AzureKeyDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PollyKeyDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ElevenLabsKeyDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void Register(bool is64Bit);
void Unregister(bool is64Bit);

Expand Down Expand Up @@ -47,8 +49,12 @@ static void UpdateEnableStates(HWND hDlg)
EnableWindow(GetDlgItem(hDlg, IDC_BROWSE_LOCAL_VOICE), localEnabled);
BOOL edgeEnabled = IsDlgButtonChecked(hDlg, IDC_CHK_EDGE_VOICES) == BST_CHECKED;
BOOL azureEnabled = IsDlgButtonChecked(hDlg, IDC_CHK_AZURE_VOICES) == BST_CHECKED;
BOOL pollyEnabled = IsDlgButtonChecked(hDlg, IDC_CHK_POLLY_VOICES) == BST_CHECKED;
BOOL elevenLabsEnabled = IsDlgButtonChecked(hDlg, IDC_CHK_ELEVENLABS_VOICES) == BST_CHECKED;
EnableWindow(GetDlgItem(hDlg, IDC_SET_AZURE_KEY), azureEnabled);
BOOL onlineEnabled = edgeEnabled || azureEnabled;
EnableWindow(GetDlgItem(hDlg, IDC_SET_POLLY_KEY), pollyEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_SET_ELEVENLABS_KEY), elevenLabsEnabled);
BOOL onlineEnabled = edgeEnabled || azureEnabled || pollyEnabled || elevenLabsEnabled;
EnableWindow(GetDlgItem(hDlg, IDC_STATIC_INCLUDED_LANGUAGES), onlineEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_INCLUDED_LANGUAGES), onlineEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_CHANGE_LANGUAGES), onlineEnabled);
Expand All @@ -66,7 +72,18 @@ static void UpdateDisplay(HWND hDlg)
key.GetDword(L"NoEdgeVoices") ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hDlg, IDC_CHK_AZURE_VOICES,
key.GetDword(L"NoAzureVoices")
|| (key.GetString(L"AzureVoiceKey").empty() && key.GetString(L"AzureVoiceRegion").empty())
|| key.GetString(L"AzureVoiceKey").empty()
|| key.GetString(L"AzureVoiceRegion").empty()
? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hDlg, IDC_CHK_POLLY_VOICES,
key.GetDword(L"NoPollyVoices")
|| key.GetString(L"PollyAccessKey").empty()
|| key.GetString(L"PollySecretKey").empty()
|| key.GetString(L"PollyRegion").empty()
? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hDlg, IDC_CHK_ELEVENLABS_VOICES,
key.GetDword(L"NoElevenLabsVoices")
|| key.GetString(L"ElevenLabsApiKey").empty()
? BST_UNCHECKED : BST_CHECKED);
SetDlgItemTextW(hDlg, IDC_LOCAL_VOICE_PATH, key.GetString(L"NarratorVoicePath").c_str());

Expand Down Expand Up @@ -157,6 +174,8 @@ static void SaveChanges(HWND hDlg)
key.SetDword(L"NoNarratorVoices", IsDlgButtonChecked(hDlg, IDC_CHK_NARRATOR_VOICES) == BST_UNCHECKED);
key.SetDword(L"NoEdgeVoices", IsDlgButtonChecked(hDlg, IDC_CHK_EDGE_VOICES) == BST_UNCHECKED);
key.SetDword(L"NoAzureVoices", IsDlgButtonChecked(hDlg, IDC_CHK_AZURE_VOICES) == BST_UNCHECKED);
key.SetDword(L"NoPollyVoices", IsDlgButtonChecked(hDlg, IDC_CHK_POLLY_VOICES) == BST_UNCHECKED);
key.SetDword(L"NoElevenLabsVoices", IsDlgButtonChecked(hDlg, IDC_CHK_ELEVENLABS_VOICES) == BST_UNCHECKED);
WCHAR path[MAX_PATH];
GetDlgItemTextW(hDlg, IDC_LOCAL_VOICE_PATH, path, MAX_PATH);
key.SetString(L"NarratorVoicePath", path);
Expand Down Expand Up @@ -212,6 +231,8 @@ INT_PTR CALLBACK MainDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case IDC_CHK_NARRATOR_VOICES:
case IDC_CHK_EDGE_VOICES:
case IDC_CHK_AZURE_VOICES:
case IDC_CHK_POLLY_VOICES:
case IDC_CHK_ELEVENLABS_VOICES:
UpdateEnableStates(hDlg);
SaveChanges(hDlg);
break;
Expand All @@ -224,6 +245,14 @@ INT_PTR CALLBACK MainDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case IDC_SET_AZURE_KEY:
DialogBoxParamW(nullptr, MAKEINTRESOURCEW(IDD_AZUREKEY), hDlg, AzureKeyDlg, 0);
break;
case IDC_SET_POLLY_KEY:
DialogBoxParamW(nullptr, MAKEINTRESOURCEW(IDD_POLLYKEY), hDlg, PollyKeyDlg, 0);
UpdateDisplay(hDlg);
break;
case IDC_SET_ELEVENLABS_KEY:
DialogBoxParamW(nullptr, MAKEINTRESOURCEW(IDD_ELEVENKEY), hDlg, ElevenLabsKeyDlg, 0);
UpdateDisplay(hDlg);
break;
case IDC_CHANGE_LANGUAGES:
DialogBoxParamW(nullptr, MAKEINTRESOURCEW(IDD_LANG), hDlg, LangDlg, 0);
UpdateDisplay(hDlg);
Expand Down
79 changes: 79 additions & 0 deletions Installer/PollyKeyDlg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include "framework.h"
#include "Installer.h"
#include "RegKey.h"

INT_PTR CALLBACK PollyKeyDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
{
RegKey key;
key.Open(HKEY_CURRENT_USER, L"Software\\NaturalVoiceSAPIAdapter\\Enumerator", KEY_QUERY_VALUE);

SetDlgItemTextW(hDlg, IDC_POLLY_ACCESS_KEY, key.GetString(L"PollyAccessKey").c_str());
SetDlgItemTextW(hDlg, IDC_POLLY_SECRET_KEY, key.GetString(L"PollySecretKey").c_str());
SetDlgItemTextW(hDlg, IDC_POLLY_REGION, key.GetString(L"PollyRegion").c_str());

// Populate engine combobox
HWND hEngine = GetDlgItem(hDlg, IDC_POLLY_ENGINE);
const LPCWSTR engines[] = { L"generative", L"neural", L"long-form", L"standard" };
for (auto* e : engines)
SendMessageW(hEngine, CB_ADDSTRING, 0, (LPARAM)e);

std::wstring curEngine = key.GetString(L"PollyEngine");
if (curEngine.empty()) curEngine = L"neural";
int sel = (int)SendMessageW(hEngine, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)curEngine.c_str());
SendMessageW(hEngine, CB_SETCURSEL, sel >= 0 ? sel : 1 /*neural*/, 0);

return TRUE;
}

case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
{
RegKey key;
key.Create(HKEY_CURRENT_USER, L"Software\\NaturalVoiceSAPIAdapter\\Enumerator", KEY_SET_VALUE);

WCHAR buf[512];
GetDlgItemTextW(hDlg, IDC_POLLY_ACCESS_KEY, buf, 512);
key.SetString(L"PollyAccessKey", buf);
GetDlgItemTextW(hDlg, IDC_POLLY_SECRET_KEY, buf, 512);
key.SetString(L"PollySecretKey", buf);
GetDlgItemTextW(hDlg, IDC_POLLY_REGION, buf, 512);
key.SetString(L"PollyRegion", buf);

HWND hEngine = GetDlgItem(hDlg, IDC_POLLY_ENGINE);
int sel = (int)SendMessageW(hEngine, CB_GETCURSEL, 0, 0);
if (sel >= 0)
{
SendMessageW(hEngine, CB_GETLBTEXT, sel, (LPARAM)buf);
key.SetString(L"PollyEngine", buf);
}

EndDialog(hDlg, IDOK);
return TRUE;
}
case IDCANCEL:
EndDialog(hDlg, IDCANCEL);
return TRUE;
}
break;

case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case NM_CLICK:
case NM_RETURN:
ShellExecuteW(nullptr, nullptr,
L"https://console.aws.amazon.com/iam/home#/users",
nullptr, nullptr, SW_SHOWNORMAL);
break;
}
break;
}
return (INT_PTR)FALSE;
}
24 changes: 19 additions & 5 deletions Installer/resource.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ ���ɵİ����ļ���
// �� Installer.rc ʹ��
// Microsoft Visual C++ ���ɵİ����ļ���
// �� Installer.rc ʹ��
//
#define IDC_MYICON 2
#define IDD_MAIN 102
Expand Down Expand Up @@ -59,16 +59,30 @@
#define IDC_AZURE_REGION 1031
#define IDC_STATIC_INCLUDED_LANGUAGES 1032
#define IDC_LANG_MULTILINGUAL 1033
#define IDC_CHK_POLLY_VOICES 1034
#define IDC_SET_POLLY_KEY 1035
#define IDC_POLLY_LINK 1036
#define IDC_POLLY_ACCESS_KEY 1037
#define IDC_POLLY_SECRET_KEY 1038
#define IDC_POLLY_REGION 1039
#define IDC_POLLY_ENGINE 1040
#define IDD_POLLYKEY 141
#define IDD_ELEVENKEY 142
#define IDC_CHK_ELEVENLABS_VOICES 1041
#define IDC_SET_ELEVENLABS_KEY 1042
#define IDC_ELEVENLABS_LINK 1043
#define IDC_ELEVENLABS_API_KEY 1044
#define IDC_ELEVENLABS_MODEL 1045
#define IDC_STATIC -1

// Next default values for new objects
//
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 141
#define _APS_NEXT_RESOURCE_VALUE 143
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1034
#define _APS_NEXT_CONTROL_VALUE 1046
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
Loading