HISE Logo Forum
    • Categories
    • Register
    • Login

    Tip: Hardcode Your Dev Environment Audio Setup

    Scheduled Pinned Locked Moved Scripting
    1 Posts 1 Posters 284 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aaronventure
      last edited by

      If you move between setups or experience crashes, you're familiar with HISE's Audio & MIDI Setup page and see it more often than you'd like.

      You can hardcode your setup preferences into a MIDI processor and have it run on every compile. So if you unplug your laptop from the dock and so lose the connection the audio interface and/or MIDI devices, and then come back again, you don't have to go into the HISE preferences every time to set things up.

      // Default HISE Audio Setup
      if (Engine.isHISE() && Engine.isPlugin() == false)
      {
      	// Set Default Audio Device
      	for (x in Settings.getAvailableDeviceNames())
      	{
      		if (x.contains("Babyface Pro") && Settings.getCurrentAudioDevice() != x)
      		{
      			Settings.setAudioDevice(x);
      			Settings.setBufferSize(256);
      			break;
      		}
      	}
      	
      	// Set Default MIDI Device
      	for (x in Settings.getMidiInputDevices())
      	{
      		if (x == "SL STUDIO Port 1") Settings.toggleMidiInput(x, true);
      		if (x == "SL STUDIO Port 2") Settings.toggleMidiInput(x, false);
      	}
      }
      

      This is an example for clarity. It's probably a better idea to write this into a file in JSON, put it somewhere on your computer (probably the HISE folder) and read from that, so that the specific device list isn't something you have to change in your projects.

      You can even put the code in a .js file, store it somewhere you know it'll always be at (probably the gobal script folder) and forget about it.

      With this, you can then create any kind of fallback logic you desire as you move between systems and setups.

      1 Reply Last reply Reply Quote 2
      • A aaronventure referenced this topic on
      • A aaronventure referenced this topic on
      • First post
        Last post

      51

      Online

      1.7k

      Users

      11.7k

      Topics

      102.2k

      Posts