コード例 #1
0
ファイル: KnackFile.cs プロジェクト: sanyaade-g2g-repos/knack
			public SoundBlockData(SoundBlock soundBlock, int x, int y)
			{
				this.MidiInputs = new ArrayList(1);
				this.SoundInputs = new ArrayList(2);
				this.SoundBlock = soundBlock;
				this.X = x;
				this.Y = y;
			}
コード例 #2
0
ファイル: KnackFile.cs プロジェクト: sanyaade-g2g-repos/knack
		public void Add(SoundBlock soundBlock, int x, int y)
		{
			Add(new SoundBlockData(soundBlock,x,y));
		}
コード例 #3
0
ファイル: SoundItem.cs プロジェクト: sanyaade-g2g-repos/knack
		public SoundItem(SoundItemTree soundItemTree, SoundBlock soundOrMidiRender, int soundInputs, int soundOutputs, int midiInputs, int midiOutputs) : base() 
		{ 
			this.soundBlock = soundOrMidiRender;
			if (soundOrMidiRender is ISoundRender) 
				this.soundRender = (ISoundRender) soundOrMidiRender;
			if (soundOrMidiRender is IMidiRender) 
				this.midiRender = (IMidiRender) soundOrMidiRender;
			this.soundItemTree = soundItemTree;
			this.soundInputs = soundInputs;
			this.soundOutputs = soundOutputs;
			this.midiInputs = midiInputs;
			this.midiOutputs = midiOutputs;		
			this.Size = new System.Drawing.Size(64, 64);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint |
			              ControlStyles.UserPaint |
			              ControlStyles.DoubleBuffer,true);
			this.unselectedBackground = ((System.Drawing.Image)(soundItemTree.Resources.GetObject("unsel-block")));
			this.selectedBackground = ((System.Drawing.Image)(soundItemTree.Resources.GetObject("sel-block")));
			this.nameFont = new System.Drawing.Font(new System.Drawing.FontFamily("Arial"),
			                                                   9,
			                                                   System.Drawing.FontStyle.Regular,
			                                                   System.Drawing.GraphicsUnit.Pixel);
			this.nameFontBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
			
			ContextMenu BlockContextMenu = new ContextMenu();
			this.ContextMenu = BlockContextMenu;
			
			if ((this.soundRender != null) && (this.soundRender.Editable)) {
				MenuItem EditMenuItem = new MenuItem();
				EditMenuItem.Index = 0;
				EditMenuItem.Text = "Edit block";
				EditMenuItem.Click += new System.EventHandler(this.EditBlockClick);
				EditMenuItem.DefaultItem = true;
				BlockContextMenu.MenuItems.Add(EditMenuItem);
				this.DoubleClick += new EventHandler(EditBlockClick);
			}
			MenuItem DeleteMenuItem = new MenuItem();
			DeleteMenuItem.Index = 1;
			DeleteMenuItem.Text = "Delete block";
			DeleteMenuItem.Click += new System.EventHandler(this.DeleteBlockClick);
			BlockContextMenu.MenuItems.Add(DeleteMenuItem);		
			
			soundItemLinkSoundInput = new SoundItemLink[soundInputs];
			soundItemLinkSoundOutput = new SoundItemLink[soundOutputs];
			soundItemLinkMidiInput = new SoundItemLink[midiInputs];
			soundItemLinkMidiOutput = new SoundItemLink[midiOutputs];
			
			for (int i=0; i<soundInputs;i++) {
				soundItemLinkSoundInput[i] = new SoundItemLink(this,i,SoundItemLink.SoundItemLinkType.SoundInput);
				this.Controls.Add(soundItemLinkSoundInput[i]);
			}
			for (int i=0; i<soundOutputs;i++) {
				soundItemLinkSoundOutput[i] = new SoundItemLink(this,i,SoundItemLink.SoundItemLinkType.SoundOutput);
				this.Controls.Add(soundItemLinkSoundOutput[i]);
			}
			for (int i=0; i<midiInputs;i++) {
				soundItemLinkMidiInput[i] = new SoundItemLink(this,i,SoundItemLink.SoundItemLinkType.MidiInput);
				this.Controls.Add(soundItemLinkMidiInput[i]);
			}
			for (int i=0; i<midiOutputs;i++) {
				soundItemLinkMidiOutput[i] = new SoundItemLink(this,i,SoundItemLink.SoundItemLinkType.MidiOutput);
				this.Controls.Add(soundItemLinkMidiOutput[i]);
			}
		}
コード例 #4
0
ファイル: SoundItem.cs プロジェクト: sanyaade-g2g-repos/knack
		public new void Dispose()
   		{
			foreach (SoundItemLink sil in this.SoundItemLinks) this.SoundItemTree.Unlink(sil);
			this.soundItemTree.SoundItems.Remove(this);
			//Console.WriteLine("Disposing a SoundItem");
			if (soundBlock is IDisposable) {
				IDisposable sb = (IDisposable) soundBlock;
				//Console.WriteLine("Disposing a SoundBlock");
				sb.Dispose();
			}
			soundBlock = null;
			soundRender = null;
			midiRender = null;
			base.Dispose();
		}
コード例 #5
0
		public void Unlink(SoundBlock soundBlock)
		{
			foreach (SoundItem sItem in soundItems) {
				foreach (SoundItemLink sLink in sItem.SoundItemLinks) {
					if (sLink.Linked && (sLink.Type == SoundItemLink.SoundItemLinkType.MidiInput)){
						if (sLink.LinkedSoundItemLink.SoundItem.SoundBlock == soundBlock) {
							//MessageBox.Show(sLink.SoundItem.Name);
							Unlink(sLink);
						}
					}
				}
			}
		}
コード例 #6
0
ファイル: KnackForm.cs プロジェクト: sanyaade-g2g-repos/knack
		void NewSoundItem(SoundBlock sb, System.Drawing.Point location) {
			int numSoundOutputs = (sb is ISoundRender) ? 1 : 0;
			int numMidiOutputs = (sb is IMidiRender) ? 1 : 0;
			if (sb is SoundOutRender) numSoundOutputs = 0;
			SoundItem sItem = new SoundItem(sItemTree,sb,sb.SoundInputs.Length,numSoundOutputs,sb.MidiInputs.Length,numMidiOutputs);
			sItem.Location = location;
			sItemTree.AddSoundItem(sItem);
		}