# This config file demonstrates the usage of mixers.
# First, two mixers are defined:
#
# - mixer1: sends the mixed stream to Icecast and saves it to a file
# - mixer2: sends the mixed stream to Icecast
#
# Two dongles are used, both in AM, multichannel mode:
#
# - dongle 1: 3 channels:
#   - channel 1 goes to mixer1 (center, volume decreased to 30%)
#   - channel 2 goes to mixer1 (full left)
#   - channel 3 goes to mixer2 (85% right)
#
# - dongle 2: 2 channels:
#   - channel 1 goes to mixer1 (full right)
#   - channel 2 goes to mixer2 (85% left, volume set to 200%)
#
# Refer to https://github.com/charlie-foxtrot/RTLSDR-Airband/wiki
# for description of keywords and config syntax.
mixers: {
  mixer1: {
    outputs: (
        {
          type = "icecast";
          server = "icecast.server.example.org";
          port = 8080;
          mountpoint = "mixer1.mp3";
          name = "VOLMET + Approach + Director"
          genre = "ATC";
          username = "source";
          password = "mypassword";
        },
        {
          type = "file";
          directory = "/home/pi/recordings";
          filename_template = "mixer1";
        }
    );
  },
  mixer2: {
    outputs: (
        {
          type = "icecast";
          server = "icecast.server.example.org";
          port = 8080;
          mountpoint = "mixer2.mp3";
          name = "Ground + Delivery"
          genre = "ATC";
          username = "source";
          password = "mypassword";
        }
    );
  }
};

devices:
({
  type = "rtlsdr";
  index = 0;
  gain = 25;
  centerfreq = 121.2;
  correction = 81;
  channels:
  (
# VOLMET
    {
      freq = 120.875;
# VOLMET/ATIS/AWOS channels often transmit continuously.
# Auto squelch does not perform well in such cases, so it's best to set the
# squelch threshold manually. squelch_threshold defines an absolute signal
# level (in dBFS).
      squelch_threshold = -40;
      lowpass = 5;
      highpass = 5;
      outputs: (
        {
          type = "mixer";
          name = "mixer1";
          ampfactor = 0.3;
        }
      );
    },
# Approach
    {
      freq = 121.8;
      outputs: (
        {
          type = "mixer";
          name = "mixer1";
          balance = -1.0;
        }
      );
    },
# Director
    {
      freq = 121.925;
      outputs: (
        {
          type = "mixer";
          name = "mixer2";
          balance = 0.85;
        }
      );
    }
  );
 },
 {
  type = "rtlsdr";
  index = 1;
  gain = 33;
  centerfreq = 131.2;
  correction = 48;
  channels:
  (
# Ground
    {
      freq = 130.925;
# Another way of tweaking the squelch is to specify custom SNR threshold (in dB)
      squelch_snr_threshold = 5.0;
      outputs: (
        {
          type = "mixer";
          name = "mixer1";
          balance = 1.0;
        }
      );
    },
# Delivery
    {
      freq = 131.4;
      outputs: (
        {
          type = "mixer";
          name = "mixer2";
          balance = -0.85;
          ampfactor = 2.0;
        }
      );
    }
  );
 }
);
