Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

Commit

Permalink
Wine support
Browse files Browse the repository at this point in the history
  • Loading branch information
weespin committed Apr 17, 2021
1 parent 0e12cc2 commit 963d9f8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
23 changes: 19 additions & 4 deletions AcapellaDownloader/Form1.cs
Expand Up @@ -7,6 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
using NAudio.Wave;
using NAudio.Wave.SampleProviders;

Expand All @@ -16,7 +17,7 @@ public partial class Form1 : Form
{
private float VoiceVolume = 1f;
private float Pitch = 1f;
private const string _noText = "You did not enter the text";
private const string _noText = "You did not enter any text";
private const string _noVoice = "Please select a voice";
public const string downloadError = "A download error has occurred";
public const string downloaded = "Done!";
Expand All @@ -28,6 +29,10 @@ public Form1()
private void btnDownload_Click(object sender, EventArgs e)
{
string soundLink = GetGUISoundLink();
if (soundLink == "")
{
return;
}
SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "MP3 File (*.mp3)|*.mp3";
dialog.FileName = "tts.mp3";
Expand All @@ -49,6 +54,7 @@ private void btnDownload_Click(object sender, EventArgs e)
using (var wc = new WebClient())
{
wc.DownloadFile(soundLink, dialog.FileName);

MessageBox.Show(downloaded);

}
Expand All @@ -57,8 +63,7 @@ private void btnDownload_Click(object sender, EventArgs e)
}

private void Form1_Load(object sender, EventArgs e)
{

{
for (int i = 0; i < WaveOut.DeviceCount; i++)
{
WaveOutCapabilities WOC = WaveOut.GetCapabilities(i);
Expand All @@ -68,7 +73,17 @@ private void Form1_Load(object sender, EventArgs e)
var langs = Voices.VoiceList.GroupBy(i => i.Lang).Select(y => y.FirstOrDefault());
foreach (var lang in langs)
{
var node = tvLanguages.Nodes.Add(new CultureInfo(lang.Lang.Replace("_", "-")).DisplayName);
TreeNode node;
try
{
node = tvLanguages.Nodes.Add(new CultureInfo(lang.Lang.Replace("_", "-")).DisplayName);
}
catch (Exception)
{
//Wine Workaround
node = tvLanguages.Nodes.Add(lang.Lang);
}

foreach (var v in Voices.VoiceList.Where(n=>n.Lang==lang.Lang).ToArray())
{
node.Nodes.Add(v.Name);
Expand Down
8 changes: 7 additions & 1 deletion AcapellaDownloader/Program.cs
@@ -1,5 +1,7 @@
using System;
using System.Windows.Forms;
using Microsoft.Win32;

namespace AcapellaDownloader
{
static class Program
Expand All @@ -13,7 +15,11 @@ static void Main()
{
bOldWindows = true;
}

if (Registry.CurrentUser.OpenSubKey("Software\\Wine", false) != null)
{
//Wine!
bOldWindows = true;
}
string[] commandLineArgs = Environment.GetCommandLineArgs();
if (commandLineArgs.Length > 1)
{
Expand Down

0 comments on commit 963d9f8

Please sign in to comment.