Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     theTrackPlayer = gameObject.GetComponent<TrackPlayer> ();
     theEnemyRangedShot = gameObject.GetComponent<EnemyRangedShot> ();
     theEnemyCharge = gameObject.GetComponent<EnemyCharge> ();
     theEnemyStomp = gameObject.GetComponent<EnemyStomp> ();
 }
Ejemplo n.º 2
0
	// Use this for initialization
	void Start () {
		player = p.GetComponent<TrackPlayer> ();
		_player = p.GetComponent<Player> ();
		source = gameObject.GetComponent<AudioSource> ();
		youAreNotAlone.gameObject.SetActive (false);
		look = new Vector3 (0.0f, 0.0f, 1.0f);
	}
    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;

        if (TrackPlayer.getPlayerVisable() == true && timer > fireRate + delay)
        {
            delay = Random.Range(0f, fireRate / 2);
            timer = 0;

            float displace = EnemyGunController2D.aim;
            float rot      = transform.root.transform.rotation.eulerAngles.z + displace;

            switch (fireType)
            {
            case FireType2D.SINGLE:
            {
                ShootOne(rot);
                break;
            }

            default:
                break;
            }
        }
    }
Ejemplo n.º 4
0
 // ==============================
 // Methods
 // ==============================
 public AiController(int noRhythmKeys, Fighter fighter, TrackPlayer player)
     : base(noRhythmKeys)
 {
     this.fighter = fighter;
     this.player = player;
     LastNotes = new LinkedListNode<Note>[noRhythmKeys];
 }
    // Use this for initialization
    void Start()
    {
        anim = GetComponent <Animator> ();
        GameObject go = GameObject.Find("Main Camera");

        camera = go.GetComponent <TrackPlayer>();
    }
Ejemplo n.º 6
0
        public override void OnMusicRequest(MusicTrack track)
        {
            TrackPlayer p = SpawnNewPlayer();

            p.PlayLooped(track);
            ExitTo(new SingleTrackPlayingState(p));
        }
Ejemplo n.º 7
0
 // ==============================
 // Methods
 // ==============================
 public AiController(int noRhythmKeys, Fighter fighter, TrackPlayer player)
     : base(noRhythmKeys)
 {
     this.fighter = fighter;
     this.player  = player;
     LastNotes    = new LinkedListNode <Note> [noRhythmKeys];
 }
Ejemplo n.º 8
0
 protected override void Begin()
 {
     stingerPlayer = SpawnNewPlayer();
     loopPlayer    = SpawnNewPlayer();
     stingerPlayer.PlayOnce(stinger, OnStingerFinished);
     loopPlayer.PlayLoopedScheduled(loop, stinger.Duration);
 }
Ejemplo n.º 9
0
        public override Vector3 NextPosition(TrackPlayer player)
        {
            var circumference  = Mathf.PI * Radius * 2;
            var angleTransform = player.Speed / circumference;

            return(Quaternion.AngleAxis((int)player.Direction * angleTransform, Vector3.forward) *
                   player.GameObject.transform.position);
        }
Ejemplo n.º 10
0
 public RhythmEngine(Configuration config)
 {
     Config = config;
     fadeInTimeInterval = (float)(Config.Game.Track.LeadIn * fadeVolumeInterval);
     fadeOutTimeInterval = (float)(Config.Game.Track.FallOut * fadeVolumeInterval);
     State = RhythmEngineState.Stopped;
     for (int i = 0; i < NoPlayers; ++i)
         players[i] = new TrackPlayer();
     ActivePlayer = PlayerID.Left;
 }
Ejemplo n.º 11
0
    private void Awake()
    {
        if (Instance != null)
        {
            DestroyImmediate(gameObject);
            return;
        }

        Instance = this;
    }
Ejemplo n.º 12
0
    void Awake()
    {
        for (int i = 0; i < priorityLevel; ++i)
        {
            AudioSource audioPlayer = gameObject.AddComponent <AudioSource>();
            audioPlayer.playOnAwake = false;
            audioSources.Add(audioPlayer);

            TrackPlayer tp = new TrackPlayer();
            tracks.Add(tp);
        }
    }
