Skip to content

Commit

Permalink
Merge pull request #13 from HyPlayer/audio-graph-service
Browse files Browse the repository at this point in the history
[Implementation] Implementation of AudioGraph
  • Loading branch information
Raspberry-Monster authored Jul 14, 2024
2 parents 9824afe + 20b45b0 commit d849577
Show file tree
Hide file tree
Showing 82 changed files with 1,669 additions and 116 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nuget-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -30,7 +30,7 @@ jobs:
dotnet pack HyPlayer.PlayCore.Abstraction/HyPlayer.PlayCore.Abstraction.csproj -c Release -o Packages/
- name: Publish Packages to Artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4.3.4
with:
name: packages
path: Packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qodana-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
with:
fetch-depth: 0
- name: "Qodana Scan"
uses: JetBrains/qodana-action@v2023.2.1
uses: JetBrains/qodana-action@v2024.1.8
env:
QODANA_TOKEN: ${{secrets.QODANA_TOKEN}}
13 changes: 13 additions & 0 deletions .idea/.idea.HyPlayer.PlayCore/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.HyPlayer.PlayCore/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.HyPlayer.PlayCore/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.HyPlayer.PlayCore/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions HyPlayer.PlayCore.Abstraction/AudioServiceBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;
using HyPlayer.PlayCore.Abstraction.Models.Resources;

