コード例 #1
0
    void BindMIDIKey(MidiJack.MidiChannel chan, int note, float velocity)
    {
        var newNote = new MIDINote(chan, note);

        noteToValue[newNote] = velocity;
        // Create ports here
    }
コード例 #2
0
 private void ProcessMidiNotification(MidiJack.MidiChannel _channel, int _note, float _velocity)
 {
     if (_velocity == 1 || _velocity == 0)
     {
         lastPressedNote = _note;
     }
 }
コード例 #3
0
 void BindMIDIControl(MidiJack.MidiChannel chan, int id, float val)
 {
     channel   = chan;
     controlID = id;
     MidiMaster.knobDelegate -= BindMIDIControl;
     MidiMaster.knobDelegate += ReceiveMIDIMessage;
     binding = false;
     bound   = true;
 }
コード例 #4
0
ファイル: MIDINoteNode.cs プロジェクト: SotSF/canopy-unity
 void BindMIDINote(MidiJack.MidiChannel chan, int note, float velocity)
 {
     channel   = chan;
     this.note = note;
     MidiMaster.noteOnDelegate  -= BindMIDINote;
     MidiMaster.noteOnDelegate  += ReceiveNoteDown;
     MidiMaster.noteOffDelegate += ReceiveNoteUp;
     binding = false;
     bound   = true;
 }
コード例 #5
0
ファイル: TurntableManager.cs プロジェクト: ImRohan7/sono
 void LoadPlayerPrefs()
 {
     if (PlayerPrefs.HasKey(GameResources.crossFadeKnob))
     {
         crossFadeKnob = PlayerPrefs.GetInt(GameResources.crossFadeKnob);
     }
     else
     {
         crossFadeKnob = GameResources.defaultCrossFade;
     }
     if (PlayerPrefs.HasKey(GameResources.leftTurnKnob))
     {
         leftTurnKnob = PlayerPrefs.GetInt(GameResources.leftTurnKnob);
     }
     else
     {
         leftTurnKnob = GameResources.defaultLeftTurn;
     }
     if (PlayerPrefs.HasKey(GameResources.rightTurnKnob))
     {
         rightTurnKnob = PlayerPrefs.GetInt(GameResources.rightTurnKnob);
     }
     else
     {
         rightTurnKnob = GameResources.defaultRightTurn;
     }
     if (PlayerPrefs.HasKey(GameResources.crossFadeChnl))
     {
         //crossFadeChannel = GetChannelByString(PlayerPrefs.GetString(GameResources.crossFadeChnl));
         crossFadeChannel = GameResources.defaultFadeChnl;
     }
     else
     {
         crossFadeChannel = GameResources.defaultFadeChnl;
     }
     if (PlayerPrefs.HasKey(GameResources.leftTurnChnl))
     {
         //leftTurnChannel = GetChannelByString(PlayerPrefs.GetString(GameResources.leftTurnChnl));
         leftTurnChannel = GameResources.defaultLeftChnl;
     }
     else
     {
         leftTurnChannel = GameResources.defaultLeftChnl;
     }
     if (PlayerPrefs.HasKey(GameResources.rightTurnChnl))
     {
         //rightTurnChannel = GetChannelByString(PlayerPrefs.GetString(GameResources.rightTurnChnl));
         rightTurnChannel = GameResources.defaultRightChnl;
     }
     else
     {
         rightTurnChannel = GameResources.defaultRightChnl;
     }
 }
コード例 #6
0
ファイル: TurntableManager.cs プロジェクト: ImRohan7/sono
        // Start is called before the first frame update
        void Start()
        {
            // LoadPlayerPrefs();
            crossFadeKnob    = 7;
            crossFadeChannel = MidiChannel.Ch1;
            leftTurnKnob     = 17;
            leftTurnChannel  = MidiChannel.Ch2;
            rightTurnKnob    = 17;
            rightTurnChannel = MidiChannel.Ch3;

            sliderChannel = MidiChannel.Ch2;
            sliderKnob    = 24;

            currentLeft   = fetchLeftTurntable();
            currentRight  = fetchRightTurntable();
            currentSlider = fetchSlider();
        }
コード例 #7
0
ファイル: Board.cs プロジェクト: afauch/att-hack
    public void Init()
    {
        for (int i = 0; i < 128; i++)
        {
            // Create the gameObject
            GameObject note = new GameObject("n" + _channel + "/" + i);

            // Layout the gameObjects
            switch (_format)
            {
            case Format.Grid:
                note.transform.position = _root.transform.position + new Vector3(i % _spacing, i / _spacing, 0);
                break;

            case Format.Line:
                float offset = (_spacing * i) - ((128 / 2) * _spacing);
                note.transform.position = _root.transform.position + new Vector3(offset, 0, 0);
                break;

            default:
                note.transform.position = Vector3.zero;
                break;
            }

            note.transform.SetParent(_root.transform);

            note.AddComponent <Note> ();
            Note n = note.GetComponent <Note> ();

            n._board          = this;
            n._midiChannelInt = _channel;
            n._note           = i;
            n._gameObject     = note;
            n.InitNote();

            _notes.Add(n);

            // Initialize instantiation parameters
            _instantiationScale = _particlePrefab.transform.localScale;
            Rigidbody r = _particlePrefab.GetComponent <Rigidbody> ();
            _instantiationMass = r.mass;
            _instantiationDrag = r.drag;

            _midiChannel = (MidiChannel)(_channel - 1);
        }
    }