Ejemplo n.º 13
0
        public override Vector3 NextRotation(TrackPlayer player)
        {
            var circleCenter = GameObject.transform.position;
            var playerPos    = player.GetPosition();
            var atan2        = Mathf.Atan2(playerPos.y - circleCenter.y, playerPos.x - circleCenter.x);
            var deg          = atan2 * Mathf.Rad2Deg;


            var eulerRotVector3 = new Vector3(0, 0, deg);

            Debug.Log($"Player Pos: {playerPos} eulerRotVector3: {eulerRotVector3}");
            return(eulerRotVector3);
        }
Ejemplo n.º 14
0
 protected override void Begin()
 {
     if (track != null)
     {
         player = SpawnNewPlayer();
         player.PlayLooped(track);
         player.FadeIn(Music.DefaultFadeTime, OnFadeInOver);
     }
     else
     {
         ExitTo(new NoMusicState());
     }
 }
    private void spawnPlayer(NodeInfo node)
    {
        GameObject  player = (GameObject)Resources.Load("Player", typeof(GameObject));
        GameObject  camera = GameObject.Find("Main Camera");
        TrackPlayer track  = camera.GetComponent("TrackPlayer") as TrackPlayer;

        if (node != null)
        {
            GameObject p = (GameObject)Instantiate(player);
            p.transform.position = new Vector2(node.transform.position.x, node.transform.position.y);
            PlayerControl pC = p.GetComponent("PlayerControl") as PlayerControl;
            pC.up        = GameObject.Find("Up Direction");  pC.down = GameObject.Find("Down Direction");
            pC.left      = GameObject.Find("Left Direction"); pC.right = GameObject.Find("Right Direction");
            track.player = p;
        }
    }
Ejemplo n.º 16
0
        public virtual Interactor.Base CreateInteractor(TrackPlayer tp, ChannelMessage cm)
        {
            EPointF ptLoc    = new EPointF();
            int     note     = cm.Data1;
            int     strength = cm.Data2;
            int     duration = 10;

            Interactor.Base interactor = null;
            LocSetter.Base  locSetter  = null;

            Endogine.Node node = this._trackSettings[tp.Track.Name];
            if (node != null)
            {
                if (node["Interactor"] != null)
                {
                    string sType = "MusicGame.Midi.Interactor." + node["Interactor"].Text;
                    Type   type  = Type.GetType(sType);
                    System.Reflection.ConstructorInfo cons = type.GetConstructor(new Type[] {});
                    interactor = (Interactor.Base)cons.Invoke(new object[] {});
                }
                if (node["LocSetter"] != null)
                {
                    string sType = "MusicGame.Midi.LocSetter." + node["LocSetter"].Text;
                    Type   type  = Type.GetType(sType);
                    System.Reflection.ConstructorInfo cons = type.GetConstructor(new Type[] {});
                    locSetter = (LocSetter.Base)cons.Invoke(new object[] {});
                }
            }

            if (interactor == null)
            {
                interactor = new Interactor.Default();
            }
//			if (locSetter==null)
//				locSetter = new LocSetter.Default();

            interactor.Prepare(tp.Track.Name, cm.MidiChannel, this._readAheadMsecs, note, strength, duration, ptLoc);
            if (locSetter != null)
            {
                locSetter.Parent = interactor;
            }

            this._spritesToStart.Add(interactor);
            return(interactor);
        }
Ejemplo n.º 17
0
        private void Move(TrackPlayer player, Func <LinkedListNode <SinglePath>, LinkedListNode <SinglePath> > movement)
        {
            SinglePath pathForPlayerOnTrack;

            if (_playerPathMapping.TryGetValue(player, out pathForPlayerOnTrack))
            {
                var currentTrack = _paths.Find(pathForPlayerOnTrack);
                if (currentTrack != null)
                {
                    var nextTrack = movement.Invoke(currentTrack);
                    if (nextTrack != null)
                    {
                        _playerPathMapping[player] = nextTrack.Value;
                        player.SetPosition(nextTrack.Value.GetLaneSwapPosition(player, currentTrack.Value));
                    }
                }
            }
        }
Ejemplo n.º 18
0
        private void tp_TrackMessage(object sender, IMidiMessage message)
        {
            if (!(message is Endogine.Midi.ChannelMessage))             //message.GetType() != typeof(Endogine.Midi.ChannelMessage))
            {
                return;
            }

            TrackPlayer    tp = (TrackPlayer)sender;
            ChannelMessage cm = (ChannelMessage)message;

            if (cm.Command != ChannelCommand.NoteOn)
            {
                return;
            }
            if (cm.Data2 == 0)
            {
                return;
            }

            this._factory.CreateInteractor(tp, cm);
        }
