Skip to content

Commit

Permalink
Merge pull request #13 from samunohito/develop
Browse files Browse the repository at this point in the history
v0.1.71-beta
  • Loading branch information
samunohito authored Apr 23, 2022
2 parents 6ac2897 + b6aeb43 commit 137b5b1
Show file tree
Hide file tree
Showing 67 changed files with 1,562 additions and 702 deletions.
4 changes: 4 additions & 0 deletions .git-pr-release-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<%= ENV['APP_VERSION'] %>
<% pull_requests.each do |pr| -%>
<%= pr.to_checklist_item %>
<% end -%>
37 changes: 37 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: create a release pull request

on:
workflow_dispatch:

pull_request:
types: [ closed ]
branches:
- develop

env:
pathOfVersioning: ${{ github.workspace }}/SimpleVolumeMixer

jobs:
create-release-pr:
runs-on: ubuntu-latest
steps:

- name: checkout this solution
uses: actions/checkout@v2
with:
fetch-depth: 0

- id: nbgv
run: |
VERSION=`nbgv get-version -p ${{ env.pathOfVersioning }} -v NuGetPackageVersion`
echo "::set-output name=version::$VERSION"
- name: create a release pull request
uses: bakunyo/git-pr-release-action@281e1fe424fac01f3992542266805e4202a22fe0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_PR_RELEASE_BRANCH_PRODUCTION: master
GIT_PR_RELEASE_BRANCH_STAGING: develop
GIT_PR_RELEASE_LABELS: release
APP_VERSION: v${{ steps.nbgv.outputs.version }}
GIT_PR_RELEASE_TEMPLATE: .git-pr-release-template
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:

jobs:
build-artifact:
if: github.event.pull_request.merged == true
runs-on: windows-2019
outputs:
artifactName: ${{ steps.vars.outputs.artifactName }}
Expand Down Expand Up @@ -79,10 +80,10 @@ jobs:
- id: vars
shell: bash
run: |
if [[ "${{ needs.build-artifact.outputs.prereleaseVersionNoLeadingHyphen }}" = "beta" -o "${{ needs.build-artifact.outputs.prereleaseVersionNoLeadingHyphen }}" = "alpha" ]]; then
echo "::set-output name=isPrerelease::true";
if [ "${{ needs.build-artifact.outputs.prereleaseVersionNoLeadingHyphen }}" = "beta" ] || [ "${{ needs.build-artifact.outputs.prereleaseVersionNoLeadingHyphen }}" = "alpha" ]; then
echo "::set-output name=isPrerelease::true"
else
echo "::set-output name=isPrerelease::false";
echo "::set-output name=isPrerelease::false"
fi;
- id: create-release
Expand All @@ -99,6 +100,7 @@ jobs:
run: |
echo "::set-output name=uploadUrl::${{ steps.create-release.outputs.upload_url }}"
upload-release:
runs-on: ubuntu-latest
needs: [ create-release, build-artifact ]
Expand Down
8 changes: 8 additions & 0 deletions .idea/.idea.SimpleVolumeMixer/.idea/misc.xml

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

Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
using Reactive.Bindings;
using System.Collections.ObjectModel;
using Reactive.Bindings;
using SimpleVolumeMixer.Core.Helper.CoreAudio;
using SimpleVolumeMixer.Core.Helper.CoreAudio.Types;

namespace SimpleVolumeMixer.Core.Contracts.Models.Repository;

public interface ICoreAudioRepository
{
ReadOnlyReactiveCollection<AudioDeviceAccessor> AudioDevices { get; }
/// <summary>
/// 現在使用可能な<see cref="AudioDeviceAccessor"/>の一覧を取得する。
/// 読み取り専用であり、このオブジェクトからデバイスの増減を行うことは出来ない。
/// デバイスの増減は<see cref="AudioDeviceAccessorManager.CollectAudioEndpoints"/>によりCoreAudioAPIからデバイス一覧を取り直すか、
/// <see cref="AudioDeviceAccessorManager"/>がCoreAudioAPIからの通知を受け、その結果デバイスが追加されるかに限る。
/// </summary>
ReadOnlyObservableCollection<AudioDeviceAccessor> AudioDevices { get; }

/// <summary>
/// <see cref="RoleType.Communications"/>ロールのデバイスを取得する。
/// インスタンスは<see cref="AudioDevices"/>から<see cref="RoleType.Communications"/>ロールを持つ物を検索して取得できる値と同一である。
/// </summary>
IReadOnlyReactiveProperty<AudioDeviceAccessor?> CommunicationRoleDevice { get; }

/// <summary>
/// <see cref="RoleType.Multimedia"/>ロールのデバイスを取得する。
/// インスタンスは<see cref="AudioDevices"/>から<see cref="RoleType.Multimedia"/>ロールを持つ物を検索して取得できる値と同一である。
/// </summary>
IReadOnlyReactiveProperty<AudioDeviceAccessor?> MultimediaRoleDevice { get; }

/// <summary>
/// 引数のデバイスと<see cref="DataFlowType"/>のデバイスに対し、<see cref="RoleType"/>のロールを割り当てる。
/// </summary>
/// <param name="accessor"></param>
/// <param name="dataFlowType"></param>
/// <param name="roleType"></param>
void SetDefaultDevice(AudioDeviceAccessor accessor, DataFlowType dataFlowType, RoleType roleType);
}
72 changes: 0 additions & 72 deletions SimpleVolumeMixer/Core/Helper/Component/DisposableComponent.cs

