Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ArbitraryGrid"/> with the specified
        /// collection of times.
        /// </summary>
        /// <param name="times">Grid's times.</param>
        /// <exception cref="ArgumentNullException"><paramref name="times"/> is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="times"/> contains null.</exception>
        public ArbitraryGrid(IEnumerable <ITimeSpan> times)
        {
            ThrowIfArgument.IsNull(nameof(times), times);
            ThrowIfArgument.ContainsNull(nameof(times), times);

            Times = times;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChordProgression"/> with the specified chords.
        /// </summary>
        /// <param name="chords">Chords of the chord progression.</param>
        /// <exception cref="ArgumentNullException"><paramref name="chords"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException"><paramref name="chords"/> contains <c>null</c>.</exception>
        public ChordProgression(IEnumerable <Chord> chords)
        {
            ThrowIfArgument.IsNull(nameof(chords), chords);
            ThrowIfArgument.ContainsNull(nameof(chords), chords);

            Chords = chords;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SteppedGrid"/> with the specified
        /// start time and steps so all grid's times will be stepped according to those steps.
        /// </summary>
        /// <remarks>
        /// Grid's times will be distributed according to provided steps. So distance between first
        /// adjacent times will be equal to first step, distance between second adjacent times will
        /// be equal to second step and so on. When last step reached steps will go from the first one.
        /// </remarks>
        /// <param name="start">Start time of the grid.</param>
        /// <param name="steps">Collection of grid's steps.</param>
        /// <exception cref="ArgumentNullException"><paramref name="start"/> is null. -or-
        /// <paramref name="steps"/> is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="steps"/> contains null.</exception>
        public SteppedGrid(ITimeSpan start, IEnumerable <ITimeSpan> steps)
        {
            ThrowIfArgument.IsNull(nameof(start), start);
            ThrowIfArgument.IsNull(nameof(steps), steps);
            ThrowIfArgument.ContainsNull(nameof(steps), steps);

            Start = start;
            Steps = steps;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DevicesConnector"/> with the specified
        /// input and output MIDI devices.
        /// </summary>
        /// <remarks>
        /// <paramref name="inputDevice"/> will not be actually connected to <paramref name="outputDevices"/> after
        /// an instance of <see cref="DevicesConnector"/> is created. You must call <see cref="Connect"/> method
        /// to establish connection between devices.
        /// </remarks>
        /// <param name="inputDevice">Input MIDI device to connect to <paramref name="outputDevices"/>.</param>
        /// <param name="outputDevices">Output MIDI devices to connect <paramref name="inputDevice"/> to.</param>
        /// <exception cref="ArgumentNullException"><paramref name="inputDevice"/> is null. -or-
        /// <paramref name="outputDevices"/> is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="outputDevices"/> contains null.</exception>
        public DevicesConnector(InputDevice inputDevice, params OutputDevice[] outputDevices)
        {
            ThrowIfArgument.IsNull(nameof(inputDevice), inputDevice);
            ThrowIfArgument.IsNull(nameof(outputDevices), outputDevices);
            ThrowIfArgument.ContainsNull(nameof(outputDevices), outputDevices);

            InputDevice   = inputDevice;
            OutputDevices = outputDevices;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Connects an input device to the specified output device.
        /// </summary>
        /// <param name="inputDevice">Input MIDI device to connect to <paramref name="outputDevices"/>.</param>
        /// <param name="outputDevices">Output MIDI devices to connect <paramref name="inputDevice"/> to.</param>
        /// <exception cref="ArgumentNullException">
        /// <para>One of the following errors occured:</para>
        /// <list type="bullet">
        /// <item>
        /// <description><paramref name="inputDevice"/> is <c>null</c>.</description>
        /// </item>
        /// <item>
        /// <description><paramref name="outputDevices"/> is <c>null</c>.</description>
        /// </item>
        /// </list>
        /// </exception>
        /// <exception cref="ArgumentException"><paramref name="outputDevices"/> contains <c>null</c>.</exception>
        public static DevicesConnector Connect(this IInputDevice inputDevice, params IOutputDevice[] outputDevices)
        {
            ThrowIfArgument.IsNull(nameof(inputDevice), inputDevice);
            ThrowIfArgument.IsNull(nameof(outputDevices), outputDevices);
            ThrowIfArgument.ContainsNull(nameof(outputDevices), outputDevices);

            var devicesConnector = new DevicesConnector(inputDevice, outputDevices);

            devicesConnector.Connect();
            return(devicesConnector);
        }