Ejemplo n.º 19
0
        private async void WhatsMyMoodButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (player != null)
            {
                player.songPlayer.Stop();
            }

            await localPhotoStorage.Save(PHOTO_FILE_NAME);

            var result = await imageProcessing.RecognizeEmotion(localPhotoStorage.GetLastPhotoSaved());

            List <string> listOfResults = new List <string>();

            try
            {
                await age();
            }
            catch (Exception exp)
            {
                yourAge = "20";
            }

            listOfResults.Add("Age: " + yourAge);

            for (int i = 0; i < 2; i++)
            {
                listOfResults.Add(ProjectOxford.emotions[i]);
            }

            emotionList.ItemsSource = listOfResults;

            string currentColor;

            Random rnd = new Random();

            int randomNum = (rnd.Next(1, 20)) % 2 + 1;

            player = new TrackPlayer(ProjectOxford.emotions[0] + randomNum.ToString() + ".mp3", yourAge);
            await player.PlayMediaElement();
        }
Ejemplo n.º 20
0
        public MainWindow()
        {
            Current = this;
            _       = new Player();

            InitializeComponent();

            addMenus();

            DcModeComboBox.SelectedIndex     = 0;
            DcModeComboBox.SelectionChanged += dcModeComboBox_SelectionChanged;

            Loaded += mainWindow_Loaded;
            Closed += mainWindow_Closed;

            //playlists datagrid
            playlistsViewSource = ((System.Windows.Data.CollectionViewSource) this.FindResource("PlaylistsViewSource"));
            //playlistViewSource.Filter += tracksViewSource_Filter;
            PlaylistsDataGrid.SelectionChanged += PlaylistsDataGrid_SelectionChanged;
            PlaylistsDataGrid.MouseDoubleClick += playlistsDataGrid_MouseDoubleClick;
            var contextMenu            = new ContextMenu();
            var deletePlaylistMenuItem = new MenuItem {
                Header = "_Delete Playlist"
            };

            deletePlaylistMenuItem.Click += deletePlaylistMenuItem_Click;
            contextMenu.Items.Add(deletePlaylistMenuItem);
            PlaylistsDataGrid.ContextMenu = contextMenu;

            //details of playing playlist datagrid
            playlistViewSource = ((System.Windows.Data.CollectionViewSource) this.FindResource("PlaylistViewSource"));
            updatePlaylistGridAndTitle();

            TrackPlayer.Init(setPlayinglistForTrackPlayer);
            TrackPlayer.TrackChanged += TrackPlayer_TrackChanged;

            StatusBarBackgroundNormal = MainStatusBar.Background;
            StatusBarBackgroundTest   = Brushes.LightCoral;
        }
Ejemplo n.º 21
0
        ///<summary>
        ///This is where the magic happens. Fired on track change
        ///</summary>
        public void TrackChanged(TrackPlayer Player)
        {
            //Check if the plugin is enabled (We trust you to have the config done properly)
            //AND
            //Current Track's type is part of the user-selected Track types
            if (Enabled && (SelectedTrackTypes.Length == 0 || Array.Exists(SelectedTrackTypes, delegate(string s) { return(s.Equals(Player.TrackData.TrackType.ToString())); })))
            {
                //increase counter for PlayCount Timing (if we're on "Time" timing, this won't hurt either. Worst that could happen is the number overflowing)
                counter++;
                //compare NOW and startTime + Interval minutes
                int compareTimes = DateTime.Compare(DateTime.Now, startTimer.AddMinutes(Interval));

                //Send a message if PlayCount counter is greater than the interval
                if (Timing == "WaitForPlayCount" && counter > Interval)
                {
                    //Disable Plugin if the webservice reports a problem
                    if (!Requester.SendRequest(this, Player.TrackData, Message, Networks, UserId, Password, SendCoverArt))
                    {
                        Enabled = false;
                    }
                    //reset counter
                    counter = 0;
                }
                //Send message if "Time" comparison results in the NOW time being greater than the base time + interval
                else if (Timing == "WaitForTime" && compareTimes >= 0)
                {
                    //Disable Plugin if the webservice reports a problem
                    if (!Requester.SendRequest(this, Player.TrackData, Message, Networks, UserId, Password, SendCoverArt))
                    {
                        Enabled = false;
                    }
                    //reset base time
                    startTimer = DateTime.Now;
                    //reset counter to prevent integer overflow
                    counter = 0;
                }
            }
        }
