protected override void CreateScene() { this.Load(WaveContent.Scenes.MyScene); MusicInfo musicInfo = new MusicInfo(WaveContent.Assets.ByeByeBrain_mp3); WaveServices.MusicPlayer.Play(musicInfo); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.WhiteSmoke; MusicInfo musicInfo = new MusicInfo("Content/intro.mp3"); WaveServices.MusicPlayer.Play(musicInfo); }
protected override void CreateScene() { FixedCamera2D camera2d = new FixedCamera2D("camera"); camera2d.BackgroundColor = Color.CornflowerBlue; EntityManager.Add(camera2d); MusicInfo musicInfo = new MusicInfo("Content/ByeByeBrain.mp3"); WaveServices.MusicPlayer.Play(musicInfo); }
protected override void CreateScene() { this.Load(WaveContent.Scenes.MyScene); WaveServices.ScreenContextManager.SetDiagnosticsActive(true); this.dolbyService = new DolbyService(); WaveServices.RegisterService (this.dolbyService); var music = new MusicInfo (WaveContent.Assets.met_mp3); WaveServices.MusicPlayer.Play (music); Button button1 = this.AddButton ("Enable Dolby", 100, 200); button1.Click += (s, o) => { this.dolbyService.IsEnabled = true; this.UpdateLabels(); }; Button button2 = this.AddButton ("Disable Dolby", 300, 200); button2.Click += (s, o) => { this.dolbyService.IsEnabled = false; this.UpdateLabels(); }; Button button3 = this.AddButton ("GAME Profile", 100, 500); button3.Click += (s, o) => { this.dolbyService.DolbyProfile = DolbyProfile.GAME; this.UpdateLabels(); }; Button button4 = this.AddButton ("MOVIE Profile", 300, 500); button4.Click += (s, o) => { this.dolbyService.DolbyProfile = DolbyProfile.MOVIE; this.UpdateLabels(); }; Button button5 = this.AddButton ("MUSIC Profile", 500, 500); button5.Click += (s, o) => { this.dolbyService.DolbyProfile = DolbyProfile.MUSIC; this.UpdateLabels(); }; Button button6 = this.AddButton ("VOICE Profile", 700, 500); button6.Click += (s, o) => { this.dolbyService.DolbyProfile = DolbyProfile.VOICE; this.UpdateLabels(); }; this.UpdateLabels(); }
protected override void CreateScene() { this.Load(@"Content/Scenes/GamePlayScene.wscene"); this.EntityManager.Find("defaultCamera2D").FindComponent<Camera2D>().CenterScreen(); this.CreateUI(); // Music var musicInfo = new MusicInfo(WaveContent.Assets.Sounds.ninjaMusic_mp3); WaveServices.MusicPlayer.Play(musicInfo); WaveServices.MusicPlayer.Volume = 0.8f; WaveServices.MusicPlayer.IsRepeat = true; }
public MusicInfo[] GetMusicList() { System.Collections.Generic.List<MusicInfo> musicInfo = new System.Collections.Generic.List<MusicInfo>(); string[] fullPath = System.IO.Directory.GetFiles(this.path, "*.ogg", System.IO.SearchOption.TopDirectoryOnly); foreach (string path in fullPath) { MusicInfo info = new MusicInfo(); info.fullPath = path; info.name = path.Substring(path.LastIndexOf('/')+1, path.LastIndexOf('.') - path.LastIndexOf('/') - 1); musicInfo.Add(info); } return musicInfo.ToArray(); }
public MusicPlaylist(World world, MusicPlaylistInfo info) { this.info = info; this.world = world; if (info.DisableWorldSounds) { Game.Sound.DisableWorldSounds = true; } IsMusicInstalled = world.Map.Rules.InstalledMusic.Any(); if (!IsMusicInstalled) { return; } playlist = world.Map.Rules.InstalledMusic .Where(a => !a.Value.Hidden) .Select(a => a.Value) .ToArray(); random = playlist.Shuffle(Game.CosmeticRandom).ToArray(); IsMusicAvailable = playlist.Any(); AllowMuteBackgroundMusic = info.AllowMuteBackgroundMusic; if (SongExists(info.BackgroundMusic)) { currentSong = currentBackgroundSong = world.Map.Rules.Music[info.BackgroundMusic]; CurrentSongIsBackground = true; } else { // Start playback with a random song currentSong = random.FirstOrDefault(); } if (SongExists(info.StartingMusic)) { currentSong = world.Map.Rules.Music[info.StartingMusic]; CurrentSongIsBackground = false; } }
/// <summary> /// 获取歌曲信息 /// </summary> /// <param name="path">歌曲路径</param> /// <returns></returns> public MusicInfo GetInfo(string path, string s) { ShellClass sh = new ShellClass(); Folder dir = sh.NameSpace(path); //路径 FolderItem item = dir.ParseName(s); //文件名称加扩展名 MusicInfo music = new MusicInfo { Mname = dir.GetDetailsOf(item, 0).Split('.')[0], Msize = dir.GetDetailsOf(item, 1), Album = dir.GetDetailsOf(item, 14), Author = dir.GetDetailsOf(item, 20), Mtime = dir.GetDetailsOf(item, 27), //完整路径加扩展名 Path = Path.Combine(path, s) }; GetMusicBitmap(music); return(music); }
private IEnumerator StopMusic(MusicInfo musicInfo) { yield return(new WaitForSeconds(musicInfo.m_MusicSettings.m_TimeBeforeDecreasingMusicVolume)); float startingTime = Time.unscaledTime; float initialVolume = musicInfo.m_MusicSource.volume; float finalVolume = 0f; float currentTime = 0.0f; float duration = musicInfo.m_MusicSettings.m_TimeToDecreaseMusicVolume; while (initialVolume > 0f) { musicInfo.m_MusicSource.volume = Mathf.Lerp(initialVolume, finalVolume, currentTime); currentTime += Time.deltaTime / duration; yield return(null); } musicInfo.m_MusicSource.Stop(); }
void BuildMusicTable(Widget list) { music = Rules.Music.Where(a => a.Value.Exists).Select(a => a.Value).ToArray(); random = music.Shuffle(Game.CosmeticRandom).ToArray(); list.RemoveChildren(); foreach (var s in music) { var song = s; if (currentSong == null) { currentSong = song; } var item = ScrollItemWidget.Setup(itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }); item.Get <LabelWidget>("TITLE").GetText = () => song.Title; item.Get <LabelWidget>("LENGTH").GetText = () => SongLengthLabel(song); list.AddChild(item); } }
private async void PlaylistView_OnDrop(object sender, DragEventArgs e) { SpinningGear.Visibility = Visibility.Visible; foreach (var s in (string[])e.Data.GetData(DataFormats.FileDrop, false)) { if (DirectoryEx.Exists(s)) { await FileUtils.AddFolder(FileSystemInfoEx.FromString(s) as DirectoryInfoEx, true, FileSystemUtils.DefaultLoadErrorCallback); } else if (PlaylistDataManager.Instance.HasReader(s.GetExt())) { Playlist.AddRange(s, FileSystemUtils.DefaultLoadErrorCallback); } else if (PlaybackManagerInstance.HasSupportingPlayer(s.GetExt())) { Playlist.Add(MusicInfo.Create(FileSystemInfoEx.FromString(s) as FileInfoEx, FileSystemUtils.DefaultLoadErrorCallback)); } } SpinningGear.Visibility = Visibility.Hidden; }
public IntroLogic(Widget widget, World world, ModData modData) { if (state != 0) { return; } this.widget = widget; this.world = world; this.modData = modData; widget.AddChild(player = new VbcPlayerWidget()); player.Bounds = new Rectangle(0, 0, Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height); var musicPlayList = world.WorldActor.Trait <MusicPlaylist>(); song = musicPlayList.CurrentSong(); musicPlayList.Stop(); }
public void PlayerShouldBeStoppable() { var playlist = new Playlist(new DummyPlaylistWatcher()); var dummyAudio = new DummyAudioInteractor(); var player = new Player(playlist, dummyAudio, null); var song = "song1"; var music = new MusicInfo() { FullPath = song }; playlist.Enqueue(music); player.Play(); player.Stop(); Assert.IsTrue(dummyAudio.WasStopped, "It should stop."); }
public void Play(MusicInfo music) { if (music == null || !IsMusicAvailable) { return; } currentSong = music; repeat = Game.Settings.Sound.Repeat; Sound.PlayMusicThen(music, () => { if (!repeat) { currentSong = GetNextSong(); } Play(); }); }
private async Task DownloadAlbumTaskLogicAsync(IAlbumDownloader downloader, MusicInfo info) { _logger.LogMusicInfoWithInformation(info); try { var album = await downloader.DownloadAsync(info.Name, info.Artist); var filePath = Path.Combine(Path.GetDirectoryName(info.FilePath) !, $"{Path.GetFileNameWithoutExtension(info.FilePath)}.png"); if (File.Exists(filePath) || album.Length <= 0) { return; } await new FileStream(filePath, FileMode.Create).WriteBytesToFileAsync(album, 1024); } catch (ErrorCodeException ex) { _logger.LogWarningInfo(ex); } }
void IGameOver.GameOver(World world) { if (world.LocalPlayer != null && world.LocalPlayer.WinState == WinState.Won) { if (SongExists(info.VictoryMusic)) { currentBackgroundSong = world.Map.Rules.Music[info.VictoryMusic]; Stop(); } } else { // Most RTS treats observers losing the game, // no need for a special handling involving them here. if (SongExists(info.DefeatMusic)) { currentBackgroundSong = world.Map.Rules.Music[info.DefeatMusic]; Stop(); } } }
private void CopyJsonInfoToPrebInfoAndInit(MusicInfo currentPlayingMusic) { var dictionary = new Dictionary <float, MusicPointPrefab>(); foreach (var m in currentPlayingMusic.MusicPointsDictionary) { var mm = new MusicPointPrefab { MusicType = m.Value.MusicType, MusicPointV3 = new Vector3((float)m.Value.MusicPointV3X, (float)m.Value.MusicPointV3Y, (float)m.Value.MusicPointV3Z), MusicPointQ4 = new Quaternion((float)m.Value.MusicPointQ4X, (float)m.Value.MusicPointQ4Y, (float)m.Value.MusicPointQ4Z, (float)m.Value.MusicPointQ4W) }; dictionary.Add(float.Parse(m.Key), mm); } CreateObjectToScene(dictionary); }
public void PlayerShouldBePausableAndResumeable() { var playlist = new Playlist(new DummyPlaylistWatcher()); var dummyAudio = new DummyAudioInteractor(); var player = new Player(playlist, dummyAudio, null); var song = "song1"; var music = new MusicInfo() { FullPath = song }; playlist.Enqueue(music); player.Play(); player.Pause(); player.Resume(); Assert.IsTrue(dummyAudio.WasPaused, "The audio must have been paused."); Assert.IsTrue(dummyAudio.WasResumed, "The audio must have been resumed."); }
public void OneMp3file_NoInfo() { var fakeFiles = new string[] { "one.mp3" }; var fakeMusicInfo = new MusicInfo() { Album = "", Artist = "" }; var fakeMusicInfoReader = new FakeMusicInfoReader(fakeMusicInfo); var importFolderInteractor = new FakeFolderInteractor(fakeFiles); var importFolderWatcher = new ImportFolderWatcher(importFolderInteractor, fakeMusicInfoReader, new MemoryLibraryRepository(), null); importFolderWatcher.ProcessFiles(); var expectedLibraryPath = @"c:\temp\Unknown Artist\Unknown Album\" + fakeFiles[0]; Assert.AreEqual(1, importFolderInteractor.MovedFiles.Count(), "There must one moved file"); Assert.AreEqual(fakeFiles[0], importFolderInteractor.MovedFiles[0].SourceFile, "The file to move must be correct."); Assert.AreEqual(expectedLibraryPath, importFolderInteractor.MovedFiles[0].DestinationFile, "The file must be moved to the correct folder."); }
private void Play_Current(int index = 0) { current_music = mlvm.Music_List[index]; title.Content = current_music.Music_title; //音乐标题 artist.Content = current_music.Artist; //歌手 album.Content = current_music.Album; //专辑名 media.Source = new Uri(current_music.file_path, UriKind.Absolute); //媒体源 //专辑封面 TagLib.File x = TagLib.File.Create(current_music.File_path); if (x.Tag.Pictures.Length >= 1) { byte[] pic = x.Tag.Pictures[0].Data.Data; albumpic.Source = ByteArrayToBitmapImage(pic); } else { albumpic.Source = new BitmapImage(new Uri(@"Image/Music.png")); ((Storyboard)this.FindResource("Rotateright")).Begin(); //图片开始旋转 } }
public MusicPlaylist(World world, MusicPlaylistInfo info) { this.info = info; this.world = world; IsMusicInstalled = world.Map.Rules.InstalledMusic.Any(); if (!IsMusicInstalled) { return; } playlist = world.Map.Rules.InstalledMusic .Where(a => !a.Value.Hidden) .Select(a => a.Value) .ToArray(); random = playlist.Shuffle(Game.CosmeticRandom).ToArray(); IsMusicAvailable = playlist.Any(); if (SongExists(info.StartingMusic)) { currentSong = world.Map.Rules.Music[info.StartingMusic]; } else if (SongExists(info.BackgroundMusic)) { currentSong = currentBackgroundSong = world.Map.Rules.Music[info.BackgroundMusic]; CurrentSongIsBackground = true; } else { // Start playback with a random song, but only if the player has installed more music var installData = Game.ModData.Manifest.Get <ContentInstaller>(); if (playlist.Length > installData.ShippedSoundtracks) { currentSong = random.FirstOrDefault(); } } Play(); }
/// <summary> /// 读取音乐资源 /// </summary> private void ReadMusicXML() { Stream s = Application.GetResourceStream(new Uri("Res/MusicList.xml", UriKind.Relative)).Stream; XmlReader xr = XmlReader.Create(s); //xr.ReadToNextSibling("/Musics/Music"); while (xr.Read()) { XmlNodeType xnt = xr.NodeType; if (xr.LocalName.Equals("Music")) { MusicInfo mi = new MusicInfo(); for (int i = 0; i < xr.AttributeCount; i++) { xr.MoveToAttribute(i); if (xr.Name.Equals("Name", StringComparison.CurrentCultureIgnoreCase)) { mi.MusicName = xr.Value; } else if (xr.Name.Equals("Length", StringComparison.CurrentCultureIgnoreCase)) { mi.MusicLengthMill = xr.ReadContentAsInt(); } else if (xr.Name.Equals("Data", StringComparison.CurrentCultureIgnoreCase)) { mi.MusicData = xr.Value; } else if (xr.Name.Equals("Key", StringComparison.CurrentCultureIgnoreCase)) { mi.Key = xr.Value; } else if (xr.Name.Equals("Speed", StringComparison.CurrentCultureIgnoreCase)) { mi.Speed = xr.ReadContentAsInt(); } } MusicInfos.Add(mi); } } }
public Dictionary <string, string> mldata = new Dictionary <string, string>();// mid,name public async Task <List <MusicInfo> > SearchMusicAsync(string Content, int osx = 1) { if (HttpHelper.IsNetworkTrue()) { JObject o = JObject.Parse(await HttpHelper.GetWebAsync($"http://59.37.96.220/soso/fcgi-bin/client_search_cp?format=json&t=0&inCharset=GB2312&outCharset=utf-8&qqmusic_ver=1302&catZhida=0&p={osx}&n=20&w={Content}&flag_qc=0&remoteplace=sizer.newclient.song&new_json=1&lossless=0&aggr=1&cr=1&sem=0&force_zonghe=0")); List <MusicInfo> dt = new List <MusicInfo>(); int i = 0; while (i < o["data"]["song"]["list"].Count()) { MusicInfo m = new MusicInfo(); m.Title = o["data"]["song"]["list"][i]["name"].ToString().Replace("\\", "-").Replace("?", "").Replace("/", "").Replace(":", "").Replace("*", "").Replace("\"", "").Replace("<", "").Replace(">", "").Replace("|", ""); string Artist = ""; for (int osxc = 0; osxc != o["data"]["song"]["list"][i]["singer"].Count(); osxc++) { Artist += o["data"]["song"]["list"][i]["singer"][osxc]["name"] + "&"; } m.Artist = Artist.Substring(0, Artist.LastIndexOf("&")); m.OnlineId = o["data"]["song"]["list"][i]["mid"].ToString(); m.AlbumArtPath = $"http://y.gtimg.cn/music/photo_new/T002R300x300M000{o["data"]["song"]["list"][i]["album"]["mid"]}.jpg"; m.GC = o["data"]["song"]["list"][i]["id"].ToString(); m.Url = await GetUrlAsync(m.OnlineId); dt.Add(m); try { if (!mldata.ContainsKey(m.OnlineId)) { mldata.Add(m.OnlineId, (m.Title + " - " + m.Artist).Replace("\\", "-").Replace("?", "").Replace("/", "").Replace(":", "").Replace("*", "").Replace("\"", "").Replace("<", "").Replace(">", "").Replace("|", "")); } } catch { } i++; } return(dt); } else { return(null); } }
private static async void GetMusicList(TcpConnection con, NetMessage message) { WriteLog(con, "尝试获取音乐列表"); DataSet set = await API.GetMusicList(); NetMessage mess; if (set == null) { WriteLog(con, "获取音乐列表失败"); mess = GetFailMessage(); } else { WriteLog(con, "获取音乐列表成功"); MusicInfo[] info = new MusicInfo[set.Tables[0].Rows.Count]; for (int i = 0; i != set.Tables[0].Rows.Count; ++i) { info[i] = new MusicInfo(); object[] objs = set.Tables[0].Rows[i].ItemArray; info[i].name = objs[0] as string; info[i].singer = objs[1] as string; string url = outpath + objs[3] + objs[2]; info[i].url = url; info[i].playedtimes = (int)objs[4]; info[i].uname = objs[5] as string; } mess = GetGetListSuccessMessage(info); } try { await con.Send(mess); } catch { con.Close(); return; } con.Close(); }
private void DisplayMusicInfomation() { SongNameText.text = SelectGV.musicInfo[(selectPosition + 3) % SelectGV.musicInfo.Length].displayName; ComposerText.text = SelectGV.musicInfo[(selectPosition + 3) % SelectGV.musicInfo.Length].composer; MusicInfo currentMusic = SelectGV.musicInfo[(selectPosition + 3) % SelectGV.musicInfo.Length]; for (int i = 0; i < 4; i++) { string tmp = currentMusic.difficulties[i]; if (tmp != "0") { DifficultyLabel[i].SetActive(true); DifficultyLabelText[i].text = tmp; } else { DifficultyLabel[i].SetActive(false); DifficultyLabelText[i].text = "---"; } } MapperText.text = "Map Design : " + currentMusic.mapper; }
private void SaveMusicInfo(bool hasExported) { MusicInfo = new MusicInfo() { Title = titleText.Text, Artist = artistText.Text, Designer = designerText.Text, Difficulty = DifficultyBox.SelectedIndex, WEKanji = weText.Text, WEStars = weStarUpDown.Value, PlayLevel = playLevelBox.Text, SongId = songIdText.Text, MusicFileName = musicPathText.Text, MusicOffset = offsetUpDown.Value, JacketFileName = JacketPathText.Text, ExportPath = exportPathText.Text, MeasureOffset = measureOffsetUpDown.Value, Metronome = metoronomeBox.SelectedIndex, SlideCurveSegment = curveSlideUpDown.Value, HasExported = hasExported }; }
public static void PlayMusicThen(MusicInfo m, Action then) { if (m == null || !m.Exists) { return; } OnMusicComplete = then; if (m == currentMusic && music != null) { soundEngine.PauseSound(music, false); return; } StopMusic(); currentMusic = m; MusicPlaying = true; var sound = sounds[m.Filename]; music = soundEngine.Play2D(sound, false, true, float2.Zero, MusicVolume); }
public void ByNumberFormatTest() { MusicInfo info1 = new MusicInfo(); info1.Title = "2017/2/1 11:16"; MusicInfo info2 = new MusicInfo(); info2.Title = "2018/3/2 1:30"; MusicInfo info3 = new MusicInfo(); info3.Title = "2010/10/9 19:50"; MusicInfo info4 = new MusicInfo(); info4.Title = "2020/1/1 1:1"; MusicInfo info5 = new MusicInfo(); info5.Title = "2050/3/1 0:0"; MusicInfo info6 = new MusicInfo(); info6.Title = "1992/12/25/15:00"; MusicInfo info7 = new MusicInfo(); info7.Title = "752"; MusicInfo info8 = new MusicInfo(); info8.Title = "560"; var testCollection = new ObservableCollection <MusicInfo>(); /* * testCollection.Add(info4); * testCollection.Add(info1); * testCollection.Add(info6); * testCollection.Add(info2); * testCollection.Add(info5); * testCollection.Add(info3);*/ testCollection.Add(info7); testCollection.Add(info8); //var resultCollection = SortMusicInfo.ByNumberFormat(testCollection, i => i.Title); }
public void SimpleStart() { string filename = "song1"; var music = new MusicInfo() { FullPath = filename }; var dummyPlaylistWatcher = new DummyPlaylistWatcher(); var playlist = new Playlist(dummyPlaylistWatcher); playlist.Enqueue(music); Assert.AreEqual(1, playlist.Count, "There must be one song in the playlist."); MusicInfo song = playlist.CurrentSong; playlist.CurrentSongIsStarting(); Assert.AreEqual(filename, song.FullPath, "The next song must be the one that was enqueued."); Assert.AreEqual(1, dummyPlaylistWatcher.PlayHistory.Count, "Only one song must have been played."); Assert.AreEqual(filename, dummyPlaylistWatcher.PlayHistory[0], "The song that played was "); }
void IMusicUndergroundJob.WaitForTransactionToSuccessThenFinishCreatingMusic(MusicInfo music) { bool isTransactionSuccess = false; do { var receipt = ethereumService.GetTransactionReceipt(music.TransactionHash).Result; if (receipt == null) { continue; } if (receipt.Status.Value == (new HexBigInteger(1)).Value) { isTransactionSuccess = true; var contractAddress = ethereumService.GetObjectContractAddress(music.Id).Result; music.ContractAddress = contractAddress; music.TransactionStatus = TransactionStatuses.Success; musicRepository.Update(music); var musicContract = ethereumService.GetContract(MusicAbi, music.ContractAddress); var updateFunction = ethereumService.GetFunction(musicContract, EthereumFunctions.UpdateMusicInformation); var updateReceipt = updateFunction.SendTransactionAndWaitForReceiptAsync( ethereumService.GetEthereumAccount(), new HexBigInteger(6000000), new HexBigInteger(Nethereum.Web3.Web3.Convert.ToWei(50, UnitConversion.EthUnit.Gwei)), new HexBigInteger(0), functionInput: new object[] { music.Name, music.Title, music.Album, music.PublishingYear, music.OwnerId, music.LicenceLink, (uint)music.CreatureType, (uint)music.OwnerType }).Result; } }while (isTransactionSuccess != true); }
public ActionResult Edit(MusicInfo info) { MusicInfo infoExist = MusicBLL.GetList(p => p.ID == info.ID).FirstOrDefault(); if (string.IsNullOrEmpty(info.Name)) { return(Json(new APIJson("请填写名称"))); } if (info.CategoryID <= 0) { return(Json(new APIJson("请选择分类"))); } HttpPostedFileBase FileMain = Request.Files["FileMain"]; if (null != FileMain) { info.SRC = "/Content/File/Music/" + Guid.NewGuid().ToString() + FileMain.FileName.Substring(FileMain.FileName.LastIndexOf(".")); FileMain.SaveAs(Server.MapPath(info.SRC)); infoExist.SRC = info.SRC; infoExist.MD5 = Md5Helper.GetMD5HashFromFile(Server.MapPath(info.SRC)); } if (info.PlayTime <= 0) { info.PlayTime = 1; } infoExist.CategoryID = info.CategoryID; infoExist.Name = info.Name; infoExist.SortID = info.SortID; infoExist.Enable = info.Enable; infoExist.PlayTime = info.PlayTime; if (MusicBLL.Edit(infoExist)) { return(Json(new APIJson(0, "提交成功"))); } return(Json(new APIJson(-1, "提交失败,请重试"))); }
public override MusicInfo[] GetSongById(string id) { var getUrl = GetSongByIdRAsyn(id); var getLrc = GetLrcByIdAsync(id); string htmlPage = GetMusicInfoAsync(id).Result; Match musicInfoMat = Regex.Match(htmlPage, "var g_SongData = (.+);"); if (musicInfoMat.Groups.Count == 1) { return(null); } JObject MIJo = JObject.Parse(musicInfoMat.Groups[1].Value); if (MIJo["mid"].ToString().Equals("")) { return(null); } // string songid = MIJo["songid"].ToString(); string authors = ""; foreach (var author in MIJo["singer"].Children()) { authors += author["name"].ToString() + ","; } MusicInfo mi = new MusicInfo() { songid = id, pic = "https://y.gtimg.cn/music/photo_new/T002R300x300M000" + MIJo["albummid"].ToString() + ".jpg", link = "https://y.qq.com/n/yqq/song/" + id + ".html", type = "qq", title = MIJo["songtitle"].ToString(), author = authors.Substring(0, authors.Length - 1), url = getUrl.Result, lrc = getLrc.Result }; return(new MusicInfo[] { mi }); }
/// <summary> /// 向数据库中写入 /// </summary> /// <param name="music"></param> /// <returns></returns> public bool Insert(MusicInfo music) { StringBuilder sb = new StringBuilder(); sb.Append("insert into UserInfo (Mname,Mpath,Mid) values(@Mname,@Mpath,@mid)"); SQLiteParameter[] parameter = { new SQLiteParameter("@Mname", System.Data.DbType.String, 32), new SQLiteParameter("@Mpath", System.Data.DbType.String, 128), new SQLiteParameter("@mid", System.Data.SqlDbType.Int), }; parameter[0].Value = music.Mname; parameter[1].Value = music.Path; parameter[2].Value = music.Id; using (SQLiteConnection con = new SQLiteConnection(connStr)) { SQLiteCommand cmd = new SQLiteCommand(sb.ToString(), con); cmd.Parameters.AddRange(parameter); con.Open(); return(cmd.ExecuteNonQuery() > 0); } }
private void LoadMusicInfo(MusicInfo musicInfo) { if (musicInfo == null) { return; } titleText.Text = musicInfo.Title; artistText.Text = musicInfo.Artist; designerText.Text = musicInfo.Designer; DifficultyBox.SelectedIndex = musicInfo.Difficulty; weText.Text = musicInfo.WEKanji; weStarUpDown.Value = musicInfo.WEStars; playLevelBox.Text = musicInfo.PlayLevel; songIdText.Text = musicInfo.SongId; musicPathText.Text = musicInfo.MusicFileName; offsetUpDown.Value = musicInfo.MusicOffset; JacketPathText.Text = musicInfo.JacketFileName; exportPathText.Text = musicInfo.ExportPath; measureOffsetUpDown.Value = musicInfo.MeasureOffset; metoronomeBox.SelectedIndex = musicInfo.Metronome; curveSlideUpDown.Value = musicInfo.SlideCurveSegment; MusicInfo.HasExported = musicInfo.HasExported; }
public void StartPlayMode(string _musicToPlay) { musicToPlay = _musicToPlay; GetBeatCubes(); SoundFile soundFile = FileIOManager.instance.GetSoundFile(musicToPlay); cilpToPlay = soundFile.Clip; musicInfo = FileIOManager.instance.GetMusicInfo(musicToPlay); SectionManager.instance.SetSections(ExtractSectionStartTimesFromMusicInfo(musicInfo)); SectionManager.instance.CreateSectionButtons(); InsertBeatsIntoBeatCubes(); countGuideEffectBeats = 0; countGuideEffectSection = 0; elapsedTimeSincePlayStarted = -musicStartdelayTime; createGuideEffects = true; autoChangeSection = true; }
public void PlayMusic(MusicInfo m, bool looped = false) { if (m == null || !m.Exists) { return; } StopMusic(); Func <ISoundFormat, ISound> stream = soundFormat => soundEngine.Play2DStream( soundFormat.GetPCMInputStream(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate, looped, true, WPos.Zero, MusicVolume * m.VolumeModifier); music = LoadSound(m.Filename, stream); if (music == null) { onMusicComplete = null; return; } currentMusic = m; MusicPlaying = true; }
protected override void CreateScene() { this.Load(@"Content/Scenes/GamePlayScene.wscene"); this.startBall = this.EntityManager.Find("BallStart"); this.tapToStart = this.EntityManager.Find("TapToStart"); // UI this.CreateUI(); // Scene Behaviors this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate); this.AddSceneBehavior(new GamePlaySceneBehavior(), SceneBehavior.Order.PostUpdate); // Play background music this.bg_music = new MusicInfo(WaveContent.Assets.Sounds.bg_music_mp3); this.bg_ambient = new MusicInfo(WaveContent.Assets.Sounds.bg_ambient_mp3); WaveServices.MusicPlayer.Play(this.bg_music); WaveServices.MusicPlayer.IsRepeat = true; // Set first state this.CurrentState = States.TapToStart; }
private void StartMusic() { MusicInfo musicInfo = new MusicInfo("Content/Music/Ozzed_-_A_Well_Worked_Analogy.mp3"); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.MusicPlayer.Volume = 0.6f; WaveServices.MusicPlayer.Play(musicInfo); }
/// <summary> /// Creates the scene. /// </summary> /// <remarks> /// This method is called before all /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized. /// </remarks> protected override void CreateScene() { FixedCamera2D camera2d = new FixedCamera2D("camera"); camera2d.ClearFlags = ClearFlags.DepthAndStencil; EntityManager.Add(camera2d); // Music Player MusicInfo musicInfo = new MusicInfo("Content/audiodolby.mp3"); WaveServices.MusicPlayer.Play(musicInfo); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.MusicPlayer.Play(new MusicInfo("Content/audiodolby.mp3")); WaveServices.MusicPlayer.IsDolbyEnabled = true; WaveServices.MusicPlayer.DolbyProfile = DolbyProfiles.GAME; // Button Stack Panel buttonPanel = new StackPanel(); buttonPanel.Entity.AddComponent(new AnimationUI()); buttonPanel.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center; buttonPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center; // Enable/Disable Dolby Button this.CreateButton(out this.enableDolbyButton, string.Empty, this.EnableDolbyButtonClick); buttonPanel.Add(this.enableDolbyButton); // Profile Buttons this.CreateButton(out this.profileGameButton, WaveEngine.Common.Media.DolbyProfiles.GAME.ToString(), this.ProfileGameButtonClick); buttonPanel.Add(this.profileGameButton); this.CreateButton(out this.profileMovieButton, WaveEngine.Common.Media.DolbyProfiles.MOVIE.ToString(), this.ProfileMovieButtonClick); buttonPanel.Add(this.profileMovieButton); this.CreateButton(out this.profileMusicButton, WaveEngine.Common.Media.DolbyProfiles.MUSIC.ToString(), this.ProfileMusicButtonClick); buttonPanel.Add(this.profileMusicButton); this.CreateButton(out this.profileVoiceButton, WaveEngine.Common.Media.DolbyProfiles.VOICE.ToString(), this.ProfileVoiceButtonClick); buttonPanel.Add(this.profileVoiceButton); EntityManager.Add(buttonPanel); // Information Text infoPanel = new StackPanel(); infoPanel.Entity.AddComponent(new AnimationUI()); infoPanel.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom; infoPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center; infoPanel.Orientation = Orientation.Vertical; this.CreateLabel(out this.isDolbyEnabledTextBox, string.Empty); infoPanel.Add(this.isDolbyEnabledTextBox); this.CreateLabel(out this.selectedDolbyProfileTextBox, string.Empty); infoPanel.Add(this.selectedDolbyProfileTextBox); EntityManager.Add(infoPanel); // Sets text this.SetDolbyText(); //// Animations this.fadeIn = new SingleAnimation(0.0f, 1.0f, TimeSpan.FromSeconds(8), EasingFunctions.Cubic); }
/// <summary> /// Plays the specified music. /// </summary> /// <param name="music">The music.</param> public void Play(Audio.Music music, float volume = MUSIC_VOLUME) { this.musicPlayer.Volume = volume; this.musicPlayer.IsRepeat = true; if (this.currentMusic == null || this.currentMusic != music) { this.currentMusic = music; var musicInfo = new MusicInfo(this.GetSoundOrMusicPath(music)); this.musicPlayer.Play(musicInfo); } this.musicPlayer.Volume = volume; this.musicPlayer.IsRepeat = true; }
protected override void CreateScene() { FixedCamera2D camera2d = new FixedCamera2D("camera"); camera2d.BackgroundColor = Color.CornflowerBlue; EntityManager.Add(camera2d); // Background Entity background = new Entity() .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.LeftEdge, Y = WaveServices.ViewportManager.TopEdge, DrawOrder = 1f, XScale = (WaveServices.ViewportManager.ScreenWidth / 1024) / WaveServices.ViewportManager.RatioX, YScale = (WaveServices.ViewportManager.ScreenHeight / 768) / WaveServices.ViewportManager.RatioY, }) .AddComponent(new Sprite(Directories.Textures + "background.wpk")) .AddComponent(new SpriteRenderer(DefaultLayers.Opaque)); EntityManager.Add(background); // Player this.player = new Player("player", new Vector2(WaveServices.ViewportManager.VirtualWidth / 2, WaveServices.ViewportManager.VirtualHeight / 2)); EntityManager.Add(this.player); // Bullets pool this.bulletEmiter = new BulletEmiter("bulletEmiter"); EntityManager.Add(this.bulletEmiter); // Enemy pool this.enemyEmiter = new EnemyEmiter("EnemyEmiter"); EntityManager.Add(this.enemyEmiter); // Left Joystick RectangleF leftArea = new RectangleF(0, 0, WaveServices.ViewportManager.VirtualWidth / 2f, WaveServices.ViewportManager.VirtualHeight); this.leftJoystick = new Joystick("leftJoystick", leftArea); EntityManager.Add(this.leftJoystick); // Right Joystick RectangleF rightArea = new RectangleF(WaveServices.ViewportManager.VirtualWidth / 2, 0, WaveServices.ViewportManager.VirtualWidth / 2f, WaveServices.ViewportManager.VirtualHeight); this.rightJoystick = new Joystick("rightJoystick", rightArea); EntityManager.Add(this.rightJoystick); // Create Menu this.CreateMenuUI(); // Create GameOver this.CreateGameOver(); // CreateHUBUI this.hubPanel = new HubPanel(); EntityManager.Add(this.hubPanel); // Scene behavior this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate); this.AddSceneBehavior(new GamePlaySceneBehavior(), SceneBehavior.Order.PostUpdate); // Music this.musicInfo = new MusicInfo(Directories.Sounds + "ninjaMusic.mp3"); WaveServices.MusicPlayer.Play(this.musicInfo); WaveServices.MusicPlayer.Volume = 0.8f; WaveServices.MusicPlayer.IsRepeat = true; this.CurrentState = States.Menu; }
/// <summary> /// Creates a play music action. /// </summary> /// <param name="scene">The scene.</param> /// <param name="musicInfo">The music info to play</param> /// <returns>The action</returns> public static IGameAction CreatePlayMusicGameAction(this Scene scene, MusicInfo musicInfo) { return new PlayMusicGameAction(musicInfo, scene); }
public List<MusicInfo> GetAllMusics() { KeyValue result = this.Read(MusicInfo.KeyName); List<MusicInfo> returnValue = new List<MusicInfo>(); MusicInfo def; if (result != null) { foreach (var subChildKey in result.Children) { def = new MusicInfo(); def.CodedValue = int.Parse(subChildKey.Name); foreach (var itemSubChildKey in subChildKey.Children) { if (itemSubChildKey.Name.Equals(MusicInfo.SubKeyName, StringComparison.CurrentCultureIgnoreCase)) { def.Name = itemSubChildKey.Value; } else if (itemSubChildKey.Name.Equals(MusicInfo.SubKeyDesc, StringComparison.CurrentCultureIgnoreCase)) { def.Description = itemSubChildKey.Value; } } returnValue.Add(def); } } return returnValue; }
/// <summary> /// Initializes a new instance of the <see cref="PlayMusicGameAction" /> class. /// </summary> /// <param name="musicInfo">The music info to play</param> /// <param name="scene">The associated scene.</param> public PlayMusicGameAction(MusicInfo musicInfo, Scene scene = null) : base("PlayMusicGameAction" + instances++, scene) { this.musicInfo = musicInfo; }
protected override void Initialize() { base.Initialize(); this.input = WaveServices.Input; this.music = new MusicInfo(WaveContent.Assets.Music.music_mp3); this.FrameEvent(0, this.StartMusic); }
/// <summary> /// Initializes a new instance of the <see cref="PlayMusicGameAction" /> class. /// </summary> /// <param name="parent">The parent task.</param> /// <param name="musicInfo">The music info to play</param> public PlayMusicGameAction(IGameAction parent, MusicInfo musicInfo) : base(parent, "PlayMusicGameAction" + instances++) { this.musicInfo = musicInfo; }
/// <summary> /// And play a music action. /// </summary> /// <param name="parent">The parent.</param> /// <param name="musicInfo">The music info to play</param> /// <returns>The action</returns> public static IGameAction AndPlayMusic(this IGameAction parent, MusicInfo musicInfo) { return new PlayMusicGameAction(parent, musicInfo); }
private void StartMusic() { MusicInfo musicInfo = new MusicInfo(WaveContent.Assets.Music.Ozzed___A_Well_Worked_Analogy_mp3); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.MusicPlayer.Volume = 0.6f; WaveServices.MusicPlayer.Play(musicInfo); }