public void sendMidiCC(int midiChannel, int midiControl, float value)
        {
            if (currentOutputDevice != null)
            {
                Midi.Channel channel = (Midi.Channel)midiChannel;
                Midi.Control control = (Midi.Control)midiControl;

                currentOutputDevice.SendControlChange(channel, control, (int)value * 127);
            }
        }
        public IEnumerator LearnParameterCC(Parameter selectedParameter)
        {
            learning = true;
            while ((int)ccValue == 0)
            {
                yield return(0);
            }
            selectedParameter.CC = (int)ccValue;

            ccValue = 0;

            learning = false;
        }
        public IEnumerator LearnCC(Bus selectedBus)
        {
            learning = true;
            while ((int)ccValue == 0)
            {
                yield return(0);
            }
            selectedBus.CC = (int)ccValue;

            ccValue = 0;

            learning = false;
        }
        private void midiTest(string chstr, string ctrlstr, int value)
        {
            Object    ctrlObj  = new Midi.Control();
            Type      ctrlType = ctrlObj.GetType();
            FieldInfo ctrlFld  = ctrlType.GetField(ctrlstr);

            Midi.Control control = (Midi.Control)ctrlFld.GetValue(ctrlObj);

            Object    chObj   = new Channel();
            Type      chType  = chObj.GetType();
            FieldInfo chFld   = chType.GetField(chstr);
            Channel   channel = (Channel)chFld.GetValue(chObj);

            outputDevice.SendControlChange(channel, control, value);
        }
        public void NoteCC(ControlChangeMessage msg)
        {
            if (Busses.Count > 0)
            {
                for (int i = 0; i < Busses.Count; i++)
                {
                    if (msg.Control == (Midi.Control)Busses[i].CC && !learning)
                    {
                        SendScriptCommand("mixerBusses[" + i + "].volume = " + ConvertRange(0, 127, -80, 10, msg.Value));
                    }

                    if (learning)
                    {
                        ccValue = msg.Control;
                    }
                }
            }

            if (Events.Count > 0)
            {
                for (int i = 0; i < Events[0].ParameterList.Count; i++)
                {
                    if (msg.Control == (Midi.Control)Events[0].ParameterList[i].CC && !learning)
                    {
                        SendScriptCommand("event.setCursorPosition(" + "param" + "[" + i + "], " + ConvertRangeDouble((double)0, (double)127, Events[0].ParameterList[i].MinValue, Events[0].ParameterList[i].MaxValue, (double)msg.Value).ToString(CultureInfo.InvariantCulture) + ")");
                    }

                    if (learning)
                    {
                        ccValue = msg.Control;
                    }
                }

                if (msg.Control == (Midi.Control)RecordCC)
                {
                    SendScriptCommand("if (typeof session === 'undefined') { var currentEvent = studio.window.browserCurrent(); var session = studio.project.create('ProfilerSession'); studio.window.navigateTo(session); session.toggleRecording(); studio.window.navigateTo(currentEvent); } else { if (session.isRecording() == true) { studio.window.navigateTo(session); session.toggleRecording(); studio.project.save(); } var folderName = session.id; console.log(folderName); var fileName = 'capture-0000.wav'; var projectPath = studio.project.filePath; projectPath = projectPath.substr(0, projectPath.lastIndexOf('/')); var filePath = projectPath + '/.user/Profiler/Session/' + folderName + '/' + fileName; console.log(filePath); var newEvent = studio.project.create('Event'); var d = new Date(); newEvent.name = 'Recording' + d.getTime(); var file = studio.system.getFile(filePath); var filePath2 = (projectPath + '/.user/Profiler/Session/' + folderName + '/' + newEvent.name + '.wav').toString(); file.copy(filePath2); var track = newEvent.addGroupTrack(); var sound = track.addSound(newEvent.timeline, 'SingleSound', 0, 10); var asset = studio.project.importAudioFile(filePath2); sound.audioFile = asset; sound.length = asset.length; studio.window.navigateTo(currentEvent); currentEvent.play(); d = undefined; newEvent = undefined; sound = undefined; track = undefined; asset = undefined; currentEvent = undefined; session = undefined; filePath = undefined; folderName = undefined; asset = undefined; file = undefined; filePath2 = undefined; }");
                }
            }
        }
Beispiel #6
0
 public MidiControl(Midi.Control c)
 {
     control = c;
     Name    = Enum.GetName(typeof(Midi.Control), c);
 }