Ejemplo n.º 22
0
    public void Start()
    {
        _lineRenderer = gameObject.AddComponent <LineRenderer>();

//		Material yourMaterial = (Material)Resources.Load("ray", typeof(Material));
//		_lineRenderer.GetComponent<Renderer>().sharedMaterial = yourMaterial;

        _lineRenderer.startWidth = 1f;
        _lineRenderer.endWidth   = 1f;
        _lineRenderer.enabled    = false;

        trackPlayer = Camera.main.GetComponent <TrackPlayer> ();

        mainCameraControls = Camera.main.GetComponent <MouseOrbitZoom> ();
        Camera bgCamera = GameObject.Find("BGCamera").GetComponent <Camera>();

        bgCameraControls = bgCamera.GetComponent <MouseOrbitZoom> ();

        engineBlast = GameObject.Find("Dope Fire Trail").GetComponent <ParticleSystem>();
        engineAudio = GetComponent <AudioSource>();

        bgFgOffset = bgCamera.transform.position - Camera.main.transform.position;
    }
Ejemplo n.º 23
0
    TrackPlayer CreateTrackPlayer(int deck, AudioMixer[] section1Mixers, AudioMixer[] section2Mixers)
    {
        // 텐션 오토메이션 버스 생성
        AutomationHub []      tensionCtrlBus   = new AutomationHub[4];
        IAutomationControl [] sec1TensionCtrls = new IAutomationControl[4];
        IAutomationControl [] sec2TensionCtrls = new IAutomationControl[4];
        for (int i = 0; i < 4; i++)
        {
            var out1 = m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 0, i));
            var out2 = m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 1, i));

            var bus = new AutomationHub(m_automationMgr);
            bus.SetOutputs(out1, out2);
            bus.CreateChains(2);

            tensionCtrlBus[i] = bus;

            sec1TensionCtrls[i] = tensionCtrlBus[i].GetChain(0);
            sec2TensionCtrls[i] = tensionCtrlBus[i].GetChain(1);
        }

        // 플레이어 생성
        var tplayer = new TrackPlayer(this);

        var player1ctrl = m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 0));
        var player1     = CreateSectionPlayer(section1Mixers, player1ctrl, sec1TensionCtrls);

        tplayer.AttachSectionPlayer(player1, player1ctrl);

        var player2ctrl = m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 1));
        var player2     = CreateSectionPlayer(section2Mixers, player2ctrl, sec2TensionCtrls);

        tplayer.AttachSectionPlayer(player2, player2ctrl);

        return(tplayer);
    }
Ejemplo n.º 24
0
        ///<summary>
        ///This is where the magic happens. Fired on track change
        ///</summary>
        public void TrackChanged(TrackPlayer Player)
        {
            //Check if the plugin is enabled (We trust you to have the config done properly)
            //AND
            //Current Track's type is part of the user-selected Track types
            if (Enabled && (SelectedTrackTypes.Length == 0 || Array.Exists(SelectedTrackTypes, delegate (string s) { return s.Equals(Player.TrackData.TrackType.ToString()); })))
            {
                //increase counter for PlayCount Timing (if we're on "Time" timing, this won't hurt either. Worst that could happen is the number overflowing)
                counter++;
                //compare NOW and startTime + Interval minutes
                int compareTimes = DateTime.Compare(DateTime.Now, startTimer.AddMinutes(Interval));

                //Send a message if PlayCount counter is greater than the interval
                if (Timing == "WaitForPlayCount" && counter > Interval)
                {
                    //Disable Plugin if the webservice reports a problem
                    if (!Requester.sendRequest(Player.TrackData, Message, Networks, UserId, Password))
                    {
                        Enabled = false;
                    }
                    //reset counter
                    counter = 0;
                }
                //Send message if "Time" comparison results in the NOW time being greater than the base time + interval
                else if (Timing == "WaitForTime" && compareTimes >= 0)
                {
                    //Disable Plugin if the webservice reports a problem
                    if (!Requester.sendRequest(Player.TrackData, Message, Networks, UserId, Password))
                    {
                        Enabled = false;
                    }
                    //reset base time
                    startTimer = DateTime.Now;
                    //reset counter to prevent integer overflow
                    counter = 0;
                }
            }
        }
Ejemplo n.º 25
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 26
0
 public TrackRenderer(TrackPlayer host)
     : this(new Rectangle(0, 0, 400, 300), host)
 {
 }
