protected override void ButtonPush()
 {
     AudioManager.GetInstance().PlaySoundAtPosition(buttonClickSound, transform);
     PlayEvent?.Invoke();
     ClearRemaingObjects();
     SetPlayState(true);
 }
示例#2
0
        /// <summary>
        /// Playing the audio (Check if initialized & paused)
        /// </summary>
        /// <param name="file"></param>
        /// <param name="volume"></param>
        public void Play(string file, int volume)
        {
            PlayEvent?.Invoke(null, file);

            if (Bass.BASS_ChannelIsActive(Stream) != BASSActive.BASS_ACTIVE_PAUSED)
            {
                Stop(); //Stopping existing stream
                if (InitBass(HZ))
                {
                    Stream = Bass.BASS_StreamCreateFile(file, 0, 0, BASSFlag.BASS_DEFAULT); //Loading in audio file into stream
                    if (Stream != 0)
                    {
                        Volume = volume;
                        Bass.BASS_ChannelSetAttribute(Stream, BASSAttribute.BASS_ATTRIB_VOL, Volume / 100F); //Initializing channel volume attribute
                        Bass.BASS_ChannelPlay(Stream, false);                                                //Start playing the stream
                    }
                }
            }
            else
            {
                Bass.BASS_ChannelPlay(Stream, false);
            }
            EqEnable(_eqEnabled); // Enabling EQ based on _eqEnabled state
            activeState = PlayerState.Playing;
        }
示例#3
0
    /// <summary>
    /// Play at specified time.
    /// </summary>
    public void Play(float time = -1)
    {
        //if( _sequencers == null ){
        if (_multiSequencer == null)
        {
            Debug.LogWarning("Can't play, you need to load a file first.\n");
            return;
        }

        if (time != -1)
        {
            _time = time;
        }

        // Fire note off messages.
        for (int ch = 0; ch < 16; ch++)
        {
            for (int k = 0; k < 128; k++)
            {
                if (_onMemo[ch, k])
                {
                    _onNoteOffEvent.Invoke(ch, (byte)k);
                    _onMemo[ch, k] = false;
                }
            }
        }

        _isPlaying = true;
        List <MidiEvent> events = _multiSequencer.Start(_time);

        if (_time == 0)
        {
            DispatchEvents(events);
        }

        _onPlayEvent.Invoke();
    }
示例#4
0
 public void ActionPlay()
 {
     PlayEvent?.Invoke();
 }
示例#5
0
 public void RaisePlayEvent(object sender, System.Windows.RoutedEventArgs e)
 {
     // Your logic
     PlayEvent?.Invoke();
 }
示例#6
0
 public void OnClick(bool onoff)
 {
     Debug.Log("startTime = " + startTime + " endTime = " + endTime);
     OnPlayClick.Invoke(startTime, endTime);
 }
 protected virtual void OnPlayEvent(PlayEventArgs e) => PlayEvent?.Invoke(this, e);
示例#8
0
 private void play_mi_Click(object sender, RoutedEventArgs e)
 {
     PlayEvent?.Invoke(null, null);
 }
示例#9
0
 private void Button2_Click(object sender, EventArgs e)
 {
     PlayEvent?.Invoke(this, EventArgs.Empty);
     updateButtons();
 }
示例#10
0
 public void Play()
 {
     PlayEvent?.Invoke();
 }
示例#11
0
 public void ActionPlay()
 {
     PlayEvent?.Invoke();
     gameObject.SetActive(false);
 }