my script is sending a continuous cc value of 254 0 0 fe 00 00

KVRist
477 posts since 29 Mar, 2016

Post Tue May 04, 2021 12:29 pm

HI can anyone please help me figure out why my script is doing this?
----
Is there something wrong with my script?

Code: Select all

loadAPI(2);
host.setShouldFailOnDeprecatedUse(true);

host.defineController("Yamaha", "Montage", "1.0", "035d4fe0-1a0f-11ea-aaef-0800200c9a66");
host.defineMidiPorts(1, 1);
host.setShouldFailOnDeprecatedUse(true);

var LOWEST_CC = 1;
var HIGHEST_CC = 119;

var DEVICE_START_CC = 20;
var DEVICE_END_CC = 27;

function init()
{
  midiIn = host.getMidiInPort(0);
  midiIn.setMidiCallback(onMidi);
  midiIn.setSysexCallback(onSysex);
  allChannels = midiIn.createNoteInput("All Channels", "??????");
  allChannels.setShouldConsumeEvents(false);

  for (var i = 0; i < 16; i++)
  {
      midiIn.createNoteInput("Channel " + (i + 1), "?" + i.toString(16) + "????");
  }

  transport = host.createTransport();

                // Map CC 20 - 28 to device parameters

                cursorTrack = host.createCursorTrack(3, 0);
                cursorDevice = cursorTrack.createCursorDevice();
                remoteControls = cursorDevice.createCursorRemoteControlsPage(8);

                for ( var i = 0; i < 8; i++)
                {
                                var p = remoteControls.getParameter(i).getAmount();
                                p.setIndication(true);
                                p.setLabel("P" + (i + 1));
                }

                // Make the rest freely mappable
                userControls = host.createUserControls(HIGHEST_CC - LOWEST_CC + 1 - 8);

                for ( var i = LOWEST_CC; i < HIGHEST_CC; i++)
                {
                                if (!isInDeviceParametersRange(i))
                                {
                                                var index = userIndexFromCC(i);
                                                userControls.getControl(index).setLabel("CC" + i);
                                }
                }
}

function isInDeviceParametersRange(cc)
{
                return cc >= DEVICE_START_CC && cc <= DEVICE_END_CC;
}

function userIndexFromCC(cc)
{
                if (cc > DEVICE_END_CC)
                {
                                return cc - LOWEST_CC - 8;
                }

                return cc - LOWEST_CC;
}

function onMidi(status, data1, data2)
{
                if (isChannelController(status))
                {
                                if (isInDeviceParametersRange(data1))
                                {
                                                var index = data1 - DEVICE_START_CC;
                                                remoteControls.getParameter(index).getAmount().value().set(data2, 128);
                                }
                                else if (data1 >= LOWEST_CC && data1 <= HIGHEST_CC)
                                {
                                                var index = userIndexFromCC(data1);
                                                userControls.getControl(index).value().set(data2, 128);
                                }
                }
                printMidi(status, data1, data2);
}

function onSysex(data) {
   // MMC Transport Controls:
   switch (data) {
      case "f07f7f0605f7":
         transport.rewind();
         break;
      case "f07f7f0604f7":
         transport.fastForward();
         break;
      case "f07f7f0601f7":
         transport.stop();
         break;
      case "f07f7f0602f7":
         transport.play();
         break;
      case "f07f7f0606f7":
         transport.record();
         break;
   }
}


function exit()
{
}
Last edited by melodyz on Wed May 05, 2021 2:57 am, edited 1 time in total.

KVRian
589 posts since 17 Jan, 2005 from London

Post Tue May 04, 2021 4:01 pm

Code: Select all

loadAPI(2);
host.setShouldFailOnDeprecatedUse(true);

host.defineController("Yamaha", "Montage", "1.0", "035d4fe0-1a0f-11ea-aaef-0800200c9a66");
host.defineMidiPorts(1, 1);
host.setShouldFailOnDeprecatedUse(true);

var LOWEST_CC = 1;
var HIGHEST_CC = 119;

var DEVICE_START_CC = 20;
var DEVICE_END_CC = 27;

function init()
{
  midiIn = host.getMidiInPort(0);
  midiIn.setMidiCallback(onMidi);
  midiIn.setSysexCallback(onSysex);
  allChannels = midiIn.createNoteInput("All Channels", "??????");
  allChannels.setShouldConsumeEvents(false);

  for (var i = 0; i < 16; i++)
  {
      midiIn.createNoteInput("Channel " + (i + 1), "?" + i.toString(16) + "????");
  }

  transport = host.createTransport();

                // Map CC 20 - 28 to device parameters

                cursorTrack = host.createCursorTrack(3, 0);
                cursorDevice = cursorTrack.createCursorDevice();
                remoteControls = cursorDevice.createCursorRemoteControlsPage(8);

                for ( var i = 0; i < 8; i++)
                {
                                var p = remoteControls.getParameter(i).getAmount();
                                p.setIndication(true);
                                p.setLabel("P" + (i + 1));
                }

                // Make the rest freely mappable
                userControls = host.createUserControls(HIGHEST_CC - LOWEST_CC + 1 -8);

                for ( var i = LOWEST_CC; i < HIGHEST_CC; i++)
                {
                                if (!isInDeviceParametersRange(i))
                                {
                                                var index = userIndexFromCC(i);
                                                userControls.getControl(index).setLabel("CC" + i);
                                }
                }
}

function isInDeviceParametersRange(cc)
{
                return cc >= DEVICE_START_CC && cc <= DEVICE_END_CC;
}

function userIndexFromCC(cc)
{
                if (cc > DEVICE_END_CC)
                {
                                return cc - LOWEST_CC - 8;
                }

                return cc - LOWEST_CC;
}

function onMidi(status, data1, data2)
{
                if (isChannelController(status))
                {
                                if (isInDeviceParametersRange(data1))
                                {
                                                var index = data1 - DEVICE_START_CC;
                                                remoteControls.getParameter(index).getAmount().value().set(data2, 128);
                                }
                                else if (data1 >= LOWEST_CC && data1 <= HIGHEST_CC)
                                {
                                                var index = userIndexFromCC(data1);
                                                userControls.getControl(index).value().set(data2, 128);
                                }
                }
                printMidi(status, data1, data2);
}

function onSysex(data) {
   // MMC Transport Controls:
   switch (data) {
      case "f07f7f0605f7":
         transport.rewind();
         break;
      case "f07f7f0604f7":
         transport.fastForward();
         break;
      case "f07f7f0601f7":
         transport.stop();
         break;
      case "f07f7f0602f7":
         transport.play();
         break;
      case "f07f7f0606f7":
         transport.record();
         break;
   }
}

function exit()
{
}

KVRist

Topic Starter

477 posts since 29 Mar, 2016

Post Fri May 07, 2021 2:03 am

anyone have any idea? Heres the message in the controller script debugger. It just keeps repeating it no matter what project I load.
You do not have the required permissions to view the files attached to this post.

User avatar
KVRian
918 posts since 26 Oct, 2005 from Canada City

Post Fri May 07, 2021 4:27 am

0xFE status byte is active sense. This is almost certainly coming from your MIDI device. You can read up on it in the MIDI spec or just search online.

KVRist

Topic Starter

477 posts since 29 Mar, 2016

Post Fri May 07, 2021 4:48 pm

Thanks I looked in the manual and nothing is there about a 254 value

Return to “Controller Scripting”