Ejemplo n.º 27
0
 public TrackRenderer(Rectangle dimensions, TrackPlayer host)
 {
     Dimensions = dimensions;
     Host = host;
 }
Ejemplo n.º 28
0
 public void MoveRight(TrackPlayer player)
 {
     Move(player, currentTrack => currentTrack?.Next);
 }
Ejemplo n.º 29
0
 public void UnregisterTrackPlayer(TrackPlayer tp)
 {
     tp.TrackEvent -= new Endogine.Midi.TrackPlayer.TrackEventDelegate(tp_TrackEvent);
 }
Ejemplo n.º 30
0
        public PlaylistWindow(
            Playlist?playlist = null,
            IEnumerable <PlaylistTrack>?additionalPlaylistTracks = null,
            Action?refreshOwner = null)
        {
            this.playlist     = playlist;
            this.refreshOwner = refreshOwner;

            InitializeComponent();

            Width  = SystemParameters.PrimaryScreenWidth * .8;
            Height = SystemParameters.PrimaryScreenHeight * .8;

            Loaded  += playlistWindow_Loaded;
            Closing += PlaylistWindow_Closing;
            Closed  += playlistWindow_Closed;

            //tracks
            tracks    = new();
            trackRows = new();
            var trackNo = 0;

            totalDuration = TimeSpan.Zero;
            locations     = new();
            albums        = new();
            artists       = new();
            genres        = new();
            years         = new();

            if (playlist is not null)
            {
                //there is usually a playlist, except when VS tries to display PlaylistWindow
                PlaylistNameTextBox.Text = playlist.Name;
                foreach (var playlistTrack in playlist.PlaylistTracks.GetStoredItems().OrderBy(plt => plt.TrackNo))
                {
                    tracks.Add(playlistTrack.Track);
                    var isAdditionalTrack = additionalPlaylistTracks?.Contains(playlistTrack) ?? false;
                    var trackRow          = new TrackRow(ref trackNo, playlistTrack, updateSelectedCountTextBox, isAdditionalTrack);
                    trackRows.Add(trackRow);
                    if (isAdditionalTrack && firstAddedTrackRow is null)
                    {
                        firstAddedTrackRow = trackRow;
                    }
                }
                DurationTextBox.Text = playlist.TracksDurationHhMm;
                DC.GetTracksStats(ref totalDuration, locations, albums, artists, genres, years, tracks);
            }

            PlaylistNameTextBox.TextChanged += playlistNameTextBox_TextChanged;
            TracksCountTextBox.Text          = tracks.Count.ToString();

            //filter
            FilterTextBox.TextChanged          += filterTextBox_TextChanged;
            ArtistComboBox.SelectionChanged    += filterComboBox_SelectionChanged;
            ArtistComboBox.ItemsSource          = artists;
            AlbumComboBox.SelectionChanged     += filterComboBox_SelectionChanged;
            AlbumComboBox.ItemsSource           = albums;
            AlbumComboBox.DisplayMemberPath     = "AlbumArtist";
            GenreComboBox.SelectionChanged     += filterComboBox_SelectionChanged;
            GenreComboBox.ItemsSource           = genres;
            YearComboBox.SelectionChanged      += yearComboBox_SelectionChanged;
            YearComboBox.ItemsSource            = years;
            LocationsComboBox.SelectionChanged += filterComboBox_SelectionChanged;
            LocationsComboBox.ItemsSource       = locations;
            RemoveCheckBox.Click      += checkBox_Click;
            PlaylistCheckBox.Click    += checkBox_Click;
            ClearButton.Click         += clearButton_Click;
            RemoveAllButton.Click     += removeAllButton_Click;
            PLAllButton.Click         += plAllButton_Click;
            UnselectAllButton.Click   += unselectAllButton_Click;
            ExecuteRemoveButton.Click += executeRemoveButton_Click;
            AddToOtherPlaylistComboBox.ItemsSource = DC.Data.PlaylistStrings.Where(pls => pls != PlaylistNameTextBox.Text);
            AddToOtherPlaylistButton.Click        += addToOtherPlaylistButton_Click;

            //datagrid
            tracksViewSource        = ((System.Windows.Data.CollectionViewSource) this.FindResource("TracksViewSource"));
            tracksViewSource.Source = trackRows;
            tracksViewSource.IsLiveSortingRequested = true;
            tracksViewSource.Filter += tracksViewSource_Filter;
            //strangely, it seems both following lines are needed to make sorting work properly
            TracksDataGrid.Columns[0].SortDirection = ListSortDirection.Ascending;
            tracksViewSource.View.SortDescriptions.Add(new SortDescription("PlaylistTrackNo", ListSortDirection.Ascending));
            TracksDataGrid.Sorting          += tracksDataGrid_Sorting;
            TracksDataGrid.SelectionChanged += tracksDataGrid_SelectionChanged;
            TracksDataGrid.LayoutUpdated    += TracksDataGrid_LayoutUpdated;
            BeginningButton.Click           += beginningButton_Click;
            UpPageButton.Click   += upPageButton_Click;
            UpRowButton.Click    += upRowButton_Click;
            DownRowButton.Click  += downRowButton_Click;
            DownPageButton.Click += downPageButton_Click;
            EndButton.Click      += endButton_Click;
            SaveButton.Click     += saveButton_Click;
            SaveButton.IsEnabled  = false;

            //Replaced: TracksDataGrid.MouseDoubleClick += tracksDataGrid_MouseDoubleClick;
            //Style rowStyle = new Style(typeof(DataGridRow));
            //rowStyle.Setters.Add(new EventSetter(DataGridRow.MouseDoubleClickEvent,
            //                         new MouseButtonEventHandler(tracksDataGrid_MouseDoubleClick)));
            //TracksDataGrid.RowStyle = rowStyle;
            TracksDataGrid.RowStyle.Setters.Add(new EventSetter(DataGridRow.MouseDoubleClickEvent,
                                                                new MouseButtonEventHandler(tracksDataGrid_MouseDoubleClick)));

            TrackPlayer.TrackChanged += trackPlayer_TrackChanged;
            TrackPlayer.Init(getPlayinglist);

            MainWindow.Register(this, "Playlist " + playlist?.Name);
        }
