本文整理汇总了C#中Pitch类的典型用法代码示例。如果您正苦于以下问题:C# Pitch类的具体用法?C# Pitch怎么用?C# Pitch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pitch类属于命名空间,在下文中一共展示了Pitch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: YPitchBendCube
public YPitchBendCube(Point3D center, double radius,
Pitch pitch, Instrument instrument, OutputDevice device, Channel channel)
: base(center, radius, new InstrumentNoteAction(device, channel, pitch)) {
outputDevice = device;
this.channel = channel;
}
开发者ID:probuilderz,项目名称:balloon,代码行数:7,代码来源:YPitchBendCube.cs
示例2: GenerateMajor
public Chord GenerateMajor(Pitch root, int inversion, int startInterval, NoteLength noteLength, byte velocity = 100)
{
var inversionOffset = new int[3];
switch (inversion)
{
case 0:
inversionOffset = NoInversion;
break;
case 1:
inversionOffset = FirstInversion;
break;
};
int note1 = (int)root + inversionOffset[0];
int note2 = (int)root + inversionOffset[1];
int note3 = (int)root + inversionOffset[2];
var notes = new List<Note>
{
new Note(PitchCode.GetNoteName(note1), startInterval, noteLength, velocity),
new Note(PitchCode.GetNoteName(note2), startInterval, noteLength, velocity),
new Note(PitchCode.GetNoteName(note3), startInterval, noteLength, velocity)
};
return new Chord
{
Notes = notes
};
}
开发者ID:Jbtyson,项目名称:cis598,代码行数:30,代码来源:ChordGenerator.cs
示例3: FindMatchesInBuffer
public MidiMappingRecord[] FindMatchesInBuffer(Pitch[] buffer)
{
var results = new List<MidiMappingRecord>();
var events = buffer.Cast<Pitch?>().ToArray();
// Process chords first. Try to capture a chord with as many notes as possible.
// This is O(scary), but seems quick enough in practice. (c) StackOverflow #184618
foreach (var mapping in chordMappingsOrdered)
{
bool isChordComplete = mapping.Trigger.Pitches.All(p => events.Any(e => e.HasValue && e == p));
if (isChordComplete)
{
// Exclude matched notes from further processing.
for (int i = 0; i < events.Length; i++)
{
var pitch = events[i].Value;
if (mapping.Trigger.Pitches.Any(p => p == pitch))
{
events[i] = null;
}
}
results.Add(mapping);
}
}
// Process remaining single notes.
foreach (var e in events.Where(e => e.HasValue))
{
results.AddRange(FindSingleNoteMatches(e.Value));
}
return results.ToArray();
}
开发者ID:ExSan,项目名称:midichlorian,代码行数:33,代码来源:MidiMappingMatcher.cs
示例4: ToggleBox
public ToggleBox(int left, int top, Pitch pitch)
{
newToggleBox();
this.Left = left;
this.Top = top;
this.pitch = pitch;
}
开发者ID:mrreband,项目名称:MidiLooper,代码行数:7,代码来源:ToggleBox.cs
示例5: randomSpawnParticle
/// <summary>
/// Spawns the particle system randomly inside a sphere of size
/// randomRadius and centered on this object.
/// </summary>
public void randomSpawnParticle(ParticleSystem ps, Pitch pitch)
{
Vector3 randOffset = Random.insideUnitSphere * randomRadius;
Vector3 center = this.transform.position;
ParticleSystem tempParticles =
Instantiate(ps, center + randOffset, Quaternion.identity) as ParticleSystem;
tempParticles.startColor = NoteDecorator.pitchToColor(pitch);
}
开发者ID:TravisDean,项目名称:MEZ,代码行数:12,代码来源:ParticleScriptSpawnEffector.cs
示例6: LibNoteMessage
internal LibNoteMessage(Pitch pitch, int velocity, float time, MessageType type, int channel)
{
Pitch = pitch;
Velocity = velocity;
Time = time;
Type = type;
Channel = channel;
}
开发者ID:joha4270,项目名称:AAU-P2,代码行数:8,代码来源:Note.cs
示例7: DoAction
public void DoAction() {
// start playing the note
if (!isPlaying) {
if (!internalPitch.IsInMidiRange())
internalPitch = Pitch.C4;
Device.SendNoteOn(Channel, internalPitch, 64 );
isPlaying = true;
}
}
开发者ID:probuilderz,项目名称:balloon,代码行数:9,代码来源:InstrumentNoteAction.cs
示例8: Pitch_Plus_Interval_Gives_Higher_Pitch
public void Pitch_Plus_Interval_Gives_Higher_Pitch()
{
var original = new Pitch(100);
var second = new Interval(IntervalDistance.MajorSecond);
var higher = original + second;
Assert.True(higher > original);
Assert.Equal(IntervalDistance.MajorSecond, (higher - original).Distance);
}
开发者ID:deejaygraham,项目名称:tedesco,代码行数:10,代码来源:PitchTests.cs
示例9: Run
public override void Run()
{
OutputDevice outputDevice = ExampleUtil.ChooseOutputDeviceFromConsole();
char inp;
int dx;
Pitch[] notes=new Pitch[7] { Pitch.A4, Pitch.B4, Pitch.C4, Pitch.D4, Pitch.E4, Pitch.F4, Pitch.G4 };
Percussion[] drums=new Percussion[3] { Percussion.BassDrum1, Percussion.MidTom1, Percussion.CrashCymbal1 };
if(outputDevice==null) {
Console.WriteLine("\nNo output devices, so can't run this example.");
ExampleUtil.PressAnyKeyToContinue();
return;
}
if(!File.Exists(PiPath)) {
Console.WriteLine("\nCould not find the data file: {0}", PiPath);
ExampleUtil.PressAnyKeyToContinue();
return;
}
Console.WriteLine("This didn't turn out well at all. A back beat may help it but I'm moving on for now.\n\n");
Console.WriteLine("The follow 10 notes will be used:");
for(dx=0; dx<10 && Console.KeyAvailable==false; dx++) {
if(dx>=notes.Length) {
Console.WriteLine("\tDigit {0} is represented by a {1} drum.", dx, drums[dx-notes.Length].ToString());
} else {
Console.WriteLine("\tDigit {0} is represented by a {1} note.", dx, notes[dx].ToString());
}
}
Console.WriteLine("Interpreting Pi...Press any key to stop...\n\n");
outputDevice.Open();
// outputDevice.SendProgramChange(Channel.Channel1, Instrument.AltoSax);
outputDevice.SendControlChange(Channel.Channel1, Control.SustainPedal, 0);
try {
using(StreamReader sr=new StreamReader(PiPath)) {
while(sr.Peek()>=0 && Console.KeyAvailable==false) {
inp=(char)sr.Read();
if(Char.IsNumber(inp)) { // Skip over non numbers.
Console.Write(inp);
dx=(int)Char.GetNumericValue(inp);
if(dx>=notes.Length) outputDevice.SendPercussion(drums[dx-notes.Length], 90);
else outputDevice.SendNoteOn(Channel.Channel1, notes[dx], 80);
Thread.Sleep(500);
}
}
}
} catch(FieldAccessException e) {
Console.WriteLine("\nError: Could not access file {0}\n\nThe exception was: {1}\n", PiPath, e.Message);
} catch(Exception e) {
Console.WriteLine("\nError: {1}\n", PiPath, e.Message);
}
outputDevice.Close();
while(Console.KeyAvailable) { Console.ReadKey(false); }
Console.WriteLine();
ExampleUtil.PressAnyKeyToContinue();
}
开发者ID:krowe,项目名称:MidiPi,代码行数:53,代码来源:PiTest02.cs
示例10: DecodeNoteOff
/// <summary>
/// Decodes a Note Off short message.
/// </summary>
/// <param name="dwParam1">The dwParam1 arg passed to MidiInProc.</param>
/// <param name="dwParam2">The dwParam2 arg passed to MidiInProc.</param>
/// <param name="channel">Filled in with the channel.</param>
/// <param name="pitch">Filled in with the pitch.</param>
/// <param name="velocity">Filled in with the velocity, 0.127</param>
/// <param name="timestamp">Filled in with the timestamp in microseconds since
/// midiInStart().</param>
public static void DecodeNoteOff(UIntPtr dwParam1, UIntPtr dwParam2,
out Channel channel, out Pitch pitch, out int velocity, out UInt32 timestamp)
{
if (!IsNoteOff(dwParam1, dwParam2))
{
throw new ArgumentException("Not a Note Off message.");
}
channel = (Channel)((int)dwParam1 & 0x0f);
pitch = (Pitch)(((int)dwParam1 & 0xff00) >> 8);
velocity = (((int)dwParam1 & 0xff0000) >> 16);
timestamp = (UInt32)dwParam2;
}
开发者ID:krowe,项目名称:MidiPi,代码行数:22,代码来源:ShortMsg.cs
示例11: Run
public override void Run()
{
OutputDevice outputDevice = ExampleUtil.ChooseOutputDeviceFromConsole();
char inp;
int dx;
Pitch[] notes=new Pitch[10] { Pitch.F3, Pitch.A4, Pitch.B4, Pitch.C4, Pitch.D4, Pitch.E4, Pitch.F4, Pitch.G4, Pitch.A5, Pitch.B6 };
if(outputDevice==null) {
Console.WriteLine("\nNo output devices, so can't run this example.");
ExampleUtil.PressAnyKeyToContinue();
return;
}
if(!File.Exists(PiPath)) {
Console.WriteLine("\nCould not find the data file: {0}", PiPath);
ExampleUtil.PressAnyKeyToContinue();
return;
}
Console.WriteLine("This version simply pads the extra data space with notes from adjacent octaves.\n");
Console.WriteLine("This version many will say is the most accurately reproduction of Pi. That may be true but "+
"at the same time every way of doing this involves a lot of fiddling with the numbers anyway. I wouldn't "+
"be surprised if there are people out there who could listen to this and write down the digits. That "+
"is probably not true of most of the other methods.\n\n");
Console.WriteLine("The follow 10 notes will be used:");
for(dx=0; dx<10 && Console.KeyAvailable==false; dx++) {
Console.WriteLine("\tDigit {0} is represented by a {1} note.", dx, notes[dx].ToString());
}
Console.WriteLine("Interpreting Pi...Press any key to stop...\n\n");
outputDevice.Open();
// outputDevice.SendProgramChange(Channel.Channel1, Instrument.AltoSax);
outputDevice.SendControlChange(Channel.Channel1, Control.SustainPedal, 0);
try {
using(StreamReader sr=new StreamReader(PiPath)) {
while(sr.Peek()>=0 && Console.KeyAvailable==false) {
inp=(char)sr.Read();
if(Char.IsNumber(inp)) { // Skip over non numbers.
Console.Write(inp);
outputDevice.SendNoteOn(Channel.Channel1, notes[(int)Char.GetNumericValue(inp)], 80);
Thread.Sleep(200);
outputDevice.SendNoteOff(Channel.Channel1, notes[(int)Char.GetNumericValue(inp)], 80);
Thread.Sleep(100);
}
}
}
} catch(FieldAccessException e) {
Console.WriteLine("\nError: Could not access file {0}\n\nThe exception was: {1}\n", PiPath, e.Message);
} catch(Exception e) {
Console.WriteLine("\nError: {1}\n", PiPath, e.Message);
}
outputDevice.Close();
while(Console.KeyAvailable) {Console.ReadKey(false);}
Console.WriteLine();
ExampleUtil.PressAnyKeyToContinue();
}
开发者ID:krowe,项目名称:MidiPi,代码行数:52,代码来源:PiTest01.cs
示例12: ProcessPitch
/// <summary>
/// 初略想法,等待弹奏事件,正确就继续,错误继续等待
/// 同GamePlayer CurrentEvent 需要改造
/// </summary>
/// <param name="pitch"></param>
private void ProcessPitch(Pitch pitch)
{
Console.WriteLine("pitch:" + pitch + " waitPitch:" + waitPitch);
if (pitch == waitPitch)
{
processer.Continue();
OnLearing(true, null);
}
else
{
OnLearing(false, null);
}
}
开发者ID:yugsh,项目名称:PianoGame,代码行数:18,代码来源:LearningPlayer.cs
示例13: EncodeNoteOn
/// <summary>
/// Encodes a Note On short message.
/// </summary>
/// <param name="channel">The channel.</param>
/// <param name="pitch">The pitch.</param>
/// <param name="velocity">The velocity 0..127.</param>
/// <returns>A value that can be passed to midiOutShortMsg.</returns>
/// <exception cref="ArgumentOutOfRangeException">pitch is not in MIDI range.</exception>
public static UInt32 EncodeNoteOn(Channel channel, Pitch pitch, int velocity)
{
channel.Validate();
if (!pitch.IsInMidiRange())
{
throw new ArgumentOutOfRangeException("Pitch out of MIDI range.");
}
if (velocity < 0 || velocity > 127)
{
throw new ArgumentOutOfRangeException("Velocity is out of range.");
}
return (UInt32)(0x90 | ((int)channel) | ((int)pitch << 8) | (velocity << 16));
}
开发者ID:bejotka77,项目名称:midi-dot-net,代码行数:21,代码来源:ShortMsg.cs
示例14: LearningPlayer
public LearningPlayer(InputDevice input, MidiFile midifile, MidiOptions midiOption)
{
processer = new MidiProcesser(midifile, midiOption);
inputDevice = input;
inputDevice.NoteOn += delegate(NoteOnMessage msg)
{
ProcessPitch(msg.Pitch);
};
processer.NoteOn += delegate(Channel channel, Pitch pitch, int velocity)
{
waitPitch = pitch;
processer.Stop();
};
}
开发者ID:yugsh,项目名称:PianoGame,代码行数:15,代码来源:LearningPlayer.cs
示例15: ThirdChordNote
private List<Pitch> ThirdChordNote(Pitch pitch1, Pitch pitch2)
{
List<Pitch> p;
Pitch[] pitchnote1 = Second[pitch1];
if (Second.ContainsKey(pitch2))
{
Pitch[] pitchnote2 = Second[pitch2];
p = pitchnote1.Intersect(pitchnote2).ToList();
}
else
{
p = pitchnote1.ToList();
}
p.Remove(pitch2);
return p;
}
开发者ID:Rumu11,项目名称:AAU-P2,代码行数:17,代码来源:BrotherGenerator.cs
示例16: PitchToFrequency
public static double PitchToFrequency(Pitch pitch)
{
return PitchToFrequency((int)pitch);
}
开发者ID:hexd0t,项目名称:Garm_Net,代码行数:4,代码来源:InstrumentSynth.cs
示例17: SendNoteOff
/// <summary>
/// Sends a Note Off message to this MIDI output device.
/// </summary>
/// <param name="channel">The channel.</param>
/// <param name="pitch">The pitch.</param>
/// <param name="velocity">The velocity 0..127.</param>
/// <exception cref="ArgumentOutOfRangeException">channel, note, or velocity is
/// out-of-range.</exception>
/// <exception cref="InvalidOperationException">The device is not open.</exception>
/// <exception cref="DeviceException">The message cannot be sent.</exception>
public void SendNoteOff(Channel channel, Pitch pitch, int velocity)
{
lock (this)
{
CheckOpen();
CheckReturnCode(Win32API.midiOutShortMsg(handle, ShortMsg.EncodeNoteOff(channel,
pitch, velocity)));
}
}
开发者ID:bejotka77,项目名称:midi-dot-net,代码行数:19,代码来源:OutputDevice.cs
示例18: IsMockPitch
/// <summary>
/// If the specified key is one of the computer keys used for mock MIDI input, returns true
/// and sets pitch to the value.
/// </summary>
/// <param name="key">The computer key pressed.</param>
/// <param name="pitch">The pitch it mocks.</param>
/// <returns></returns>
public static bool IsMockPitch(ConsoleKey key, out Pitch pitch)
{
if (mockKeys.ContainsKey(key))
{
pitch = (Pitch)mockKeys[key];
return true;
}
pitch = 0;
return false;
}
开发者ID:bejotka77,项目名称:midi-dot-net,代码行数:17,代码来源:ExampleUtil.cs
示例19: PitchToString_UnalteredNotesPassed_DoesNotAddSharpsOrFlats_Test
public string PitchToString_UnalteredNotesPassed_DoesNotAddSharpsOrFlats_Test(Pitch pitch)
{
return PitchConverter.PitchToString(pitch);
}
开发者ID:ExSan,项目名称:midichlorian,代码行数:4,代码来源:PitchConverter_Tests.cs
示例20: GenerateFontTablePart1Content
// Generates content of fontTablePart1.
private void GenerateFontTablePart1Content(FontTablePart fontTablePart1)
{
Fonts fonts1 = new Fonts() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15" } };
fonts1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
fonts1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
fonts1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
fonts1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
fonts1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
Font font1 = new Font() { Name = "Calibri" };
Panose1Number panose1Number1 = new Panose1Number() { Val = "020F0502020204030204" };
FontCharSet fontCharSet1 = new FontCharSet() { Val = "00" };
FontFamily fontFamily1 = new FontFamily() { Val = FontFamilyValues.Swiss };
Pitch pitch1 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature1 = new FontSignature() { UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "4000ACFF", UnicodeSignature2 = "00000001", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000019F", CodePageSignature1 = "00000000" };
font1.Append(panose1Number1);
font1.Append(fontCharSet1);
font1.Append(fontFamily1);
font1.Append(pitch1);
font1.Append(fontSignature1);
Font font2 = new Font() { Name = "Times New Roman" };
Panose1Number panose1Number2 = new Panose1Number() { Val = "02020603050405020304" };
FontCharSet fontCharSet2 = new FontCharSet() { Val = "00" };
FontFamily fontFamily2 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch2 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature2 = new FontSignature() { UnicodeSignature0 = "E0002EFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font2.Append(panose1Number2);
font2.Append(fontCharSet2);
font2.Append(fontFamily2);
font2.Append(pitch2);
font2.Append(fontSignature2);
Font font3 = new Font() { Name = "Arial" };
Panose1Number panose1Number3 = new Panose1Number() { Val = "020B0604020202020204" };
FontCharSet fontCharSet3 = new FontCharSet() { Val = "00" };
FontFamily fontFamily3 = new FontFamily() { Val = FontFamilyValues.Swiss };
Pitch pitch3 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature3 = new FontSignature() { UnicodeSignature0 = "E0002EFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font3.Append(panose1Number3);
font3.Append(fontCharSet3);
font3.Append(fontFamily3);
font3.Append(pitch3);
font3.Append(fontSignature3);
Font font4 = new Font() { Name = "Calibri Light" };
Panose1Number panose1Number4 = new Panose1Number() { Val = "020F0302020204030204" };
FontCharSet fontCharSet4 = new FontCharSet() { Val = "00" };
FontFamily fontFamily4 = new FontFamily() { Val = FontFamilyValues.Swiss };
Pitch pitch4 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature4 = new FontSignature() { UnicodeSignature0 = "A00002EF", UnicodeSignature1 = "4000207B", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000019F", CodePageSignature1 = "00000000" };
font4.Append(panose1Number4);
font4.Append(fontCharSet4);
font4.Append(fontFamily4);
font4.Append(pitch4);
font4.Append(fontSignature4);
fonts1.Append(font1);
fonts1.Append(font2);
fonts1.Append(font3);
fonts1.Append(font4);
fontTablePart1.Fonts = fonts1;
}
开发者ID:CGHill,项目名称:Hard-To-Find,代码行数:69,代码来源:InvoiceCreator.cs
注:本文中的Pitch类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论