buzz forums

forums of the buzz
It is currently Thu May 24, 2018 5:48 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Oct 22, 2014 5:52 am 

Joined: Wed Nov 23, 2011 12:36 pm
Posts: 336
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 :cry:

GUI basically just a ListBox with SelectionMode = Multiple that updates when machines are added or deleted.

Image


Top
 Profile  
 
PostPosted: Wed Oct 22, 2014 11:03 am 
Site Admin

Joined: Mon Nov 21, 2011 2:04 pm
Posts: 273
There are GUI demos already (qsamo, relativion) but sending midi works like this:

Code:
   [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);
            }
         }

      }

   }


Top
 Profile  
 
PostPosted: Wed Oct 22, 2014 2:58 pm 

Joined: Wed Nov 23, 2011 12:36 pm
Posts: 336
oskari wrote:
There are GUI demos already (qsamo, relativion)

Yes, but you forgot to add Comments for the Retarded (TM).

Quote:
but sending midi works like this:

Thanks for the snippet. I'll keep plodding.


Top
 Profile  
 
PostPosted: Thu Oct 23, 2014 5:31 am 

Joined: Wed Nov 23, 2011 12:36 pm
Posts: 336
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)


Top
 Profile  
 
PostPosted: Thu Oct 23, 2014 12:31 pm 
Site Admin

Joined: Mon Nov 21, 2011 2:04 pm
Posts: 273
Relativion is a native machine, it was before "managed machines". See NTracker for an example of parameters.


Top
 Profile  
 
PostPosted: Thu Oct 23, 2014 1:09 pm 
User avatar

Joined: Mon Nov 21, 2011 7:23 pm
Posts: 288
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:
         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:
      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
Code:
event Action<int> MIDIInput;
which i guess will help the midi side?

will be about the irc channel if you have questions


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group