Results 1 to 6 of 6

Thread: Programming Vixen

  1. #1
    Join Date
    Jun 2007
    Posts
    56
    Post Thanks / Like

    Default Programming Vixen

    Wow! - Thanks for this KC!

    My 1st programming question is this:

    I've implemented the ITriggerPlugin interface as below, but how does it send the 'trigger' event? Also, what do some of the things below do (InterfaceTypeName, DataLocationPreference, TriggerCount).

    Code:
    using System;
    using Vixen;
    using System.Windows.Forms;
    
    namespace MyTrigger
    {
    	public class Class1 : Vixen.ITriggerPlugin
    	{
    		public string InterfaceTypeName {
    			get {
    				return "Test";
    			}
    		}
    		
    		public int TriggerCount {
    			get {
    				return 1;
    			}
    		}
    		
    		public Vixen.LoadableDataLocation DataLocationPreference {
    			get {
    				return Vixen.LoadableDataLocation.Application;
    			}
    		}
    		
    		public string Name {
    			get {
    				return "Test Trigger";
    			}
    		}
    		
    		public string Author {
    			get {
    				return "Peter Ward";
    			}
    		}
    		
    		public string Description {
    			get {
    				return "A test trigger plugin.";
    			}
    		}
    		
    		public void Setup()
    		{
    			MessageBox.Show("Setup");
    		}
    		
    		public void Loading(System.Xml.XmlNode dataNode)
    		{
    			MessageBox.Show("Loading");
    		}
    		
    		public void Unloading()
    		{
    			MessageBox.Show("Unloading");
    		}
    		
    	}
    }
    flowblok

  2. #2
    Join Date
    May 2007
    Location
    Spokane, WA, USA
    Posts
    685
    Post Thanks / Like

    Default

    I really need to start documenting things soon. You wasted no time.

    In the Vixen.exe assembly, there's a class called Interfaces with a hash member called Available. What you need is the ITrigger interface:

    Code:
    Vixen.ITrigger m_triggerInterface;
    m_triggerInterface = (Vixen.ITrigger)Vixen.Interfaces.Available["ITrigger"];
    In there, you will find a method for activating a trigger.

    InterfaceTypeName: It was originally intended to be something like "Parallel" to describe what kind of trigger you were implementing. It's now any string you want to use to describe the trigger to the user. They will see this when they go to select a trigger to respond to.

    TriggerCount: How many triggers you're implementing in your plugin. The user will be faced with trigger names provided by InterfaceTypeName and how many lines each provides. So if your plugin implements triggers as 8 input lines from the parallel port, then maybe InterfaceTypeName is "Parallel" or "Flowblok's Trigger Heaven" and LineCount would be 8.

    DataLocationPreference: Some things are best stored with the sequence (Watt Meter add-in data) while others are best to have application-wide (Remote Client add-in). Now you get to decide where your data is stored. Or, if you want, skip that altogether and maintain your own data storage elsewhere.

  3. #3
    Join Date
    Jun 2007
    Posts
    56
    Post Thanks / Like

    Default

    Thank you for taking the time to do this, but I'm still not quite getting it. :?

    Does the code you posted go into the class definition, the loading method, or where?

    Could you make me a template file to explain it?

  4. #4
    Join Date
    May 2007
    Location
    Spokane, WA, USA
    Posts
    685
    Post Thanks / Like

    Default

    KiwiChristmas successfully built a trigger plugin and created a shell project as his own version of a how-to, which I'll attach. (Sorry, Kiwi...I know you wanted me to take a peek at it first, but I'm going to trust you since your code works)

    Sorry, that code would go into the Loading() method. Loading() is your chance to get everything ready, including spawning any threads or timers you may need for port polling or whatnot. Unloading(), of course, is your chance to clean up. Keep in mind that both will be called either at app startup (if it was previously loaded at shutdown) or when the user selects it from the menu and it was not previously loaded.

    Continue to post if you still have unanswered questions. I've been staring at the ridiculous code for so long, I forget that I'm the only one that has.
    Attached Files Attached Files

  5. #5
    Join Date
    Jun 2007
    Posts
    56
    Post Thanks / Like

    Default

    Thanks all - I've now finished a parallel port trigger.

    wjohn originally requested it, and I've adopted it as a little challenge.

    Attached is the source code in a zip file + the ParallelTrigger.dll for the Vixen/Plugins/Trigger/ directory.

    Usage: Load up vixen, click Triggers->Parallel Trigger.
    Select your parallel port (you should know this, it's from the device manager) - note that it's +1, because we're dealing with the status registers, not the data registers.
    Select the status pins you want to use.
    Press OK.

    Load up a trigger response (or create new).
    Press the uber-cool '+' icon.
    Select trigger type "ParallelTrigger.ParallelTrigger".
    The line is the same as the pin you're using - if you use multiple, you need to create multiple responses.
    Select sequence + audio device.
    Press OK.
    Press the play icon.
    Connect up the status pin to a ground pin (toggle it on).
    Your sequence should start playing.

    This has been tested on a Intel P4 2.64 GHz, with a 25-pin parallel port on port 0x378. Let me know if you have any problems.
    Attached Files Attached Files

  6. #6
    Join Date
    Jun 2007
    Posts
    56
    Post Thanks / Like

    Default

    And slightly modified, one which runs a network server on the specified port, and then when a character is sent to it, it fires off the trigger associated with the ascii code. In the 'line' trigger conf., that's the ascii code which you want to monitor.

    The server will run from when you enable the trigger plugin to when you disable it. Also, you can change the port it's running on whenever you like.
    Attached Files Attached Files

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •