public SoundPlayer(CASCFile file) { InitializeComponent(); this.file = file; localPath = Path.Combine(Constants.TEMP_DIRECTORY, file.FullName); player = new ZPlay(); if (!File.Exists(localPath)) { EventManager.FileExtractComplete += OnFileExtractComplete; RunnerExtractItem extract = new RunnerExtractItem(file); runnerID = extract.runnerID; extract.Begin(); SetState("Extracting file..."); } else { ready = true; Play(); } UI_TrackTitle.Text = file.Name; Text = file.Name + " - W3DT"; UI_VolumeBar.Value = Program.Settings.SoundPlayerVolume; player.SetPlayerVolume(UI_VolumeBar.Value, UI_VolumeBar.Value); }
public int GetEchoParam(ref TEchoEffect[] EchoEffectArray) { int echoParam = ZPlay.zplay_GetEchoParam(this.objptr, (TEchoEffect[])null, 0); Array.Resize <TEchoEffect>(ref EchoEffectArray, echoParam); return(ZPlay.zplay_GetEchoParam(this.objptr, EchoEffectArray, echoParam)); }
public bool SetCallbackFunc( TCallbackFunc CallbackFunc, TCallbackMessage Messages, int UserData) { return(ZPlay.zplay_SetCallbackFunc(this.objptr, CallbackFunc, Messages, UserData) == 1); }
public int GetEqualizerPoints(ref int[] FreqPointArray) { int equalizerPoints = ZPlay.zplay_GetEqualizerPoints(this.objptr, (int[])null, 0); Array.Resize <int>(ref FreqPointArray, equalizerPoints); return(ZPlay.zplay_GetEqualizerPoints(this.objptr, FreqPointArray, equalizerPoints)); }
public bool MixChannels(bool Enable, uint LeftPercent, uint RightPercent) { if (Enable) { return(ZPlay.zplay_MixChannels(this.objptr, 1, LeftPercent, RightPercent) == 1); } return(ZPlay.zplay_MixChannels(this.objptr, 0, LeftPercent, RightPercent) == 1); }
public bool ReverseMode(bool Enable) { if (Enable) { return(ZPlay.zplay_ReverseMode(this.objptr, 1) == 1); } return(ZPlay.zplay_ReverseMode(this.objptr, 0) == 1); }
public int GetBitrate(bool Average) { if (Average) { return(ZPlay.zplay_GetBitrate(this.objptr, 1)); } return(ZPlay.zplay_GetBitrate(this.objptr, 0)); }
public bool EnableEcho(bool Enable) { if (Enable) { return(ZPlay.zplay_EnableEcho(this.objptr, 1) == 1); } return(ZPlay.zplay_EnableEcho(this.objptr, 0) == 1); }
public bool EnableEqualizer(bool Enable) { if (Enable) { return(ZPlay.zplay_EnableEqualizer(this.objptr, 1) == 1); } return(ZPlay.zplay_EnableEqualizer(this.objptr, 0) == 1); }
public int GetEqualizerParam(ref int PreAmpGain, ref int[] BandGain) { int nPreAmpGain = 0; int equalizerParam = ZPlay.zplay_GetEqualizerParam(this.objptr, ref nPreAmpGain, (int[])null, 0); Array.Resize <int>(ref BandGain, equalizerParam); return(ZPlay.zplay_GetEqualizerParam(this.objptr, ref PreAmpGain, BandGain, equalizerParam)); }
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 void GetStreamInfo(ref TStreamInfo info) { ZPlay.TStreamInfo_Internal pInfo = new ZPlay.TStreamInfo_Internal(); ZPlay.zplay_GetStreamInfoW(this.objptr, ref pInfo); info.Bitrate = pInfo.Bitrate; info.ChannelNumber = pInfo.ChannelNumber; info.SamplingRate = pInfo.SamplingRate; info.VBR = pInfo.VBR; info.Length = pInfo.Length; info.Description = Marshal.PtrToStringUni(pInfo.Description); }
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); }
public bool SlideVolume( TTimeFormat TimeFormatStart, ref TStreamTime TimeStart, int StartVolumeLeft, int StartVolumeRight, TTimeFormat TimeFormatEnd, ref TStreamTime TimeEnd, int EndVolumeLeft, int EndVolumeRight) { return(ZPlay.zplay_SlideVolume(this.objptr, TimeFormatStart, ref TimeStart, StartVolumeLeft, StartVolumeRight, TimeFormatEnd, ref TimeEnd, EndVolumeLeft, EndVolumeRight) == 1); }
public ZPlay() { this.objptr = ZPlay.zplay_CreateZPlay(); if (this.objptr == 0U) { throw new Exception("Can't create libZPlay interface."); } if (this.GetVersion() < 190) { throw new Exception("Need libZPlay.dll version 1.90 and above."); } }
public bool PlayLoop( TTimeFormat TimeFormatStart, ref TStreamTime StartPosition, TTimeFormat TimeFormatEnd, ref TStreamTime EndPosition, uint NumberOfCycles, bool ContinuePlaying) { uint fContinuePlaying = !ContinuePlaying ? 0U : 1U; return(ZPlay.zplay_PlayLoop(this.objptr, Convert.ToInt32((int)TimeFormatStart), ref StartPosition, Convert.ToInt32((int)TimeFormatEnd), ref EndPosition, NumberOfCycles, fContinuePlaying) == 1); }
public bool GetFFTData( int FFTPoints, TFFTWindow FFTWindow, ref int HarmonicNumber, ref int[] HarmonicFreq, ref int[] LeftAmplitude, ref int[] RightAmplitude, ref int[] LeftPhase, ref int[] RightPhase) { return(ZPlay.zplay_GetFFTData(this.objptr, FFTPoints, Convert.ToInt32((int)FFTWindow), ref HarmonicNumber, HarmonicFreq, LeftAmplitude, RightAmplitude, LeftPhase, RightPhase) == 1); }
public AudioControl(bool usesTimer) { this.player = new ZPlay(); this.info = new TStreamInfo(); this.status = new TStreamStatus(); this.time = new TStreamTime(); this.timer = usesTimer ? new System.Windows.Forms.Timer() : null; if (this.timer != null) { this.timer.Interval = 100; this.timer.Tick += new EventHandler(timer_Tick); } }
public bool GetWaveInInfo(uint Index, ref TWaveInInfo Info) { ZPlay.TWaveInInfo_Internal pWaveOutInfo = new ZPlay.TWaveInInfo_Internal(); if (ZPlay.zplay_GetWaveInInfoW(this.objptr, Index, ref pWaveOutInfo) == 0) { return(false); } Info.Channels = pWaveOutInfo.Channels; Info.DriverVersion = pWaveOutInfo.DriverVersion; Info.Formats = pWaveOutInfo.Formats; Info.ManufacturerID = pWaveOutInfo.ManufacturerID; Info.ProductID = pWaveOutInfo.ProductID; Info.ProductName = Marshal.PtrToStringUni(pWaveOutInfo.ProductName); return(true); }
public bool LoadID3(TID3Version Id3Version, ref TID3Info Info) { ZPlay.TID3Info_Internal pId3Info = new ZPlay.TID3Info_Internal(); if (ZPlay.zplay_LoadID3W(this.objptr, 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 StereoCut(bool Enable, bool OutputCenter, bool BassToSides) { int fOutputCenter = 0; int fBassToSides = 0; int fEnable = 0; if (OutputCenter) { fOutputCenter = 1; } if (BassToSides) { fBassToSides = 1; } if (Enable) { fEnable = 1; } return(ZPlay.zplay_StereoCut(this.objptr, fEnable, fOutputCenter, fBassToSides) == 1); }
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 int SetSettings(TSettingID SettingID, int Value) { return(ZPlay.zplay_SetSettings(this.objptr, (int)SettingID, Value)); }
public bool SetWaveInDevice(uint Index) { return(ZPlay.zplay_SetWaveInDevice(this.objptr, Index) == 1); }
private void Form1_Load(object sender, System.EventArgs e) { player = new ZPlay(); ReverseMode = false; Echo = false; int left = 0; int right = 0; player.GetMasterVolume(ref left, ref right); leftmastervolume.Value = 100 - left; rightmastervolume.Value = 100 - right; player.GetPlayerVolume(ref left, ref right); leftplayervolume.Value = 100 - left; rightplayervolume.Value = 100 - right; // callback CallbackFunc = new TCallbackFunc(MyCallbackFunc); player.SetCallbackFunc(CallbackFunc, (TCallbackMessage)((TCallbackMessage.MsgEnterVolumeSlideAsync | TCallbackMessage.MsgExitVolumeSlideAsync | TCallbackMessage.MsgStreamBufferDoneAsync | TCallbackMessage.MsgNextSongAsync )), 0); // echo TEchoEffect[] effect = new TEchoEffect[2]; effect[0].nLeftDelay = 500; effect[0].nLeftSrcVolume = 50; effect[0].nLeftEchoVolume = 30; effect[0].nRightDelay = 500; effect[0].nRightSrcVolume = 50; effect[0].nRightEchoVolume = 30; effect[1].nLeftDelay = 30; effect[1].nLeftSrcVolume = 50; effect[1].nLeftEchoVolume = 30; effect[1].nRightDelay = 30; effect[1].nRightSrcVolume = 50; effect[1].nRightEchoVolume = 30; player.SetEchoParam(ref effect, 2); /* TEchoEffect[] test1 = new TEchoEffect[2]; int n = player.GetEchoParam(ref test1); int i; for (i = 0; i < n; i++) { MessageBox.Show(test1[i].nLeftDelay.ToString()); } */ /* int[] EqPoints = new int[9] { 100, 200, 300, 1000, 2000, 3000, 5000, 7000, 12000 }; player.SetEqualizerPoints(ref EqPoints, 9); */ /* int[] testeq = new int[1]; int num = player.GetEqualizerPoints(ref testeq); int i1; for (i1 = 0; i1 < num; i1++) { MessageBox.Show(testeq[i1].ToString ()); } */ /* TWaveOutInfo WaveOutInfo = new TWaveOutInfo(); int WaveOutNum = player.EnumerateWaveOut(); uint i; for (i = 0; i < WaveOutNum; i++) { if (player.GetWaveOutInfo(i, ref WaveOutInfo)) { MessageBox.Show(WaveOutInfo.ProductName ); } } */ ComboBox1.SelectedIndex = 0; ComboBox2.SelectedIndex = 7; ComboBox3.SelectedIndex = 11; ComboBox4.SelectedIndex = 0; ComboBox5.SelectedIndex = 0; if (My.MyApplication.Application.CommandLineArgs.Count != 0) { player.Close(); if (LoadMode == 0) { if (!(player.OpenFile(My.MyApplication.Application.CommandLineArgs[0], TStreamFormat.sfAutodetect))) { MessageBox.Show(player.GetError(), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); } } showinfo(); player.StartPlayback(); } }
public int EnumerateWaveIn() { return(ZPlay.zplay_EnumerateWaveIn(this.objptr)); }
public void GetDynamicStreamLoad(ref TStreamLoadInfo StreamLoadInfo) { ZPlay.zplay_GetDynamicStreamLoad(this.objptr, ref StreamLoadInfo); }
public void GetStatus(ref TStreamStatus status) { ZPlay.zplay_GetStatus(this.objptr, ref status); }
public void Run() { zPlayBuffer = new CircularBlockBuffer(); zPlay = new ZPlay(); netConnection = new NetConnection(); netConnection.OnDisconnect += new NC_OnDisconnect(OnDisconnect); netConnection.OnTick += new NC_OnTick(NC_OnTick); try { int result = -1; // This is to connect to default vod app netConnection.Connect(new ServerLink("rtmp://localhost:1935/vod"), new NC_ResultCallBackConnect((sender, success) => { // Runs in RTMP thread (NOT MainThread!!!) Console.WriteLine("NetConnection.Connect => Success=" + success.ToString()); if (success) { result = 1; } else { result = 0; } })); // Wait until we are connected (needed because we run async) while (result == -1) { Thread.Sleep(100); } //while // Succes for connecting to rtmp server if (result == 1) { NetStream netStream = new NetStream(netConnection); netStream.OnStatus += new NS_OnStatus(NS_OnStatus); netStream.OnAudioPacket += new NC_OnMediaPacket(NC_OnMediaPacket); netStream.WaitForValidStream_ID(4000); // wait max 4 seconds for the netstream to become valid (for real test connect to event) // This is to get and MP3 stream netStream.Play("Comfort_Fit_-_03_-_Sorry.mp3", 0, -1, true); } Console.WriteLine("Press enter to stop."); Console.ReadLine(); } finally { // Cleanup if (netConnection != null) { netConnection.Close(); netConnection = null; } if (zPlay != null) { TStreamStatus status = new TStreamStatus(); zPlay.GetStatus(ref status); if (status.fPlay) { zPlay.StopPlayback(); } zPlay.Close(); zPlay = null; } if (zPlayBuffer != null) { zPlayBuffer = null; } } }
public void GetVUData(ref int LeftChannel, ref int RightChannel) { ZPlay.zplay_GetVUData(this.objptr, ref LeftChannel, ref RightChannel); }
private void PlaySound(string filename) { ZPlay player = new ZPlay(); // open file if (player.OpenFile(filename, TStreamFormat.sfAutodetect) == false) { MessageBox.Show(player.GetError()); return; } // start playing player.StartPlayback(); }
public int GetFFTGraphParam(TFFTGraphParamID ParamID) { return(ZPlay.zplay_GetFFTGraphParam(this.objptr, Convert.ToInt32((int)ParamID))); }
public bool SetFFTGraphParam(TFFTGraphParamID ParamID, int ParamValue) { return(ZPlay.zplay_SetFFTGraphParam(this.objptr, Convert.ToInt32((int)ParamID), ParamValue) == 1); }
public bool DrawFFTGraphOnHWND(IntPtr hwnd, int X, int Y, int Width, int Height) { return(ZPlay.zplay_DrawFFTGraphOnHWND(this.objptr, hwnd, X, Y, Width, Height) == 1); }
public int GetSettings(TSettingID SettingID) { return(ZPlay.zplay_GetSettings(this.objptr, (int)SettingID)); }
private void btn_Play_Click(object sender, EventArgs e) { ZPlay player = new ZPlay(); // open file if (player.OpenFile(txt_Sound.Text, TStreamFormat.sfAutodetect) == false) { MessageBox.Show(player.GetError()); return; } if (btn_Play.Text == "播放") { // start playing player.StartPlayback(); btn_Play.Text = "停止"; } else { player.StopPlayback(); btn_Play.Text = "播放"; } }
public void Dispose() { Stop(); player.Close(); plStatus = PlayerStatus.NoFileOpen; this.player = null; }