public bool SetWaveOutFile(string FileName, TStreamFormat Format, bool fOutputToSoundcard) { int fOutputToSoundcard1 = 0; if (fOutputToSoundcard) { fOutputToSoundcard1 = 1; } return(ZPlay.zplay_SetWaveOutFileW(this.objptr, FileName, Convert.ToInt32((object)Format), fOutputToSoundcard1) == 1); }
public bool LoadFileID3Ex( string FileName, TStreamFormat Format, ref TID3InfoEx Info, bool fDecodePicture) { ZPlay.TID3InfoEx_Internal pId3Info = new ZPlay.TID3InfoEx_Internal(); if (ZPlay.zplay_LoadFileID3ExW(this.objptr, FileName, Convert.ToInt32((object)Format), ref pId3Info, 0) != 1) { return(false); } Info.Album = Marshal.PtrToStringUni(pId3Info.Album); Info.Artist = Marshal.PtrToStringUni(pId3Info.Artist); Info.Comment = Marshal.PtrToStringUni(pId3Info.Comment); Info.Genre = Marshal.PtrToStringUni(pId3Info.Genre); Info.Title = Marshal.PtrToStringUni(pId3Info.Title); Info.Track = Marshal.PtrToStringUni(pId3Info.Track); Info.Year = Marshal.PtrToStringUni(pId3Info.Year); Info.AlbumArtist = Marshal.PtrToStringUni(pId3Info.AlbumArtist); Info.Composer = Marshal.PtrToStringUni(pId3Info.Composer); Info.OriginalArtist = Marshal.PtrToStringUni(pId3Info.OriginalArtist); Info.Copyright = Marshal.PtrToStringUni(pId3Info.Copyright); Info.Encoder = Marshal.PtrToStringUni(pId3Info.Encoder); Info.Publisher = Marshal.PtrToStringUni(pId3Info.Publisher); Info.BPM = pId3Info.BPM; Info.Picture.PicturePresent = false; if (fDecodePicture) { try { if (pId3Info.PicturePresent == 1) { byte[] numArray = new byte[Convert.ToInt32(pId3Info.PictureDataSize) + 1]; Marshal.Copy(pId3Info.PictureData, numArray, 0, pId3Info.PictureDataSize); Info.Picture.BitStream = new MemoryStream(); Info.Picture.BitStream.Write(numArray, 0, pId3Info.PictureDataSize); Info.Picture.Bitmap = new Bitmap((Stream)Info.Picture.BitStream); Info.Picture.PictureType = pId3Info.PictureType; Info.Picture.Description = Marshal.PtrToStringUni(pId3Info.Description); Info.Picture.PicturePresent = true; } else { Info.Picture.Bitmap = new Bitmap(1, 1); } return(true); } catch { Info.Picture.PicturePresent = false; } } return(false); }
private void _play(string filePath, TStreamFormat format = TStreamFormat.sfAutodetect) { bool ret = _zPlayer.OpenFile(filePath, format); if (!ret) { MessageBox.Show(_zPlayer.GetError()); return; } ret = _zPlayer.StartPlayback(); if (!ret) { MessageBox.Show(_zPlayer.GetError()); return; } HasPlayingMusic = true; }
public bool LoadFileID3( string FileName, TStreamFormat Format, TID3Version Id3Version, ref TID3Info Info) { ZPlay.TID3Info_Internal pId3Info = new ZPlay.TID3Info_Internal(); if (ZPlay.zplay_LoadFileID3W(this.objptr, FileName, Convert.ToInt32((object)Format), Convert.ToInt32((int)Id3Version), ref pId3Info) != 1) { return(false); } Info.Album = Marshal.PtrToStringUni(pId3Info.Album); Info.Artist = Marshal.PtrToStringUni(pId3Info.Artist); Info.Comment = Marshal.PtrToStringUni(pId3Info.Comment); Info.Genre = Marshal.PtrToStringUni(pId3Info.Genre); Info.Title = Marshal.PtrToStringUni(pId3Info.Title); Info.Track = Marshal.PtrToStringUni(pId3Info.Track); Info.Year = Marshal.PtrToStringUni(pId3Info.Year); return(true); }
public bool OpenStream( bool Buffered, bool Dynamic, ref byte[] MemStream, uint StreamSize, TStreamFormat nFormat) { int fBuffered = 0; int fManaged = 0; if (Buffered) { fBuffered = 1; } if (Dynamic) { fManaged = 1; } return(ZPlay.zplay_OpenStream(this.objptr, fBuffered, fManaged, MemStream, StreamSize, Convert.ToInt32((object)nFormat)) == 1); }
public bool LoadFileID3(string FileName, TStreamFormat Format, TID3Version Id3Version, ref TID3Info Info);
public bool OpenStream(bool Buffered, bool Dynamic, ref byte[] MemStream, uint StreamSize, TStreamFormat nFormat);
public bool AddFile(string FileName, TStreamFormat Format);
public bool SetWaveOutFile(string FileName, TStreamFormat Format, bool fOutputToSoundcard);
public bool LoadFileID3Ex(string FileName, TStreamFormat Format, ref TID3InfoEx Info, bool fDecodePicture);
public bool LoadFileID3(string FileName, TStreamFormat Format, TID3Version Id3Version, ref TID3Info Info) { if (zplay_LoadFileID3W(objptr, FileName, System.Convert.ToInt32(Format), System.Convert.ToInt32((int)(Id3Version)), ref Info) == 1) { return true; } else { return false; } }
public bool AddFile(string FileName, TStreamFormat Format) { return zplay_AddFileW(objptr, FileName, System.Convert.ToInt32(Format)) == 1; }
public bool AddFile(string FileName, TStreamFormat Format) { return(ZPlay.zplay_AddFileW(this.objptr, FileName, Convert.ToInt32((object)Format)) == 1); }
public int DetectFileBPM(string FileName, TStreamFormat Format, TBPMDetectionMethod Method);
public bool LoadFileID3(string FileName, TStreamFormat Format, TID3Version Id3Version, ref TID3Info Info) { TID3Info_Internal tmp = new TID3Info_Internal(); if (zplay_LoadFileID3W(objptr, FileName, System.Convert.ToInt32(Format), System.Convert.ToInt32((int)(Id3Version)), ref tmp) == 1) { Info.Album = Marshal.PtrToStringUni(tmp.Album); Info.Artist = Marshal.PtrToStringUni(tmp.Artist); Info.Comment = Marshal.PtrToStringUni(tmp.Comment); Info.Genre = Marshal.PtrToStringUni(tmp.Genre); Info.Title = Marshal.PtrToStringUni(tmp.Title); Info.Track = Marshal.PtrToStringUni(tmp.Track); Info.Year = Marshal.PtrToStringUni(tmp.Year); return true; } else { return false; } }
public int DetectFileBPM(string FileName, TStreamFormat Format, TBPMDetectionMethod Method) { return zplay_DetectFileBPMW(objptr, FileName, System.Convert.ToInt32(Format), System.Convert.ToUInt32(Method)); }
public bool SetWaveOutFile(string FileName, TStreamFormat Format, bool fOutputToSoundcard) { int s = 0; if (fOutputToSoundcard) s = 1; return zplay_SetWaveOutFileW(objptr, FileName, System.Convert.ToInt32(Format), s) == 1; }
public bool OpenStream(bool Buffered, bool Dynamic, ref byte[] MemStream, uint StreamSize, TStreamFormat nFormat) { int b = 0; int m = 0; if (Buffered) { b = 1; } if (Dynamic) { m = 1; } return zplay_OpenStream(objptr, b, m, MemStream, StreamSize, System.Convert.ToInt32(nFormat)) == 1; }
public int DetectFileBPM(string FileName, TStreamFormat Format, TBPMDetectionMethod Method) { return(ZPlay.zplay_DetectFileBPMW(this.objptr, FileName, Convert.ToInt32((object)Format), Convert.ToUInt32((object)Method))); }
public bool LoadFileID3Ex(string FileName, TStreamFormat Format, ref TID3InfoEx Info, bool fDecodePicture) { TID3InfoEx_Internal tmp = new TID3InfoEx_Internal(); if (zplay_LoadFileID3ExW(objptr, FileName, System.Convert.ToInt32(Format), ref tmp, 0) == 1) { Info.Album = Marshal.PtrToStringUni(tmp.Album); Info.Artist = Marshal.PtrToStringUni(tmp.Artist); Info.Comment = Marshal.PtrToStringUni(tmp.Comment); Info.Genre = Marshal.PtrToStringUni(tmp.Genre); Info.Title = Marshal.PtrToStringUni(tmp.Title); Info.Track = Marshal.PtrToStringUni(tmp.Track); Info.Year = Marshal.PtrToStringUni(tmp.Year); Info.AlbumArtist = Marshal.PtrToStringUni(tmp.AlbumArtist); Info.Composer = Marshal.PtrToStringUni(tmp.Composer); Info.OriginalArtist = Marshal.PtrToStringUni(tmp.OriginalArtist); Info.Copyright = Marshal.PtrToStringUni(tmp.Copyright); Info.Encoder = Marshal.PtrToStringUni(tmp.Encoder); Info.Publisher = Marshal.PtrToStringUni(tmp.Publisher); Info.BPM = tmp.BPM; Info.Picture.PicturePresent = false; if (fDecodePicture) { try { if (tmp.PicturePresent == 1) { byte[] stream_data = new byte[System.Convert.ToInt32(tmp.PictureDataSize) + 1]; Marshal.Copy(tmp.PictureData, stream_data, 0, tmp.PictureDataSize); Info.Picture.BitStream = new System.IO.MemoryStream(); Info.Picture.BitStream.Write(stream_data, 0, tmp.PictureDataSize); Info.Picture.Bitmap = new Bitmap(Info.Picture.BitStream); Info.Picture.PictureType = tmp.PictureType; Info.Picture.Description = Marshal.PtrToStringUni(tmp.Description); Info.Picture.PicturePresent = true; } else { Info.Picture.Bitmap = new Bitmap(1, 1); } return true; } catch { Info.Picture.PicturePresent = false; } } } else { return false; } return false; }
public bool OpenFile(string FileName, TStreamFormat Format);
private void OpenFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e) { TStreamFormat format = player.GetFileFormat(OpenFileDialog1.FileName); if (LoadMode == 0) { player.Close(); if (! (player.OpenFile(OpenFileDialog1.FileName, TStreamFormat.sfAutodetect ))) { MessageBox.Show(player.GetError(), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (LoadMode == 1) { player.Close(); System.IO.FileInfo fInfo = new System.IO.FileInfo(OpenFileDialog1.FileName); long numBytes = fInfo.Length; System.IO.FileStream fStream = new System.IO.FileStream(OpenFileDialog1.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read); System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); byte[] stream_data = null; stream_data = br.ReadBytes(System.Convert.ToInt32((int)(numBytes))); if (!(player.OpenStream(true, false, ref stream_data, System.Convert.ToUInt32(numBytes), format))) { MessageBox.Show(player.GetError(), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); } br.Close(); fStream.Close(); } else if (LoadMode == 2) { player.Close(); BufferCounter = 0; System.IO.FileInfo fInfo = new System.IO.FileInfo(OpenFileDialog1.FileName); uint numBytes = System.Convert.ToUInt32(fInfo.Length); if (br != null) { br.Close(); } if (fStream != null) { fStream.Close(); } br = null; fStream = null; fStream = new System.IO.FileStream(OpenFileDialog1.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read); br = new System.IO.BinaryReader(fStream); byte[] stream_data = null; uint small_chunk = 0; small_chunk = System.Convert.ToUInt32(Math.Min(100000, numBytes)); // read small chunk of data stream_data = br.ReadBytes(System.Convert.ToInt32((int)(small_chunk))); // open stream if (! (player.OpenStream(true, true, ref stream_data, System.Convert.ToUInt32(stream_data.Length), format))) { MessageBox.Show(player.GetError(), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); } // read more data and push into stream stream_data = br.ReadBytes(System.Convert.ToInt32((int)(small_chunk))); player.PushDataToStream(ref stream_data, System.Convert.ToUInt32(stream_data.Length)); } else if (LoadMode == 3) { if (!(player.AddFile(OpenFileDialog1.FileName, TStreamFormat.sfAutodetect))) { MessageBox.Show(player.GetError(), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } showinfo(); player.StartPlayback(); }