Exemple #1
0
        public PadControl(string audiodevice, float volume, string audioFilePath, int midiNote, MidiController?volumeSilderContr)
        {
            InitializeComponent();

            int audiodeviceID    = -1;
            int callbackdeviceID = -1;

            for (int i = 0; i < WaveOut.DeviceCount; i++)
            {
                if (WaveOut.GetCapabilities(i).ProductName == audiodevice)
                {
                    audiodeviceID = i;
                }
                if (WaveOut.GetCapabilities(i).ProductName == ApplicationSettings.CallbackDeviceID)
                {
                    callbackdeviceID = i;
                }
            }

            _player = new AudioPlayer("", callbackdeviceID);
            _player.OnSoundStateChange += _player_OnSoundStateChange;
            _player.OnAudioTrackChange += _player_OnAudioTrackChange;

            _player.ChangeAudioDevice(audiodeviceID);
            _player.ChangeAudioTrack(audioFilePath);
            ChangeVolume(Convert.ToInt32(volume * 100), false);

            this._pushButtonMidiNote = midiNote;
            if (this._pushButtonMidiNote != -1)
            {
                GlobalStaticContext.RegisterPadWithMidiNote(this, midiNote);
            }

            if (volumeSilderContr.HasValue)
            {
                this._volumeSliderMidiController = volumeSilderContr.Value;
                GlobalStaticContext.RegisterPadWithMidiController(this, volumeSilderContr.Value);
            }
        }
Exemple #2
0
 public void ChangeAudioTrack(string audioPathFile)
 {
     _player.ChangeAudioTrack(audioPathFile);
 }