This file was deleted.

36 changes: 0 additions & 36 deletions SimpleVolumeMixer/Core/Helper/Component/IDisposableComponent.cs

This file was deleted.

68 changes: 68 additions & 0 deletions SimpleVolumeMixer/Core/Helper/Component/IPollingMonitor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.ComponentModel;
using SimpleVolumeMixer.Core.Helper.Component.Types;

namespace SimpleVolumeMixer.Core.Helper.Component;

/// <summary>
/// Provides an interface to a function that monitors certain values at regular intervals.
/// </summary>
public interface IPollingMonitor : INotifyPropertyChanged
{
/// <summary>
/// Occurs when the result of polling by this interface differs from the previous value.
/// </summary>
/// <seealso cref="INotifyPropertyChanged.PropertyChanged"/>
new event PropertyChangedEventHandler? PropertyChanged;

/// <summary>
/// Holds the latest value obtained during polling.
/// If the value is rewritten by the polling process, the <see cref="PropertyChanged"/> event is fired.
/// </summary>
object Value { get; }

/// <summary>
/// Gets or sets the interval for polling. The interval can be set in milliseconds.
/// See the enum definition for detailed seconds.
/// If <see cref="PollingMonitorIntervalType.Manual"/> is set,
/// no polling is performed and the value is updated only when the <see cref="Refresh()"/> method is called externally.
/// If this property is changed while the polling process is running,
/// the polling process execution interval is adjusted; if <see cref="PollingMonitorIntervalType.Manual"/> is set, the polling process is stopped.
/// </summary>
/// <seealso cref="PollingMonitorIntervalType"/>
PollingMonitorIntervalType IntervalType { get; set; }

/// <summary>
/// Start polling. However, this method only starts the process and does not block the thread.
/// If this method is called when <see cref="IntervalType"/> is set to <see cref="PollingMonitorIntervalType.Manual"/> or when a polling operation is already running,
/// no new polling operation will be started and nothing will happen.
/// </summary>
void Start();

/// <summary>
/// Stops polling, even if called when polling is not running,
/// including when <see cref="IntervalType"/> is <see cref="PollingMonitorIntervalType.Manual"/>, no exception is made.
/// </summary>
void Stop();

/// <summary>
/// The process of obtaining the latest value of the polling process is implemented.
/// When the value is updated, the <see cref="Value"/> property is rewritten and the fact that the value has been updated is notified externally by <see cref="INotifyPropertyChanged.PropertyChanged"/>.
/// </summary>
/// <seealso cref="PropertyChanged"/>
/// <seealso cref="INotifyPropertyChanged.PropertyChanged"/>
void Refresh();
}

/// <summary>
/// An interface that applies a generic to the <see cref="IPollingMonitor.Value"/> property of the <see cref="IPollingMonitor"/> interface.
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IPollingMonitor<T> : IPollingMonitor
{
/// <summary>
/// It has the same functionality as the inherited source, the only difference being that the type is generic.
/// See the documentation of the inherited source for detailed functionality.
/// </summary>
/// <seealso cref="IPollingMonitor.Value"/>
new T Value { get; }
}
17 changes: 0 additions & 17 deletions SimpleVolumeMixer/Core/Helper/Component/IPropertyMonitor.cs

This file was deleted.

21 changes: 21 additions & 0 deletions SimpleVolumeMixer/Core/Helper/Component/KeyValueInstanceManager.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
using System;
using System.Collections.Generic;
using DisposableComponents;

namespace SimpleVolumeMixer.Core.Helper.Component;

/// <summary>
/// This component is used to ensure that the TK and TV values are always 1-1.
/// The key must implement <see cref="IDisposableComponent"/> so that the value can also be destroyed when the key is destroyed.
/// </summary>
/// <typeparam name="TK">Key value type</typeparam>
/// <typeparam name="TV">Type corresponding to TK</typeparam>
public class KeyValueInstanceManager<TK, TV> : DisposableComponent where TK : IDisposableComponent
{
private readonly object _gate = new();
private readonly IDictionary<TK, TV> _instances;
private readonly Func<TK, TV> _factory;

/// <summary>
/// ctor
/// </summary>
/// <param name="factory">Function to generate the value corresponding to a key</param>
public KeyValueInstanceManager(Func<TK, TV> factory)
{
_instances = new Dictionary<TK, TV>();
_factory = factory;
}

/// <summary>
/// If the value corresponding to the key already exists, return that value; if not, create and return a new value.
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public TV Obtain(TK key)
{
lock (_gate)
Expand All @@ -33,6 +49,11 @@ public TV Obtain(TK key)
}
}

/// <summary>
/// Process to erase the value from this instance when the key is destroyed.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void KeyOnDisposed(object? sender, EventArgs e)
{
if (sender == null)
Expand Down
Loading

0 comments on commit 137b5b1

Please sign in to comment.