Ejemplo n.º 31
0
 void Start()
 {
     theTrackPlayer = gameObject.GetComponent<TrackPlayer>();
     theCharacterShot = gameObject.GetComponent<CharacterShot>();
 }
Ejemplo n.º 32
0
 public override Vector3 GetLaneSwapPosition(TrackPlayer player, SinglePath singlePath)
 {
     return(Vector3.Normalize(player.GetPosition()) * Radius);
 }
Ejemplo n.º 33
0
 protected override void Begin()
 {
     player = SpawnNewPlayer();
     player.PlayLooped(track);
     player.FadeIn(Music.DefaultFadeTime, OnFadeInOver);
 }
Ejemplo n.º 34
0
 public SingleTrackPlayingState(TrackPlayer p)
 {
     this.p = p;
 }
Ejemplo n.º 35
0
 public void UnregisterTrackPlayer(TrackPlayer tp)
 {
     tp.TrackEvent-=new Endogine.Midi.TrackPlayer.TrackEventDelegate(tp_TrackEvent);
 }
 private void PlayAllButton_Click(object sender, RoutedEventArgs e)
 {
     trace($">>>Play all");
     TrackPlayer.Play(allTracksPlayinglist);
 }
Ejemplo n.º 37
0
 ///<summary>
 ///required by IHost interface, I think this has to do with the PlayListChange Event
 ///</summary>
 public void AddTrack2Plugin(TrackPlayer trackData, long TriggerOn, int Position = -1)
 {
     //throw new NotImplementedException();
 }
 private void PlayErrorButton_Click(object sender, RoutedEventArgs e)
 {
     trace($">>>Play {trackError.Title}");
     TrackPlayer.Play(trackError);
 }
