diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2021-02-08 00:00:49 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2021-02-08 00:00:49 -0500 |
| commit | f5a7e3ef7e25aa2545f541e171f2d5f6fe43ecc7 (patch) | |
| tree | 6f5dbb64c68ff3bf8a2cd771366ac5ff466d183d | |
| parent | c7428fab1c38d29bcc50ee263678504e34d01318 (diff) | |
| download | erable-godot-f5a7e3ef7e25aa2545f541e171f2d5f6fe43ecc7.tar.gz erable-godot-f5a7e3ef7e25aa2545f541e171f2d5f6fe43ecc7.tar.bz2 erable-godot-f5a7e3ef7e25aa2545f541e171f2d5f6fe43ecc7.zip | |
Erable playing audio in bg thread; Sirop backend initalized; Msgbox added
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .idea/.idea.Erable/.idea/.gitignore | 13 | ||||
| -rw-r--r-- | .idea/.idea.Erable/.idea/discord.xml | 6 | ||||
| -rw-r--r-- | .idea/.idea.Erable/.idea/encodings.xml | 4 | ||||
| -rw-r--r-- | .idea/.idea.Erable/.idea/indexLayout.xml | 8 | ||||
| -rw-r--r-- | .idea/.idea.Erable/.idea/vcs.xml | 6 | ||||
| -rw-r--r-- | Erable.sln | 14 | ||||
| -rw-r--r-- | Erable/Erable.csproj | 27 | ||||
| -rw-r--r-- | Erable/ViewModels/MainWindowViewModel.cs | 48 | ||||
| -rw-r--r-- | Erable/Views/MainWindow.axaml | 4 | ||||
| -rw-r--r-- | Erable/Views/MessageBox.axaml | 19 | ||||
| -rw-r--r-- | Erable/Views/MessageBox.axaml.cs | 74 | ||||
| -rw-r--r-- | Sirop.Backend/Sirop.Backend.csproj | 13 | ||||
| -rw-r--r-- | appveyor.yml | 4 |
14 files changed, 228 insertions, 13 deletions
@@ -21,7 +21,6 @@ **/.idea/**/contentModel.xml
**/.idea/**/modules.xml
-.idea
*.suo
*.user
.vs/
diff --git a/.idea/.idea.Erable/.idea/.gitignore b/.idea/.idea.Erable/.idea/.gitignore new file mode 100644 index 0000000..0500096 --- /dev/null +++ b/.idea/.idea.Erable/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/contentModel.xml +/projectSettingsUpdater.xml +/.idea.Erable.iml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/.idea.Erable/.idea/discord.xml b/.idea/.idea.Erable/.idea/discord.xml new file mode 100644 index 0000000..cd711a0 --- /dev/null +++ b/.idea/.idea.Erable/.idea/discord.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="DiscordProjectSettings"> + <option name="show" value="PROJECT_FILES" /> + </component> +</project>
\ No newline at end of file diff --git a/.idea/.idea.Erable/.idea/encodings.xml b/.idea/.idea.Erable/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.Erable/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> +</project>
\ No newline at end of file diff --git a/.idea/.idea.Erable/.idea/indexLayout.xml b/.idea/.idea.Erable/.idea/indexLayout.xml new file mode 100644 index 0000000..27ba142 --- /dev/null +++ b/.idea/.idea.Erable/.idea/indexLayout.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ContentModelUserStore"> + <attachedFolders /> + <explicitIncludes /> + <explicitExcludes /> + </component> +</project>
\ No newline at end of file diff --git a/.idea/.idea.Erable/.idea/vcs.xml b/.idea/.idea.Erable/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.Erable/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>
\ No newline at end of file @@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Erable", "Erable\Erable.csproj", "{2A160FE3-0D4C-4834-A5CF-FE87930E31B2}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sirop.Backend", "Sirop.Backend\Sirop.Backend.csproj", "{92930D7F-5FCF-4845-9CF9-E918D67469B1}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -30,5 +32,17 @@ Global {2A160FE3-0D4C-4834-A5CF-FE87930E31B2}.Release|x64.Build.0 = Release|Any CPU
{2A160FE3-0D4C-4834-A5CF-FE87930E31B2}.Release|x86.ActiveCfg = Release|Any CPU
{2A160FE3-0D4C-4834-A5CF-FE87930E31B2}.Release|x86.Build.0 = Release|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Debug|x64.Build.0 = Debug|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Debug|x86.Build.0 = Debug|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Release|x64.ActiveCfg = Release|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Release|x64.Build.0 = Release|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Release|x86.ActiveCfg = Release|Any CPU
+ {92930D7F-5FCF-4845-9CF9-E918D67469B1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/Erable/Erable.csproj b/Erable/Erable.csproj index b10f530..cee2a9c 100644 --- a/Erable/Erable.csproj +++ b/Erable/Erable.csproj @@ -3,7 +3,30 @@ <OutputType>WinExe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
+ <PublishTrimmed>true</PublishTrimmed>
+ <TrimMode>link</TrimMode>
<RootNamespace>Erable</RootNamespace>
+ <Company>Alee Productions</Company>
+ <AssemblyVersion>0.0.1</AssemblyVersion>
+ <IsPackable>false</IsPackable>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup>
+ <RuntimeIdentifiers>osx-x64</RuntimeIdentifiers>
+ <CFBundleName>Erable</CFBundleName> <!-- Also defines .app file name -->
+ <CFBundleDisplayName>Erable</CFBundleDisplayName>
+ <CFBundleIdentifier>xyz.aleeproductions</CFBundleIdentifier>
+ <CFBundleVersion>0.0.1</CFBundleVersion>
+ <CFBundleShortVersionString>0.0.1</CFBundleShortVersionString>
+ <CFBundlePackageType>AAPL</CFBundlePackageType>
+ <CFBundleSignature>????</CFBundleSignature>
+ <CFBundleExecutable>Erable</CFBundleExecutable>
+ <!-- <CFBundleIconFile>AppName.icns</CFBundleIconFile> Will be copied from output directory -->
+ <NSPrincipalClass>NSApplication</NSPrincipalClass>
+ <NSHighResolutionCapable>true</NSHighResolutionCapable>
+ <UseAppHost>true</UseAppHost>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\" />
@@ -14,6 +37,10 @@ <PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
+ <PackageReference Include="Dotnet.Bundle" Version="0.9.13" />
<PackageReference Include="gstreamer-sharp-netcore" Version="0.0.8" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Sirop.Backend\Sirop.Backend.csproj" />
+ </ItemGroup>
</Project>
diff --git a/Erable/ViewModels/MainWindowViewModel.cs b/Erable/ViewModels/MainWindowViewModel.cs index 0c51fbd..ab41886 100644 --- a/Erable/ViewModels/MainWindowViewModel.cs +++ b/Erable/ViewModels/MainWindowViewModel.cs @@ -1,7 +1,6 @@ -using System;
-using System.Collections.Generic;
-using System.Text;
+using System.Threading;
using Avalonia.Controls;
+using Erable.Views;
using Gst;
namespace Erable.ViewModels
@@ -10,9 +9,15 @@ namespace Erable.ViewModels {
public string Greeting => "Welcome to Erable Audio Player!";
- public void PlayFunction(string[] args)
+ public void PlayFunction()
{
- Application.Init(ref args);
+ Thread t = new (AudioPlay);
+ t.Start();
+ }
+
+ static void AudioPlay()
+ {
+ Application.Init();
// Build the pipeline
var pipeline = Parse.Launch("playbin uri=file:///home/andrew/Music/4616-werq-by-kevin-macleod.mp3");
@@ -24,13 +29,38 @@ namespace Erable.ViewModels var msg = bus.TimedPopFiltered (Constants.CLOCK_TIME_NONE, MessageType.Eos | MessageType.Error);
// Free resources
- //pipeline.SetState (State.Null);
+ pipeline.SetState (State.Null);
+
+ }
+
+
+ public async void BrowseFunction()
+ {
+ var dialog = new OpenFileDialog();
+ // dialog.Title
+ dialog.Filters.Add(new FileDialogFilter() {Name = "Audio Files", Extensions = {"mp3", "wav", "flac"}});
+ dialog.Title = "Select Audio FIle";
+ /*
+ var files = await dialog.ShowAsync(this);
+
+ if(files != null && files.Length > 0)
+ {
+ var file = files[0];
+ if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
+ {
+ PlayFunction($"file:/{file.Replace('\\', '/')}");
+ }
+ else
+ {
+ PlayFunction($"file://{file}");
+ }
+ }*/
}
- public void BrowseFunction()
+ public void MsgBoxTest()
{
- //OpenFileDialog dialog = new OpenFileDialog();
- //dialog.Filters.Add(new FileDialogFilter() {Name = "Audio Files", Extensions = {"mp3"}});
+ MessageBox.Show(new MainWindow(), "Hello world", "Test Title", MessageBox.MessageBoxButtons.Ok);
}
+
}
}
diff --git a/Erable/Views/MainWindow.axaml b/Erable/Views/MainWindow.axaml index 6bb4cd1..02d362a 100644 --- a/Erable/Views/MainWindow.axaml +++ b/Erable/Views/MainWindow.axaml @@ -4,7 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- x:Class="Erable.Views.MainWindow"
+ x:Class="Erable.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="Erable">
@@ -16,5 +16,7 @@ <Button Name="PlayButton" Width="80" Command="{Binding PlayFunction}" >Play</Button>
<Button Name="StopButton" Width="80" >Stop</Button>
<Button Name="BrowseButton" Width="80" Command="{Binding BrowseFunction }" >Browse</Button>
+ <Button Name="MessageBoxTest" Width="80" Command="{Binding MsgBoxTest }" >Message Box Test</Button>
+
</StackPanel>
</Window>
diff --git a/Erable/Views/MessageBox.axaml b/Erable/Views/MessageBox.axaml new file mode 100644 index 0000000..459817a --- /dev/null +++ b/Erable/Views/MessageBox.axaml @@ -0,0 +1,19 @@ +<Window xmlns="https://github.com/avaloniaui" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:vm="using:Erable.ViewModels" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:Class="Erable.Views.MessageBox" SizeToContent="WidthAndHeight" CanResize="False"> + <StackPanel HorizontalAlignment="Center"> + <TextBlock HorizontalAlignment="Center" Name="Text"/> + <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Name="Buttons"> + <StackPanel.Styles> + <Style Selector="Button"> + <Setter Property="Margin" Value="5"/> + </Style> + </StackPanel.Styles> + + </StackPanel> + </StackPanel> +</Window>
\ No newline at end of file diff --git a/Erable/Views/MessageBox.axaml.cs b/Erable/Views/MessageBox.axaml.cs new file mode 100644 index 0000000..6d8b6d9 --- /dev/null +++ b/Erable/Views/MessageBox.axaml.cs @@ -0,0 +1,74 @@ +using System.Threading.Tasks; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace Erable.Views +{ + public class MessageBox : Window + { + public enum MessageBoxButtons + { + Ok, + OkCancel, + YesNo, + YesNoCancel + } + + public enum MessageBoxResult + { + Ok, + Cancel, + Yes, + No + } + + + public MessageBox() + { + AvaloniaXamlLoader.Load(this); + } + + public static Task<MessageBoxResult> Show(Window parent, string text, string title, MessageBoxButtons buttons) + { + var msgbox = new MessageBox() + { + Title = title + }; + msgbox.FindControl<TextBlock>("Text").Text = text; + var buttonPanel = msgbox.FindControl<StackPanel>("Buttons"); + + var res = MessageBoxResult.Ok; + + void AddButton(string caption, MessageBoxResult r, bool def = false) + { + var btn = new Button {Content = caption}; + btn.Click += (_, __) => { + res = r; + msgbox.Close(); + }; + buttonPanel.Children.Add(btn); + if (def) + res = r; + } + + if (buttons == MessageBoxButtons.Ok || buttons == MessageBoxButtons.OkCancel) + AddButton("OK", MessageBoxResult.Ok, true); + if (buttons == MessageBoxButtons.YesNo || buttons == MessageBoxButtons.YesNoCancel) + { + AddButton("Yes", MessageBoxResult.Yes); + AddButton("No", MessageBoxResult.No, true); + } + + if (buttons == MessageBoxButtons.OkCancel || buttons == MessageBoxButtons.YesNoCancel) + AddButton("Cancel", MessageBoxResult.Cancel, true); + + + var tcs = new TaskCompletionSource<MessageBoxResult>(); + msgbox.Closed += delegate { tcs.TrySetResult(res); }; + if (parent != null) + msgbox.ShowDialog(parent); + else msgbox.Show(); + return tcs.Task; + } + } +}
\ No newline at end of file diff --git a/Sirop.Backend/Sirop.Backend.csproj b/Sirop.Backend/Sirop.Backend.csproj new file mode 100644 index 0000000..a321d62 --- /dev/null +++ b/Sirop.Backend/Sirop.Backend.csproj @@ -0,0 +1,13 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net5.0</TargetFramework> + <PackageVersion>0.0.1</PackageVersion> + <Company>Alee Productions</Company> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="gstreamer-sharp-netcore" Version="0.0.8" /> + </ItemGroup> + +</Project> diff --git a/appveyor.yml b/appveyor.yml index 7ccbbbc..13ce3a5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,9 @@ version: 1.0.{build}
image: Visual Studio 2019
before_build:
-- ps: dotnet restore ./Erable.csproj
+- ps: dotnet restore
build:
verbosity: normal
before_deploy:
+- ps: 7z a Erable-Windows.zip Erable\bin\Debug\net5.0
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/deploy.ps1'))
-- ps: 7z a Erable-Windows.zip bin\Debug\net5.0
\ No newline at end of file |
