Skip to content

Commit

Permalink
Version 0.7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dsafa committed Feb 14, 2019
2 parents f1e3e45 + c3f78fe commit 6cfc4a1
Show file tree
Hide file tree
Showing 180 changed files with 4,904 additions and 1,903 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ Audio Band allows you to display song information in the taskbar.

![](screenshots/custom-2.png)

# Table of contents
1. [Installation](#installation)
2. [Usage](#usage)
3. [Plugins](#audiosources)
1. [Spotify](#spotify-setup)
2. [iTunes](#itunes)
3. [MusicBee](#musicbee)
4. [Customization](#customization)

## Installation
There is currently no installer available, however there are prereleases in the [Release](https://github.com/dsafa/audio-band/releases) page that come with a script to install manually.

Expand All @@ -31,7 +40,7 @@ There is currently no installer available, however there are prereleases in the

**IMPORTANT** If nothing happens after selecting `Audio Band` from the toolbars menu or if there are no options in the `Audio Source` menu, some files are being blocked by windows. To fix it, run `unblock.ps1` with powershell. If that doesn't work you can manually fix it by right clicking the files -> properties and clicking unblock. If there are still problems, feel free to post an issue.

## Current Supported Audio Sources (see below for setup instructions and issues)
## <a name="audiosources"></a>Current Supported Audio Sources (see below for setup instructions and issues)
- Spotify
- iTunes
- MusicBee
Expand All @@ -49,7 +58,6 @@ There is currently no installer available, however there are prereleases in the
![](./screenshots/spotify-app-settings-callback.png)

#### Spotify Issues
- The song progress will be out of sync if you change the song's progress. This is due to current limitations making the song progress being tracked locally. This can be fixed if you pause and play again or go to a different song.
- The first time you open up Spotify, the current song may not be displayed. This is because Spotify doesn't report any song information if you have no devices playing songs. Just start playing a song and it will start displaying.

### iTunes
Expand Down
19 changes: 18 additions & 1 deletion src/AudioBand.AudioSource/AudioBand.AudioSource.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\AudioBand.AudioSource.xml</DocumentationFile>
<CodeAnalysisRuleSet>..\AudioBandRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -30,6 +32,8 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowedReferenceRelatedFileExtensions>.none</AllowedReferenceRelatedFileExtensions>
<CodeAnalysisRuleSet>..\AudioBandRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\Release\AudioBand.AudioSource.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -41,10 +45,23 @@
<Compile Include="AudioSourceSettingAttribute.cs" />
<Compile Include="IAudioSource.cs" />
<Compile Include="IAudioSourceLogger.cs" />
<Compile Include="ISupportsRatings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RepeatMode.cs" />
<Compile Include="SettingChangedEventArgs.cs" />
<Compile Include="SettingValidationResult.cs" />
<Compile Include="SettingOptions.cs" />
<Compile Include="TrackInfoChangedEventArgs.cs" />
<Compile Include="TrackRating.cs" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="..\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
19 changes: 19 additions & 0 deletions src/AudioBand.AudioSource/AudioBand.AudioSource.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>AudioBand.AudioSource</id>
<version>$version$</version>
<title>$title$</title>
<authors>Brandon Chong</authors>
<owners>dsafa</owners>
<license type="expression">MIT</license>
<projectUrl>https://github.com/dsafa/audio-band</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Library to develop audio sources for AudioBand</description>
<copyright>Copyright 2019</copyright>
</metadata>
<files>
<file src="content/readme.txt" target=""/>
<file src="content/AudioSource.manifest" target="content"/>
</files>
</package>
53 changes: 14 additions & 39 deletions src/AudioBand.AudioSource/AudioSourceSettingAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,64 +7,39 @@ namespace AudioBand.AudioSource
/// </summary>
/// <inheritdoc cref="Attribute"/>
[AttributeUsage(AttributeTargets.Property)]
[Serializable]
public class AudioSourceSettingAttribute : Attribute
{
/// <summary>
/// Name of the validator function
/// <para/>
/// The validation function should have the signature (object valueToValidate, string nameOfPropertyBeingSet) -> <see cref="SettingValidationResult"/>
/// Initializes a new instance of the <see cref="AudioSourceSettingAttribute"/> class
/// with the setting name.
/// </summary>
public string ValidatorName { get; set; }
/// <param name="name">Name of the setting.</param>
public AudioSourceSettingAttribute(string name)
{
Name = name;
}

/// <summary>
/// Name of the setting.
/// Gets or sets the name of the setting.
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or Sets the <see cref="SettingOptions"/> for the setting.
/// Gets or sets the <see cref="SettingOptions"/> flags for the setting.
/// </summary>
public SettingOptions Options { get; set; }

/// <summary>
/// Priority when changing more that one setting. Higher is higher priority
/// Gets or sets the priority when changing more that one setting.
/// <para/>
/// A higher value is higher priority.
/// </summary>
public int Priority { get; set; }

/// <summary>
/// Description of the setting.
/// Gets or sets the description of the setting.
/// </summary>
public string Description { get; set; }

/// <summary>
/// Expose this property as a setting with a given name
/// </summary>
/// <param name="name">Name of the setting.</param>
public AudioSourceSettingAttribute(string name)
{
Name = name;
}
}

/// <summary>
/// Flags for audio source settings.
/// </summary>
[Flags]
public enum SettingOptions
{
/// <summary>
/// Setting is invisible to the user.
/// </summary>
Hidden = 1 << 0,

/// <summary>
/// Setting cannot be modified by the user.
/// </summary>
ReadOnly = 1 << 1,

/// <summary>
/// Indicates a sensitive setting such as a password, causing a warning to be given.
/// </summary>
Sensitive = 1 << 2,
}
}
91 changes: 67 additions & 24 deletions src/AudioBand.AudioSource/IAudioSource.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;

namespace AudioBand.AudioSource
Expand All @@ -12,70 +11,114 @@ namespace AudioBand.AudioSource
public interface IAudioSource
{
/// <summary>
/// Gets the name of the audio source.
/// Occurs when a setting has changed internally.
/// </summary>
/// <value>The name of the audio source.</value>
string Name { get; }
event EventHandler<SettingChangedEventArgs> SettingChanged;

/// <summary>
/// Gets or sets the <see cref="IAudioSourceLogger"/> used for logging.
/// Occurs when track information has changed.
/// </summary>
/// <value>Audio source logger that will be injected.</value>
IAudioSourceLogger Logger { get; set; }
event EventHandler<TrackInfoChangedEventArgs> TrackInfoChanged;

/// <summary>
/// Occurs when a setting has changed internally.
/// Occurs when the track play state has changed. <see langword="true"/> if playing; <see langword="false"/> otherwise;
/// </summary>
event EventHandler<SettingChangedEventArgs> SettingChanged;
event EventHandler<bool> IsPlayingChanged;

/// <summary>
/// Occurs when track information has changed.
/// Occurs when the current track progress has changed.
/// </summary>
event EventHandler<TrackInfoChangedEventArgs> TrackInfoChanged;
event EventHandler<TimeSpan> TrackProgressChanged;

/// <summary>
/// Occurs when the playback state has changed to playing.
/// Occurs when the volume of the audio source changes. The range of the volume is between 0.0 and 1.0 inclusive.
/// </summary>
event EventHandler TrackPlaying;
event EventHandler<float> VolumeChanged;

/// <summary>
/// Occurs when the playback state has changed to paused.
/// Occurs when the shuffle state changes. <see langword="true"/> if shuffle is on; <see langword="false"/> otherwise;
/// </summary>
event EventHandler TrackPaused;
event EventHandler<bool> ShuffleChanged;

/// <summary>
/// Occurs when the current track progress has changed.
/// Occurs when the repeat mode changes.
/// </summary>
event EventHandler<TimeSpan> TrackProgressChanged;
event EventHandler<RepeatMode> RepeatModeChanged;

/// <summary>
/// Gets the name of the audio source.
/// </summary>
/// <value>The name of the audio source.</value>
string Name { get; }

/// <summary>
/// Called when the audio source is active.
/// Gets or sets the <see cref="IAudioSourceLogger"/> used for logging.
/// </summary>
Task ActivateAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <value>Audio source logger that will be injected.</value>
IAudioSourceLogger Logger { get; set; }

/// <summary>
/// Called when the audio source becomes active.
/// </summary>
/// <returns>A <see cref="Task"/> representing the asynchronous activate operation.</returns>
Task ActivateAsync();

/// <summary>
/// Called when the audio source is no longer active.
/// </summary>
Task DeactivateAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <returns>A <see cref="Task"/> representing the asynchronous deactivate operation.</returns>
Task DeactivateAsync();

/// <summary>
/// Called when there is a request to start playback.
/// </summary>
Task PlayTrackAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <returns>A <see cref="Task"/> representing the asynchronous play operation.</returns>
Task PlayTrackAsync();

/// <summary>
/// Called when there is a request to stop playback.
/// </summary>
Task PauseTrackAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <returns>A <see cref="Task"/> representing the asynchronous pause operation.</returns>
Task PauseTrackAsync();

/// <summary>
/// Called when there is a request to skip to the previous track.
/// </summary>
Task PreviousTrackAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <returns>A <see cref="Task"/> representing the asynchronous skip to previous track operation.</returns>
Task PreviousTrackAsync();

/// <summary>
/// Called when there is a request to skip to the next track.
/// </summary>
Task NextTrackAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <returns>A <see cref="Task"/> representing the asynchronous skip to next track operation.</returns>
Task NextTrackAsync();

/// <summary>
/// Called when there is a request to change the volume.
/// </summary>
/// <param name="newVolume">The new volume to set. The range is between 0.0 and 1.0 inclusive.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous set volume operation.</returns>
Task SetVolumeAsync(float newVolume);

/// <summary>
/// Called when there is a request to change to current playback progress.
/// </summary>
/// <param name="newProgress">The new time to seek to.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous set playback progress operation.</returns>
Task SetPlaybackProgressAsync(TimeSpan newProgress);

/// <summary>
/// Called when there is a request to change the shuffle state.
/// </summary>
/// <param name="shuffleOn">The new shuffle state, <see langword="true"/> if shuffle should be on; <see langword="false"/> otherwise.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous set shuffle operation.</returns>
Task SetShuffleAsync(bool shuffleOn);

/// <summary>
/// Called when there is a request to change the repeat mode.
/// </summary>
/// <param name="newRepeatMode">The new <see cref="RepeatMode"/>.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous set repeat mode operation.</returns>
Task SetRepeatModeAsync(RepeatMode newRepeatMode);
}
}
23 changes: 23 additions & 0 deletions src/AudioBand.AudioSource/ISupportsRatings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Threading.Tasks;

namespace AudioBand.AudioSource
{
/// <summary>
/// Indicates that this audio source supports ratings on tracks.
/// </summary>
public interface ISupportsRatings
{
/// <summary>
/// Occurs when the the track's rating has changed.
/// </summary>
event EventHandler<TrackRating> TrackRatingChanged;

/// <summary>
/// Called when a new rating is being set.
/// </summary>
/// <param name="newRating">The new rating of the track</param>
/// <returns>A <see cref="Task"/> representing the asynchronous set rating operation.</returns>
Task SetTrackRatingAsync(TrackRating newRating);
}
}
4 changes: 2 additions & 2 deletions src/AudioBand.AudioSource/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AudioBand.AudioSource")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Library that provides the interfaces for implementing audio sources")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AudioBand.AudioSource")]
Expand Down Expand Up @@ -35,4 +35,4 @@
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

[assembly: InternalsVisibleTo("AudioBand")]
[assembly: InternalsVisibleTo("AudioBand")]
23 changes: 23 additions & 0 deletions src/AudioBand.AudioSource/RepeatMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace AudioBand.AudioSource
{
/// <summary>
/// Specifies the repeat mode of the audio source.
/// </summary>
public enum RepeatMode
{
/// <summary>
/// No repeat.
/// </summary>
Off,

/// <summary>
/// Repeat the current context.
/// </summary>
RepeatContext,

/// <summary>
/// Repeat the current track.
/// </summary>
RepeatTrack,
}
}
Loading

0 comments on commit 6cfc4a1

Please sign in to comment.