Ejemplo n.º 39
0
 public void MoveLeft(TrackPlayer player)
 {
     Move(player, currentTrack => currentTrack?.Previous);
 }
        public TestPlayerControlWindow()
        {
            InitializeComponent();

            TraceTextBox.Text =
                "Copyrights: " + Environment.NewLine +
                "Music promoted by https://www.free-stock-music.com" + Environment.NewLine +
                @"Track1: Stream Countdown(10s) by Alexander Nakarada | https://www.serpentsoundstudios.com
Attribution 4.0 International(CC BY 4.0)
https://creativecommons.org/licenses/by/4.0/" + Environment.NewLine + Environment.NewLine +

                @"Track2: Humorous And Comic Intro by Free Music | https://soundcloud.com/fm_freemusic
Creative Commons Attribution 3.0 Unported License
https://creativecommons.org/licenses/by/3.0/deed.en_US" + Environment.NewLine + Environment.NewLine +

                @"Track3: Music Logo For Storytelling by Free Music | https://soundcloud.com/fm_freemusic
Creative Commons Attribution 3.0 Unported License
https://creativecommons.org/licenses/by/3.0/deed.en_US" + Environment.NewLine + Environment.NewLine +

                @"Track4: Happy Media Music Opener by Free Music | https://soundcloud.com/fm_freemusic
Creative Commons Attribution 3.0 Unported License
https://creativecommons.org/licenses/by/3.0/deed.en_US" + Environment.NewLine + Environment.NewLine +

                "MediaPlayer test trace" + Environment.NewLine +
                "======================" + Environment.NewLine;
            _ = new DC(null);
            projectDirectory = new DirectoryInfo(Environment.CurrentDirectory).Parent !.Parent !.Parent !.Parent !;
            location         = new Location("locationPath", projectDirectory.FullName, isStoring: false);

            track1 = new Track(new FileInfo(projectDirectory.FullName + @"\track1.mp3"), location, isStoring: false);
            track2 = new Track(new FileInfo(projectDirectory.FullName + @"\track2.mp3"), location, isStoring: false);
            track3 = new Track(new FileInfo(projectDirectory.FullName + @"\track3.mp3"), location, isStoring: false);
            track4 = new Track(new FileInfo(projectDirectory.FullName + @"\track4.mp3"), location, isStoring: false);
            var errorFileName = projectDirectory.FullName + @"\trackError.mp3";

            File.Copy(track4.FullFileName, errorFileName, overwrite: true);
            trackError = new Track(new FileInfo(errorFileName), location, isStoring: false);
            trackError.Update(
                "TrackCausingError",
                trackError.Album,
                trackError.AlbumTrack,
                trackError.Artists,
                trackError.Composers,
                trackError.Publisher,
                trackError.Year,
                trackError.Genres,
                trackError.Weight,
                trackError.Volume,
                trackError.SkipStart,
                trackError.SkipEnd,
                trackError.TitleArtists);
            File.Delete(errorFileName);
            allTracks = new List <Track> {
                track1, track2, track3, track4
            };
            allTracksPlayinglist = new Playinglist(allTracks);

            Player.Current !.Traced += Player_Traced;
            TrackPlayer.Init(getPlayinglist);


            Play1Button.Click           += Play1Button_Click;
            Play2Button.Click           += Play2Button_Click;
            PlayAllButton.Click         += PlayAllButton_Click;
            PlayErrorButton.Click       += PlayErrorButton_Click;
            IsTracePositionButton.Click += IsTracePositionButton_Click;
        }
Ejemplo n.º 41
0
    TrackPlayer CreateTrackPlayer(int deck, AudioMixer[] section1Mixers, AudioMixer[] section2Mixers)
    {
        // 텐션 오토메이션 버스 생성
        AutomationHub [] tensionCtrlBus			= new AutomationHub[4];
        IAutomationControl [] sec1TensionCtrls	= new IAutomationControl[4];
        IAutomationControl [] sec2TensionCtrls	= new IAutomationControl[4];
        for (int i = 0; i < 4; i++)
        {
            var out1	= m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 0, i));
            var out2	= m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 1, i));

            var bus		= new AutomationHub(m_automationMgr);
            bus.SetOutputs(out1, out2);
            bus.CreateChains(2);

            tensionCtrlBus[i]	= bus;

            sec1TensionCtrls[i]	= tensionCtrlBus[i].GetChain(0);
            sec2TensionCtrls[i]	= tensionCtrlBus[i].GetChain(1);
        }

        // 플레이어 생성
        var tplayer			= new TrackPlayer(this);

        var player1ctrl		= m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 0));
        var player1			= CreateSectionPlayer(section1Mixers, player1ctrl, sec1TensionCtrls);
        tplayer.AttachSectionPlayer(player1, player1ctrl);

        var player2ctrl		= m_automationMgr.GetAutomationControlToSingleMixer(GetMixerName(deck, 1));
        var player2			= CreateSectionPlayer(section2Mixers, player2ctrl, sec2TensionCtrls);
        tplayer.AttachSectionPlayer(player2, player2ctrl);

        return tplayer;
    }
Ejemplo n.º 42
0
 void Start()
 {
     theTrackPlayer = gameObject.GetComponent<TrackPlayer>();
 }