本文整理汇总了C#中Audio类的典型用法代码示例。如果您正苦于以下问题:C# Audio类的具体用法?C# Audio怎么用?C# Audio使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Audio类属于命名空间,在下文中一共展示了Audio类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
public void Search(List<Audio> source, Audio referenceItem, object parameters = null)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
if (referenceItem == null)
{
throw new ArgumentNullException("referenceItem");
}
Tempogram Descriptor = referenceItem.GetData<Tempogram>();
if (Descriptor != null)
{
foreach (var Target in source)
{
Tempogram Tempogram = Target.GetData<Tempogram>();
if (Tempogram == null)
{
Target.Tag = 10;
continue;
}
var d1 = Descriptor.LongTempogram.Distance(Tempogram.LongTempogram);
var d2 = Descriptor.ShortTempogram.Distance(Tempogram.ShortTempogram);
var d3 = Math.Abs(Descriptor.Intensity - Tempogram.Intensity);
Target.Tag = d1 + d2 * 0.0003f + d3 * 0.0002f;
}
}
source.Sort((a1, a2) => a1.Tag.CompareTo(a2.Tag));
}
示例2: button1_Click
//select a song
private void button1_Click(object sender, EventArgs e)
{
timer1.Stop();
timer2.Stop();
OpenFileDialog dlg = new OpenFileDialog();
dlg.ShowDialog();
song_path = dlg.FileName.ToString();
textBox1.Text = song_path;
try
{
song.Stop();
}
catch (Exception ex) { }
try
{
song = new Audio(song_path);
timer1.Interval = (int)(song.Duration * 10);
progressBar1.Value = 0;
//MessageBox.Show(timer1.Interval.ToString());
}
catch (Exception ex) { }
}
示例3: Interrupt
public void Interrupt(Songs p_song)
{
this.audio.Stop();
this.audio = new Audio(Utility.FindMediaFile(@"\Music\" + p_song.ToString() + ".mp3"));
this.audio.Volume = -500;
this.interupted = true;
}
示例4: AudioVisualizationSource
public AudioVisualizationSource(Audio.SampleAggregator aggregator)
{
this.aggregator = aggregator;
MaximumCalculated += new EventHandler<MaxSampleEventArgs>(audioGraph_MaximumCalculated);
FftCalculated += new EventHandler<FftEventArgs>(audioGraph_FftCalculated);
}
示例5: AddAudioPickupSource
public Entity AddAudioPickupSource(Audio[] newClips, bool newRandomizePitch)
{
var component = CreateComponent<AudioPickupSourceComponent>(ComponentIds.AudioPickupSource);
component.clips = newClips;
component.randomizePitch = newRandomizePitch;
return AddComponent(ComponentIds.AudioPickupSource, component);
}
开发者ID:JamesMcMahon,项目名称:entitas-2d-roguelike,代码行数:7,代码来源:AudioPickupSourceComponentGeneratedExtension.cs
示例6: AddAudioDocument
private static void AddAudioDocument(string[] attributes)
{
Dictionary<string, string> attr = getDictAttr(attributes);
string documentName = returnNameCmdValue(attr);
if (documentName != null)
{
Audio newDoc = new Audio(documentName);
documents.Add(newDoc);
Console.WriteLine("Document added: " + documentName);
foreach (var key in attr.Keys)
{
switch (key)
{
case "content":
newDoc.Content = attr[key];
break;
case "samplerate":
newDoc.SampleRateHz = attr[key];
break;
case "length":
newDoc.LengthInSeconds = attr[key];
break;
case "size":
newDoc.SizeInBytes = attr[key];
break;
}
}
}
}
示例7: Dispose
public virtual void Dispose()
{
m_Audio.Stop();
m_Audio.Dispose();
m_Audio = null;
m_Disposed = true;
}
示例8: MainWindow
public MainWindow()
{
InitializeComponent();
string filename = @"C:\Users\Joe\Documents\fftmusic\music\WpfApplication1\Jupiter.wav";//openFile("Select Audio (wav) file");
//string xmlfile = "C:\\Users\\Joe\\Documents\\fftmusic\\music\\WpfApplication1\\Jupiter.xml";// openFile("Select Score (xml) file");
file = new Audio(filename);
//Thread check = new Thread(new ThreadStart(updateSlider));
loadWave(filename);
int trials = 20;
while (trials --> 0)
{
freqDomain();
}
//sheetmusic = readXML(xmlfile);
//onsetDetection();
//loadImage();
//loadHistogram();
//playBack();
//check.Start();
//button1.Click += zoomIN;
//button2.Click += zoomOUT;
//slider1.ValueChanged += updateHistogram;
//playback.PlaybackStopped += closeMusic;
}
示例9: SoundAlarm
public SoundAlarm(string mp3FileName, string fadeInMinutes, string fadeOutMinutes,
string durationMinutes, string fromTime, string toTime, string snoozeTime, string alarmCue)
{
this.fadeInSeconds = (int)TimeSpan.Parse("00:" + fadeInMinutes).TotalSeconds; // 00 hours
this.fadeOutSeconds = (int)TimeSpan.Parse("00:" + fadeOutMinutes).TotalSeconds; // 00 hours
this.durationSeconds = (int)TimeSpan.Parse("00:" + durationMinutes).TotalSeconds; // 00 hours
this.fromTime = fromTime;
this.toTime = toTime;
this.snoozeTime = snoozeTime;
if (string.IsNullOrEmpty(this.fromTime) == true)
{
this.AlarmEnabled = true;
}
this.AlarmStarted = false;
this.stopWatch = new Stopwatch();
this.audio = new Audio(mp3FileName, false);
this.audio.Volume = SoundAlarm.MinVolume;
this.audio.Ending += new EventHandler(this.Audio_Ending);
this.sleepStages = new List<ZeoSleepStage>();
this.ParseAlarmCue(alarmCue);
}
示例10: _ouvrir
public string _ouvrir(typeFichier tf)
{
OpenFileDialog ofd = new OpenFileDialog();
if (tf == typeFichier.musique)
{
ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
ofd.Filter = "mp3 files (*.mp3)|*.mp3";
ofd.FilterIndex = 2;
ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (ofd.OpenFile() != null)
{
try
{
Lecteur = new Audio(ofd.FileName, false);
}
catch (Exception esx)
{
MessageBox.Show("Fichier non reconnu." + esx.HResult);
return null;
}
return ofd.FileName;
}
}
return null;
}
else if (tf == typeFichier.image)
{
ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
ofd.Filter = "JPG (*.jpg)|*.jpg";
ofd.FilterIndex = 2;
ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
try
{
if (ofd.OpenFile() != null)// On attribue le chemin du fichier à lire au
{
return ofd.FileName;
}
}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
return null;
}
}
return null;
}
return null;
}
示例11: MainWindow
// public static Time ttt = new Time();
public MainWindow()
{
// ttt.reset();
InitializeComponent();
string filename = openFile("Select Audio (wav) file");
string xmlfile = openFile("Select Score (xml) file");
Time timer = new Time();
file = new Audio(filename);
timer.next("Load Audio");
Thread check = new Thread(new ThreadStart(updateSlider));
timer.next("slider thread");
loadWave(filename);
timer.next("setup");
freqDomain();
timer.next("freqDomain");
sheetmusic = readXML(xmlfile);
timer.next("sheetmusic");
onsetDetection();
timer.next("onsetDetection");
loadImage();
timer.next("loadImage");
loadHistogram();
timer.next("loadHistogram");
playBack();
timer.next("playBack");
check.Start();
button1.Click += zoomIN;
button2.Click += zoomOUT;
slider1.ValueChanged += updateHistogram;
playback.PlaybackStopped += closeMusic;
timer.end("Other stuff");
// ttt.end("fft total");
}
示例12: AddAudioPickupSource
public Entity AddAudioPickupSource(Audio[] newClips, bool newRandomizePitch)
{
var component = _audioPickupSourceComponentPool.Count > 0 ? _audioPickupSourceComponentPool.Pop() : new AudioPickupSourceComponent();
component.clips = newClips;
component.randomizePitch = newRandomizePitch;
return AddComponent(ComponentIds.AudioPickupSource, component);
}
开发者ID:NotYours180,项目名称:entitas-2d-roguelike,代码行数:7,代码来源:AudioPickupSourceComponentGeneratedExtension.cs
示例13: Main
/** The entry point of the program. It controls the initialisation and defines the main game loop. */
static void Main()
{
//Temporary solution to set the resource directory:
System.IO.Directory.SetCurrentDirectory("..\\..\\res");
//Initialise subsystems
video = new Video();
audio = new Audio();
world = new World();
input = new Input();
ScriptManager.initialiseFromScript("configure.lua", video, audio, world, input);
//Main loop
while (world.running)
{
world.beforeInput();
handleEvents();
input.startFrame();
world.afterInput();
video.draw(world);
audio.play(world);
world.AfterLoop();
input.endFrame();
}
world.Dispose();
audio.Dispose();
video.Dispose();
}
示例14: Main
static void Main()
{
// Play a sound with the Audio class:
Audio myAudio = new Audio();
Console.WriteLine("Playing sound...");
myAudio.Play(@"c:\WINDOWS\Media\chimes.wav");
// Display time information with the Clock class:
Clock myClock = new Clock();
Console.Write("Current day of the week: ");
Console.WriteLine(myClock.LocalTime.DayOfWeek);
Console.Write("Current date and time: ");
Console.WriteLine(myClock.LocalTime);
// Display machine information with the Computer class:
Computer myComputer = new Computer();
Console.WriteLine("Computer name: " + myComputer.Name);
if (myComputer.Network.IsAvailable)
{
Console.WriteLine("Computer is connected to network.");
}
else
{
Console.WriteLine("Computer is not connected to network.");
}
}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:27,代码来源:how-to--use-the-my-namespace--csharp-programming-guide-_2.cs
示例15: Dispose
public static void Dispose()
{
if (m_Audio != null)
{
m_Audio.Dispose();
}
m_Audio = null;
}