-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBassCdMetaDataSourceStrategy.cs
66 lines (57 loc) · 2.16 KB
/
BassCdMetaDataSourceStrategy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using FoxTunes.Interfaces;
using ManagedBass.Cd;
using System.Collections.Generic;
namespace FoxTunes
{
public class BassCdMetaDataSourceStrategy : BaseComponent, IBassCdMetaDataSourceStrategy
{
const int BIT_RATE = 1411;
const int CHANNELS = 2;
const int SAMPLE_RATE = 44100;
const int BITS_PER_SAMPLE = 16;
public BassCdMetaDataSourceStrategy(int drive)
{
this.Drive = drive;
}
public int Drive { get; private set; }
public virtual bool Fetch()
{
return false;
}
public virtual IEnumerable<MetaDataItem> GetMetaDatas(int track)
{
yield return new MetaDataItem(CommonMetaData.Track, MetaDataItemType.Tag)
{
Value = (track + 1).ToString()
};
yield return new MetaDataItem(CommonMetaData.Title, MetaDataItemType.Tag)
{
Value = string.Format("CD Track {0:00}", track + 1)
};
}
public virtual IEnumerable<MetaDataItem> GetProperties(int track)
{
yield return new MetaDataItem(CommonProperties.Duration, MetaDataItemType.Property)
{
//What the fuck is this? Something to do with 44.1kHz/16bit?
Value = ((BassCd.GetTrackLength(this.Drive, track) / 176400) * 1000).ToString()
};
yield return new MetaDataItem(CommonProperties.AudioBitrate, MetaDataItemType.Property)
{
Value = BIT_RATE.ToString()
};
yield return new MetaDataItem(CommonProperties.AudioChannels, MetaDataItemType.Property)
{
Value = CHANNELS.ToString()
};
yield return new MetaDataItem(CommonProperties.AudioSampleRate, MetaDataItemType.Property)
{
Value = SAMPLE_RATE.ToString()
};
yield return new MetaDataItem(CommonProperties.BitsPerSample, MetaDataItemType.Property)
{
Value = BITS_PER_SAMPLE.ToString()
};
}
}
}