예제 #1
0
 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);
 }
예제 #7
0
 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);
 }