public void AddSample(string sampleKey, string path, double start, double length, double offset, bool loopIndefinitely = true)
        {
            _sampleKeys.Add(sampleKey);

            if (_targetBpm == int.MinValue)
            {
                _targetBpm = BpmHelper.GetBpmFromLoopLength(length);
            }

            AudioPlayer channelPlayer;

            if (_sampleKeys.Count > _channelPlayers.Count)
            {
                channelPlayer = new AudioPlayer();
                _mixer.AddInputChannel(channelPlayer.Output);
                _channelPlayers.Add(channelPlayer);
            }
            else
            {
                channelPlayer = _channelPlayers[_sampleKeys.Count - 1];
            }

            channelPlayer.UnloadAll();
            channelPlayer.Load(sampleKey, path);
            var section = channelPlayer.AddSection(sampleKey,
                                                   sampleKey,
                                                   start,
                                                   length,
                                                   offset,
                                                   calculateBpmFromLength: true,
                                                   targetBpm: _targetBpm);

            section.LoopIndefinitely = loopIndefinitely;
        }
        public ModulePlayer(string libraryFolder = "")
        {
            Output      = new MixerChannel(this);
            _mainPlayer = new AudioPlayer();

            _libraryFolder = libraryFolder;

            Output.AddInputChannel(_mainPlayer.Output);
        }
        public SyncedSamplePlayer(Channel speakerOutput, Channel monitorOutput)
        {
            _mixer = new MixerChannel(this);

            _mainPlayer = new AudioPlayer();
            _mixer.AddInputChannel(_mainPlayer.Output);

            _outputSplitter = new OutputSplitter(_mixer, speakerOutput, monitorOutput);
        }
        private void InitialiseSampler()
        {
            // DebugHelper.WriteLine("InitialiseSampler");

            // create mixer channel
            _samplerMixer = new MixerChannel(this);
            _samplerMixer.SetVolume((decimal)DefaultFadeOutStartVolume);
            _samplerMixer.CutBass();
            _samplerOutputSplitter = new OutputSplitter(_samplerMixer, SpeakerOutput, MonitorOutput);

            _samplePlayer = new TrackSamplePlayer(this);
            _samplerMixer.AddInputChannel(_samplePlayer.Output);

            _samplerMixer.SetVolume(50);

            // DebugHelper.WriteLine("END InitialiseSampler");
        }