namespace HyPlayer.PlayCore.Abstraction;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace HyPlayer.PlayCore.Abstraction.Interfaces.AudioServices
{
public interface IAudioServiceSettings
{

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.AudioServices;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ namespace HyPlayer.PlayCore.Abstraction.Interfaces.AudioServices;
/// </summary>
public interface IAudioTicketSeekableService : IAudioService
{
public Task SeekAudioTicketAsync(AudioTicketBase audioTicket, long position, CancellationToken ctk = new());
public Task SeekAudioTicketAsync(AudioTicketBase audioTicket, double position, CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface IOutputDeviceChangeableService : IAudioService
/// 获取可输出设备列表
/// </summary>
/// <returns></returns>
public Task<List<OutputDeviceBase>> GetOutputDevicesAsync( CancellationToken ctk = new());
public Task<List<OutputDeviceBase>> GetOutputDevicesAsync(CancellationToken ctk = new());

/// <summary>
/// 设置输出设备
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models.Lyric;
using HyPlayer.PlayCore.Abstraction.Models.Lyric;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Lyric;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayCore;
public interface IPlayCorePlayPositionModification : IPlayCore
{
public Task MovePointerToAsync(SingleSongBase song, CancellationToken ctk = new());
public Task MoveNextAsync( CancellationToken ctk = new());
public Task MovePreviousAsync( CancellationToken ctk = new());
public Task MoveNextAsync(CancellationToken ctk = new());
public Task MovePreviousAsync(CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayCore;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.ObjectModel;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayCore;
namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayCore;

public interface IPlayCoreService : IPlayCore
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayListContainer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayListController;

public interface IIndexedPlayListController : IPlaylistController
{
public Task<int> GetCurrentIndexAsync( CancellationToken ctk = new());
public Task<int> GetCurrentIndexAsync(CancellationToken ctk = new());
public Task<SingleSongBase?> GetSongAtAsync(int index, CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayListController;

public interface IPlayListGettablePlaylistController : IPlaylistController
{
public Task<List<SingleSongBase>> GetOrderedPlayListAsync( CancellationToken ctk = new());
public Task<List<SingleSongBase>> GetOrderedPlayListAsync(CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.PlayListController;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace HyPlayer.PlayCore.Abstraction.Interfaces.ProvidableItem;

public interface IHasCover : IProvidableItem
{
public Task<ImageResourceBase?> GetCoverAsync( CancellationToken ctk = new());
public Task<ImageResourceBase?> GetCoverAsync(CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models.Containers;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.ProvidableItem;

public interface IHasCreators : IProvidableItem
{
public List<string>? CreatorList { get; init; }
public Task<List<PersonBase>?> GetCreatorsAsync( CancellationToken ctk = new());
public Task<List<PersonBase>?> GetCreatorsAsync(CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.ProvidableItem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider;

public interface ICommentProvidable : IProvider
{
public Task<ContainerBase?> GetCommentContainerAsync( CancellationToken ctk = new());
public Task<ContainerBase?> GetCommentContainerAsync(CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.ObjectModel;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider;

public interface IProvableItemLikable : IProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider;

public interface ISearchableProvider : IProvider
{
public Task<ContainerBase?> SearchProvidableItemsAsync(string keyword,string typeId, CancellationToken ctk = new());
public Task<ContainerBase?> SearchProvidableItemsAsync(string keyword, string typeId, CancellationToken ctk = new());
}
10 changes: 10 additions & 0 deletions HyPlayer.PlayCore.Abstraction/Models/AudioServiceSettingsBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using HyPlayer.PlayCore.Abstraction.Interfaces.AudioServices;

namespace HyPlayer.PlayCore.Abstraction.Models
{
public abstract class AudioServiceSettingsBase : IAudioServiceSettings
{
public abstract string DefaultOutputDeviceId { get; set; }
public abstract double OutputVolume { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.ObjectModel;

namespace HyPlayer.PlayCore.Abstraction.Models.Containers;
namespace HyPlayer.PlayCore.Abstraction.Models.Containers;

public abstract class ContainersContainer : ContainerBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.ObjectModel;

namespace HyPlayer.PlayCore.Abstraction.Models.Containers;
namespace HyPlayer.PlayCore.Abstraction.Models.Containers;

public abstract class LinerContainerBase : ContainerBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.ObjectModel;

namespace HyPlayer.PlayCore.Abstraction.Models.Lyric;
namespace HyPlayer.PlayCore.Abstraction.Models.Lyric;

public class ProcessedWordLyricLine : ProcessedLyricLine
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;

namespace HyPlayer.PlayCore.Abstraction.Models.Notifications
{
public abstract class AudioTicketReachesEndNotification
{
public abstract AudioTicketBase AudioGraphTicket { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Models.Notifications;
namespace HyPlayer.PlayCore.Abstraction.Models.Notifications;

public class InnerPlayListChangedNotification : NotificationBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;

namespace HyPlayer.PlayCore.Abstraction.Models.Notifications
{
public abstract class MasterTicketChangedNotification
{
public abstract AudioTicketBase MasterTicket { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace HyPlayer.PlayCore.Abstraction.Models.Notifications
{
public abstract class PlaybackPositionChangedNotification
{
public abstract double CurrentPlaybackPosition { get; init; }
}
}
15 changes: 13 additions & 2 deletions HyPlayer.PlayCore.Abstraction/Models/ResourceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ namespace HyPlayer.PlayCore.Abstraction.Models;

public abstract class ResourceBase
{
public string? Url { get; set; }
public Uri? Uri { get; set; }
public string? ResourceName { get; set; }
public bool HasContent { get; set; }
public string? ExtensionName { get; set; }
public abstract ResourceType Type { get; }
public abstract Task<object?> GetResourceAsync(ResourceQualityTag? qualityTag = null, Type? awaitingType = null, CancellationToken ctk = new());
public abstract Task<ResourceResultBase> GetResourceAsync(ResourceQualityTag? qualityTag = null, CancellationToken ctk = new());
}

public abstract class ResourceResultBase
{
public abstract required Exception ExternalException { get; init; }
public abstract required ResourceStatus ResourceStatus { get; init; }
}
public enum ResourceType
{
None,
Expand All @@ -20,4 +25,10 @@ public enum ResourceType
Video,
Audio,
Binary,
}

public enum ResourceStatus
{
Success,
Fail
}
4 changes: 1 addition & 3 deletions HyPlayer.PlayCore.Abstraction/PlayControllerBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction;

Expand Down
3 changes: 1 addition & 2 deletions HyPlayer.PlayCore.Abstraction/PlayCoreBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using HyPlayer.PlayCore.Abstraction.Interfaces.PlayCore;
using HyPlayer.PlayCore.Abstraction.Interfaces.PlayCore;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;
Expand Down
3 changes: 1 addition & 2 deletions HyPlayer.PlayCore.Abstraction/PlayListManagerBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Runtime.CompilerServices;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction;
Expand Down
4 changes: 1 addition & 3 deletions HyPlayer.PlayCore.Abstraction/ProviderBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using HyPlayer.PlayCore.Abstraction.Interfaces.Provider;

namespace HyPlayer.PlayCore.Abstraction;
namespace HyPlayer.PlayCore.Abstraction;

public abstract class ProviderBase : IProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
17 changes: 17 additions & 0 deletions HyPlayer.PlayCore.Demo.AudioGraph.WinUI3/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Application
x:Class="HyPlayer.PlayCore.Demo.AudioGraph.WinUI3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HyPlayer.PlayCore.Demo.AudioGraph.WinUI3">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
<ResourceDictionary Source="/Converters/ConverterDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
Loading

0 comments on commit d849577

Please sign in to comment.