This project has moved. For the latest updates, please go here.

MidiProcessor : Process not being called in Sonar

Topics: Host Compatibility, Midi
May 12 at 12:24 AM
Hi folks,

I was looking at my stream and I asked a similar question in 2012 - 5 years and I'm still feeling like a noob :)

I have some working plugins now - a synth that plays SF2's and W30 / S50 roland samples. And a second one for programming my old Roland JV1010. This works fine with VSTHost, Ableton, FLStudio, Bitwig etc but for some reason the Process Midi function is not being called regularly. It is called when I arm the track or stop record but at no other time. I have a dummy AudioProcessor - setting this to Null crashes the DAW !

I've hammered a highly simplified version of the code to debug - I wonder if anyone can spot anything obvious ?

I've tried it with and without a MidiSource, and with various Category settings (not sure this is more than just a hint to the host?)

I haven't tried rewiring another DAW into Sonar as a container to see if this still happens ..... I'll also go hunting on Cakewalks site.

Kind regards

Adrian Maurice Croft
namespace TestPlugin
{
    public class Plugin : VstPluginWithInterfaceManagerBase, IVstPluginMidiSource
    {
        #region "Fields"

        internal VstPluginInfo PluginInfo
        {
            get;
            private set;
        }

        internal void SetPluginInfo(VstPluginInfo pluginInfo)
        {
            PluginInfo = pluginInfo;
        }

        #endregion

        #region "Properties"

        public int ChannelCount
        {
            get
            {
                return 16;
            }
        }

        public PluginPrograms PluginPrograms
        {
            get
            {
                return GetInstance<PluginPrograms>();
            }
        }

        #endregion

        public Plugin()
            : base(Constant.PluginName,
            new VstProductInfo
                (
                    Constant.ProductName, 
                    Constant.VendorName, 
                    Constant.PluginVersion
                ),
                VstPluginCategory.Synth,
                VstPluginCapabilities.None,
                0,
                Constant.UniquePluginId)
        {
            DebuggingHelper.IsDebugging = true;
        }

        public override void Open(IVstHost host)
        {
            base.Open(host);
        }

        protected override IVstPluginAudioProcessor CreateAudioProcessor(IVstPluginAudioProcessor instance)
        {
            if (instance == null)
            {
                return new AudioProcessor(this);
            }

            return instance;
        }

        protected override IVstMidiProcessor CreateMidiProcessor(IVstMidiProcessor instance)
        {
            if (instance == null)
            {
                return new MidiProcessor(this);
            }

            return instance;
        }

        protected override IVstPluginPrograms CreatePrograms(IVstPluginPrograms instance)
        {
            if (instance == null)
            {
                return new PluginPrograms(this);
            }

            return base.CreatePrograms(instance);
        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }

        protected override IVstPluginMidiSource CreateMidiSource(IVstPluginMidiSource instance)
        {
            return this;
        }
    }
}

namespace TestPlugin
{
    class AudioProcessor : VstPluginAudioProcessorBase
    {
        private Plugin _plugin;
        private MidiProcessor _midiProcessor;

        public AudioProcessor(Plugin plugin)
            : base(Constant.AudioInputCount, Constant.AudioOutputCount, Constant.InitialTailSize)
        {
            _plugin = plugin;

            _midiProcessor = plugin.GetInstance<MidiProcessor>();
        }

        public override void Process(VstAudioBuffer[] inChannels, VstAudioBuffer[] outChannels)
        {
            base.Process(inChannels, outChannels);
        }
    }
}

namespace TestPlugin
{
    public class MidiProcessor : IVstMidiProcessor
    {
        private Plugin _plugin;

        public MidiProcessor(Plugin plugin)
        {
            _plugin = plugin;
        }

        public int ChannelCount
        {
            get { return 16; }
        }

        public void Process(VstEventCollection events)
        {
            DebuggingHelper.Append("MidiProcessor:Process=" + events.Count.ToString());
        }
    }
}
May 12 at 4:05 PM
Holy smoke, Sonar isn't seeing it as a Midi 'receiver' = that's what the problem is...