mirror of
https://github.com/unclshura/ABStemPlayer.git
synced 2026-09-21 11:13:38 +00:00
Common interface for audio blocks
This commit is contained in:
parent
d8e1317a74
commit
4c8d4d2ed9
@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
|
<BuildNumber>0</BuildNumber>
|
||||||
|
<SourceRevisionId>0000</SourceRevisionId>
|
||||||
<InformationalVersion>$(Version).$(BuildNumber)+$(SourceRevisionId)</InformationalVersion>
|
<InformationalVersion>$(Version).$(BuildNumber)+$(SourceRevisionId)</InformationalVersion>
|
||||||
<AssemblyVersion>$(Version)</AssemblyVersion>
|
<AssemblyVersion>$(Version)</AssemblyVersion>
|
||||||
<FileVersion>$(Version).$(BuildNumber)</FileVersion>
|
<FileVersion>$(Version).$(BuildNumber)</FileVersion>
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public sealed class RubberBandTimeStretchEngine : ITimeStretchEngine, IAsyncDisp
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
proc.Stdin.Flush();
|
proc.Stdin?.Flush();
|
||||||
}
|
}
|
||||||
catch (System.ObjectDisposedException)
|
catch (System.ObjectDisposedException)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using AudioCore.Impl;
|
|||||||
|
|
||||||
namespace AudioCore.Models;
|
namespace AudioCore.Models;
|
||||||
|
|
||||||
public readonly struct AudioBlock : IDisposable
|
public readonly struct AudioBlock : IAudioBlock, IDisposable
|
||||||
{
|
{
|
||||||
public AudioBuffer<float> Buffer { get; }
|
public AudioBuffer<float> Buffer { get; }
|
||||||
public int SampleRate { get; }
|
public int SampleRate { get; }
|
||||||
|
|||||||
14
AudioCore/Models/IAudioBlock.cs
Normal file
14
AudioCore/Models/IAudioBlock.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using AudioCore.Impl;
|
||||||
|
|
||||||
|
namespace AudioCore.Models;
|
||||||
|
|
||||||
|
public interface IAudioBlock : IDisposable
|
||||||
|
{
|
||||||
|
AudioBuffer<float> Buffer { get; }
|
||||||
|
int SampleRate { get; }
|
||||||
|
int Channels { get; }
|
||||||
|
long Position { get; }
|
||||||
|
int Frames { get; }
|
||||||
|
int Length { get; }
|
||||||
|
Span<float> Span { get; }
|
||||||
|
}
|
||||||
@ -2,21 +2,23 @@ using AudioCore.Impl;
|
|||||||
|
|
||||||
namespace AudioCore.Models;
|
namespace AudioCore.Models;
|
||||||
|
|
||||||
public readonly struct MixedAudioBlock : IDisposable
|
public readonly struct MixedAudioBlock : IAudioBlock, IDisposable
|
||||||
{
|
{
|
||||||
public AudioBuffer<float> Buffer { get; }
|
public AudioBuffer<float> Buffer { get; }
|
||||||
public int Frames { get; }
|
public int Frames { get; }
|
||||||
public int Channels { get; }
|
public int Channels { get; }
|
||||||
public int SampleRate { get; }
|
public int SampleRate { get; }
|
||||||
public long Position { get; }
|
public long Position { get; }
|
||||||
|
|
||||||
|
public Span<float> Span => Buffer.Span;
|
||||||
|
public int Length => Buffer.Length;
|
||||||
public MixedAudioBlock(AudioBuffer<float> buffer, int frames, int channels, int sampleRate, long samplePosition)
|
public MixedAudioBlock(AudioBuffer<float> buffer, int frames, int channels, int sampleRate, long samplePosition)
|
||||||
{
|
{
|
||||||
Buffer = buffer;
|
Buffer = buffer;
|
||||||
Frames = frames;
|
Frames = frames;
|
||||||
Channels = channels;
|
Channels = channels;
|
||||||
SampleRate = sampleRate;
|
SampleRate = sampleRate;
|
||||||
Position = samplePosition;
|
Position = samplePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() => Buffer.Dispose();
|
public void Dispose() => Buffer.Dispose();
|
||||||
|
|||||||
@ -2,14 +2,16 @@ using AudioCore.Impl;
|
|||||||
|
|
||||||
namespace AudioCore.Models;
|
namespace AudioCore.Models;
|
||||||
|
|
||||||
public readonly struct TimeStretchedAudioBlock : IDisposable
|
public readonly struct TimeStretchedAudioBlock : IAudioBlock, IDisposable
|
||||||
{
|
{
|
||||||
public AudioBuffer<float> Buffer { get; }
|
public AudioBuffer<float> Buffer { get; }
|
||||||
public int Frames { get; }
|
public int Frames { get; }
|
||||||
public int Channels { get; }
|
public int Channels { get; }
|
||||||
public int SampleRate { get; }
|
public int SampleRate { get; }
|
||||||
public long Position { get; }
|
public long Position { get; }
|
||||||
|
|
||||||
|
public Span<float> Span => Buffer.Span;
|
||||||
|
public int Length => Buffer.Length;
|
||||||
public TimeStretchedAudioBlock(AudioBuffer<float> buffer, int frames, int channels, int sampleRate, long position)
|
public TimeStretchedAudioBlock(AudioBuffer<float> buffer, int frames, int channels, int sampleRate, long position)
|
||||||
{
|
{
|
||||||
Buffer = buffer;
|
Buffer = buffer;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user