예제 #1
0
    void BindMIDIKey(MidiJack.MidiChannel chan, int note, float velocity)
    {
        var newNote = new MIDINote(chan, note);

        noteToValue[newNote] = velocity;
        // Create ports here
    }
 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
 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
 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
        // 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);
        }
    }