Page 1 of 1
Example project for a simple C#/XAML machine (non-DSP)?
Posted: Wed Oct 22, 2014 5:52 am
by snowglobe
Would one of you code maestros be willing to put together a Visual Studio project for a machine that just sends MIDI to selected targets based on MIDI in events and pattern data? I'm studying BuzzGUI sources, but it has been really slow-going
GUI basically just a ListBox with SelectionMode = Multiple that updates when machines are added or deleted.

Re: Example project for a simple C#/XAML machine (non-DSP)?
Posted: Wed Oct 22, 2014 11:03 am
by oskari
There are GUI demos already (qsamo, relativion) but sending midi works like this:
Code: Select all
[MachineDecl(Name = "Jeskola MidiTest", ShortName = "MidiTest", Author = "Oskari Tammelin")]
public class MidiTestMachine : IBuzzMachine
{
IBuzzMachineHost host;
List<IMachine> targets = new List<IMachine>();
public MidiTestMachine(IBuzzMachineHost host)
{
this.host = host;
lock (targets) targets.Add(Global.Buzz.Song.Machines.FirstOrDefault(m => m.Name == "Qsamo"));
}
[ParameterDecl(DefValue = false)]
public bool Enabled { get; set; }
public void Work()
{
if (!Enabled) return;
if (host.MasterInfo.PosInTick == 0)
{
IMachine[] threadsafeTargets;
lock (targets) threadsafeTargets = targets.ToArray();
foreach (var t in threadsafeTargets)
{
if (t != null) t.SendMIDINote(0, 60, 100);
}
}
}
}
Re: Example project for a simple C#/XAML machine (non-DSP)?
Posted: Wed Oct 22, 2014 2:58 pm
by snowglobe
oskari wrote:There are GUI demos already (qsamo, relativion)
Yes, but you forgot to add Comments for the Retarded (TM).
but sending midi works like this:
Thanks for the snippet. I'll keep plodding.
Re: Example project for a simple C#/XAML machine (non-DSP)?
Posted: Thu Oct 23, 2014 5:31 am
by snowglobe
I'm feeling so out of my depth here, y'all ...
Going to try some baby-steps questions about Relativion.
First one: Where/how do the pattern params - Root Note, Lowest Note, Highest Note, etc. - get defined? (I see that Note Matrix gets its dummy param from NoteMatrixMachine.cs, but Relativion's params seem to show up magically)
Re: Example project for a simple C#/XAML machine (non-DSP)?
Posted: Thu Oct 23, 2014 12:31 pm
by oskari
Relativion is a native machine, it was before "managed machines". See NTracker for an example of parameters.
Re: Example project for a simple C#/XAML machine (non-DSP)?
Posted: Thu Oct 23, 2014 1:09 pm
by mantratronic
hey,
i've done something similar to the list of machines idea.
https://dl.dropboxusercontent.com/u/123 ... getgui.rar is the .cs and xaml for a picker window that gets the machine and parameter list from buzz and let you choose a machine/parameter pair. im told the way i do gui coding is an offense to humanity (not really, just very wrong) so i would ignore that bit and look at the fillTreeList function which fills up a gui class with the data.
Code: Select all
foreach (IMachine m in BuzzGUI.Common.Global.Buzz.Song.Machines)
runs a loop for each machine in the song. maybe check they are a gen and have the midi params you want then add them to the class you are using to display them.
I havent used an auto update for this (ie you would need to open the window again if a machine got added), but you can listen to
Code: Select all
event Action<IMachine> MachineAdded;
event Action<IMachine> MachineRemoved;
from BuzzGUI.Common.Global.Buzz.Song and rebuild the list when they trigger
in IBuzz you can also find
which i guess will help the midi side?
will be about the irc channel if you have questions