Lamine player

Description

Lire des fichiers:
- Audio (mp3, rm, ...)
- Video (wmv, ...)

Enregistrer du son.

Avec des DLL existante:

"Interop.NCTVideoConverter2Lib.dll"
"Interop.RealAudioObjects.dll"
"AxInterop.RealAudioObjects.dll"
"Homa_Audio.dll"
"Microsoft.DirectX.dll"
"Microsoft.DirectX.AudioVideoPlayback.dll"

Source / Exemple :


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
using System.Xml;
using Homa_Audio;
using RealAudioObjects;
using Microsoft.DirectX;
using System.Net;

namespace Real_Player
{
    public partial class Real_Player : Form
    {
        //déclaration des variables
        private Video vp;
        private Audio ap;
        private AxRealAudioObjects.AxRealAudio rp = new AxRealAudioObjects.AxRealAudio();
        private string type;
        public List<string> album = new List<string>();
        private int current;
        private XmlDocument doc = new XmlDocument();
        private HVolume hv = new HVolume();
        private HAudio ra = new HAudio();
        private bool enregistrement = false;
        private double tmp_enr = 0;
        private string Lecture_Etat;
        private string Son_Etat;
        private string Fichier_En_Cours = "";
        private String length = "00:00:00";
        public Real_Player()
        {
            InitializeComponent();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void F_Play_Pause()
        {
            if ((Lecture_Etat == "Lecture en pause") | (Lecture_Etat == "Lecture arrêtée"))
            {
                PlayFile();
            }
            else
            {
                PauseFile();
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void F_Reculer()
        {
            try
            {
                if (type == "V")
                {
                    vp.CurrentPosition = vp.CurrentPosition - 10;
                }
                else if (type == "A")
                {
                    ap.CurrentPosition = ap.CurrentPosition - 10;
                }
                else if (type == "R")
                {
                    rp.SetPosition(rp.GetPosition() - 10000);
                }
            }
            catch
            {
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void F_Avancer()
        {
            try
            {
                if (trackBar1.Maximum == 0)
                {
                    SetTrackBar();
                }
                if (type == "V")
                {
                    vp.CurrentPosition += 10;
                }
                else if (type == "A")
                {
                    ap.CurrentPosition += 10;
                }
                else if (type == "R")
                {
                    rp.SetPosition(rp.GetPosition() + 10000);
                }
            }
            catch
            {
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void F_Enregistremenr()
        {
            if (enregistrement == false)
            {
                SF.ShowDialog();
                int i = SF.FileName.CompareTo("*.wav");
                if (i != 0)
                {
                    enregistrement = true;
                    ra.Record(SF.FileName);
                    SF.FileName = "*.wav";
                }
            }
            else
            {
                enregistrement = false;
                ra.StopRecording();
                Action_en_cours.Text = "Enregitrement terminé :" + ConvertSecondeToHMS(tmp_enr);
                MessageBox.Show(Action_en_cours.Text, "Eregistrement");
                tmp_enr = 0;
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void F_Type_Lecture()
        {
        if (serbtn.Checked)
            {
                serbtn.Checked = false;
                Aleatoire.Checked = true;
            }
            else
            {
                serbtn.Checked = true;
                Aleatoire.Checked = false;
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void F_Augmenter_Volume()
        {
            if (vt.Value <= 9)
            {
                if (!mute.Checked) hv.Volume += 1;
                vt.Value += 1;
                Vol.Text = "Vol : " + Convert.ToString(vt.Value);
            }
            else MessageBox.Show("Volume Maximum","Attention");
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void F_Diminuer_Volume()
        {
            if (vt.Value >= 1)
            {
                if (!mute.Checked) hv.Volume -= 1;
                vt.Value -= 1;
                Vol.Text = "Vol : " + Convert.ToString(vt.Value);
            }
            else MessageBox.Show("Volume Minimum", "Attention");
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void button3_Click(object sender, EventArgs e)//bouton play
        {
            F_Play_Pause();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void F_Muet()
        {
        if (mute.Checked)
            {
                hv.Volume = 0;
                Son_Etat = ": Muet";
            }
            else
            {
                hv.Volume = vt.Value;
                Son_Etat = "";
            }
        }
        /****************************************************************************************/
        /**************************Bouton Parcourir**********************************************/
        private void Parcourir_Click(object sender, EventArgs e)//bouton parcourir
        {
            OF.ShowDialog();
            if (!(OF.FileName=="Choisissez un fichier"))
            {
                album.RemoveRange(0, album.Count);
                album.AddRange(OF.FileNames);
                try
                {
                    LoadFile(album[0]);
                    Fichier_En_Cours = System.IO.Path.GetFileName(album[0]);
                    FillList();
                    SetTrackBar();
                    PlayFile();
                    OF.FileName = "Choisissez un fichier";
                    ac.Text = "Coisissez un album";
                }
                catch
                {
                    MessageBox.Show("Le fichier selectionné n'est pas pris en charge", "Attention");
                }
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Plein_ecran_Click(object sender, EventArgs e)//clic boutton de plein ecran
        {
            try
            {
                if (vp.Fullscreen == false) vp.Fullscreen = true;
            }
            catch
            {
                MessageBox.Show("Impossible d'activer le Plein Ecran, verifiez que le fichier en cours de lecture est de Type vidéo", "Attention");
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void E_F_Screen(object sender, KeyPressEventArgs e)//Appuyer une touche => arret du plein ecran
        {
            try
            { 
                vp.Fullscreen = false;
            }
            catch
            { 
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Pause_Click(object sender, EventArgs e)//clic boutton de pause
        {
            PauseFile();
        }
        /****************************************************************************************/
        private void Arrêter_Click(object sender, EventArgs e)//clic boutton d'arret
        {
            StopFile();
        }
        /****************************************************************************************/
        /********************************Fonction de chargement du fichier***********************/
        void LoadFile(string Path)
        {
            StopFile();
            ap = null;// vider le fichier audio
            vp = null;// vider le fichier video
            this.Controls.Add(rp);/// vider le fichier RP
            rp.Visible = false;/// cacher l'apparition du fichier RP
            this.p1.Hide();
            this.p2.Show();
            try
                {
                    vp = Video.FromFile(Path);
                    this.p2.Hide();
                    this.p1.Show();
                    vp.Owner = this.p1;
                    if (this.WindowState == FormWindowState.Maximized)
                    {
                        p1.Width = 880;
                        p1.Height = 560;
                    }
                    else
                    {
                        p1.Width = 367;
                        p1.Height = 267;
                    }
                    type = "V";
                    vp.Fullscreen = false;
                }
                catch
                {
                    try
                    {
                        ap = Audio.FromFile(Path);
                        type = "A";
                    }
                    catch
                    {
                        try
                        {
                            rp.SetSource(Path);
                            type = "R";
                        }
                            catch
                            {
                                MessageBox.Show("Merci de bien choisir un fichier compatible", "Attention!");
                                type = "N";
                            }
                    }
                }
            SetLength();
        }
        
        /****************************************************************************************/
        /********************************Fonction de lecture du fichier**************************/
        void PlayFile()
        {
            if (type == "V")
            {
                vp.Play();
            }
            else if (type == "A")
            {
                ap.Play();
            }
            else if (type == "R")
            {
                rp.DoPlay();
            }
            Lecture_Etat ="Lecture en cours";
        }
        /****************************************************************************************/
        /***************************Fonction de mise en pause de la lecture**********************/
        void PauseFile()
        {
            if (type == "V")
            {
                vp.Pause();
            }
            else if (type == "A")
            {
                ap.Pause();
            }
            else if (type == "R")
            {
                rp.DoPause();
            }
            Lecture_Etat = "Lecture en pause";
        }
        /****************************************************************************************/
        /********************************Fonction d'arret du fichier*****************************/
        void StopFile()
        {
            if (type == "V")
            {
                vp.Stop();
            }
            else if (type == "A")
            {
                ap.Stop();
            }
            else if (type == "R")
            {
                rp.DoStop();
            }
            Lecture_Etat = "Lecture arrêtée";
        }
        /****************************************************************************************/
        /*******************Fonction de definition de la taille du fichier***********************/
        void SetTrackBar()
        {
            if (type == "V")
            {
                trackBar1.Maximum = Convert.ToInt32(vp.Duration);
            }
            else if (type == "A")
            {
                trackBar1.Maximum = Convert.ToInt32(ap.Duration);
            }
            else if (type == "R")
            {
                trackBar1.Maximum = Convert.ToInt32(rp.GetLength());
            }
        }
        /****************************************************************************************/
        /********************Fonction de definition de la position actuelle**********************/
        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            if (type == "V")
            {
                vp.CurrentPosition = trackBar1.Value;
            }
            else if (type == "A")
            {
                ap.CurrentPosition = trackBar1.Value;
            }
            else if (type == "R")
            {
                rp.SetPosition(trackBar1.Value);
            }
        }
        /****************************************************************************************/
        /*******************Fonction qui s'execute chaque une seconde****************************/
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (trackBar1.Maximum == 0)
                {
                    SetTrackBar();
                }
                if (type == "V")
                {
                    trackBar1.Value = Convert.ToInt32(vp.CurrentPosition);
                }
                else if (type == "A")
                {
                    trackBar1.Value = Convert.ToInt32(ap.CurrentPosition);
                }
                else if (type == "R")
                {
                    trackBar1.Value = Convert.ToInt32(rp.GetPosition());
                }
                SetPosition();
                //remplissage de la bare d'etat
                if (enregistrement == false)
                {
                    if (!(Fichier_En_Cours=="")) Action_en_cours.Text = System.IO.Path.GetFileName(Fichier_En_Cours) + " :" + Lecture_Etat + Son_Etat; 
                }
                else
                {
                    tmp_enr += 1;
                    Action_en_cours.Text = "Enregistrement depuis : " + ConvertSecondeToHMS(tmp_enr);
                }
            }
            catch
            {
            }
            
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Avancer_Click(object sender, EventArgs e)//bouton avancer
        {
            F_Avancer();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Reculer_Click(object sender, EventArgs e)//bouton reculer
        {
            F_Reculer();
        }
        /****************************************************************************************/
        /********************fonction de remplissage de la iste de l'albume**********************/
        void FillList()
        {
            pl.Items.Clear();
            for (int i = 0; i < album.Count; i++)
            {
                string FileName;
                FileName = System.IO.Path.GetFileName(album[i]);
                pl.Items.Add(FileName);
            }
        }
        /****************************************************************************************/
        /*******************Fonction de changement de fichier dans l'albume**********************/
        private void pl_SelectedIndexChanged(object sender, EventArgs e)
        {
            current = pl.SelectedIndex;
            PlayCurrent();
            Fichier_En_Cours = album[current];
            
        }
        /****************************************************************************************/

        /*******************Fonction qui choisie le fichier en cours*****************************/
        void PlayCurrent()
        {
            LoadFile(album[current]);
            SetTrackBar();
            PlayFile();
        }
        /****************************************************************************************/
        /*****************************Fonction qui choisie le Type de lecture********************/
        void SetNext()
        {
            if (serbtn.Checked)
            {
                if (current == album.Count - 1)
                {
                    current = 0;
                }
                else
                {
                    current = current + 1;
                }
            }
            else
            {
                Random rnd = new Random();
                current = rnd.Next(0, album.Count - 1);
            }
            pl.SelectedIndex = current;
            PlayCurrent();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Gerrer_les_Albumes_Click(object sender, EventArgs e)//bouton des albumes
        {
                albums frm = new albums();
                frm.album.AddRange(album);
                frm.ShowDialog();
                if (frm.DialogResult == DialogResult.OK)
                {
                    Mise_A_Jour_ComBox();
                    album = frm.album;
                    FillList();
                    try
                    {
                        LoadFile(album[0]);
                        Fichier_En_Cours = System.IO.Path.GetFileName(album[0]);
                        SetTrackBar();
                        PlayFile();
                    }
                    catch
                    {
                        MessageBox.Show("l'album selectionné est vide", "Attention");
                    }

                }
                else
                {
                    Mise_A_Jour_ComBox();
                }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Real_Player_Load(object sender, EventArgs e)
        {
            try
            {
                doc.Load(Application.StartupPath + "//albums.xml");
                XmlNode albumsnd = doc["albums"];
                XmlNode alnd = albumsnd.FirstChild;
                while (alnd != null)
                {
                    ac.Items.Add(alnd.Name);
                    alnd = alnd.NextSibling;
                }
                hv.Volume = 5;
            }
            catch
            {
                MessageBox.Show("Une erreur s'est produite lors du chargement des albums", "Erreur");
            }
        }
        /****************************************************************************************/
        /*********************************Si on est a la fin du fichier**************************/
        private void trackBar1_ValueChanged(object sender, EventArgs e)
        {
            int last;
            if (type == "R")
            {
                last = trackBar1.Maximum - 1000;
            }
            else
            {
                last = trackBar1.Maximum - 1;
            }
            if (trackBar1.Value > last)
            {
                SetNext();
            }
        }
        /****************************************************************************************/
        /********************************chargement des albums***********************************/
        void ReadAlbume(string albumname)
        {
            try
            {
                doc.Load(Application.StartupPath + "//albums.xml");
                XmlNode filend = doc["albums"][albumname].FirstChild;
                album.Clear();
                while (filend != null)
                {
                    album.Add(filend.InnerText);
                    filend = filend.NextSibling;
                }
                FillList();
            }
            catch
            {
                MessageBox.Show("Une erreur s'est produite lors du chargement des albums", "Erreur");
            }
        }
        /****************************************************************************************/
        /*************************Choix de l'album dans le ComBox********************************/
        private void ac_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            ReadAlbume(ac.Text);
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Mise_A_Jour_ComBox()
        {
            ac.Items.Clear();
            try
            {
                doc.Load(Application.StartupPath + "//albums.xml");
                XmlNode albumsnd = doc["albums"];
                XmlNode alnd = albumsnd.FirstChild;
                while (alnd != null)
                {
                    ac.Items.Add(alnd.Name);
                    alnd = alnd.NextSibling;
                }
            }
            catch
            {
                MessageBox.Show("Une erreur s'est produite lors de la mise à jour des albums", "Erreur");
            }
        }
        /****************************************************************************************/
        /*******************************reglage du son*******************************************/
        private void vt_Scroll(object sender, EventArgs e)
        {
            if (!mute.Checked)
            {
                hv.Volume = vt.Value;
                Vol.Text = "Vol : " + Convert.ToString(hv.Volume);
            }
        }
        /****************************************************************************************/
        /*******************************Muet*****************************************************/
        private void mute_CheckedChanged(object sender, EventArgs e)
        {
            F_Muet();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Enregistrement(object sender, EventArgs e)
        {
            F_Enregistremenr();
        }
        /****************************************************************************************/
        /********************actions lors de la reduction de la fenetre**************************/
        private void Real_Player_Resize(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.Hide();
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.Show();
            this.WindowState = FormWindowState.Normal;
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void quiterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Environment.Exit(0);
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void arreterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StopFile();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void lireToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!(Lecture_Etat == "Lecture en cours"))
            {
                PlayFile();
            }
            else
            {
                PauseFile();
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void pauseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PauseFile();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void avancerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (trackBar1.Maximum == 0)
                {
                    SetTrackBar();
                }
                if (type == "V")
                {
                    vp.CurrentPosition += 10;
                }
                else if (type == "A")
                {
                    ap.CurrentPosition += 10;
                }
                else if (type == "R")
                {
                    rp.SetPosition(rp.GetPosition() + 10000);
                }
            }
            catch
            {
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void reculerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (type == "V")
                {
                    vp.CurrentPosition = vp.CurrentPosition - 10;
                }
                else if (type == "A")
                {
                    ap.CurrentPosition = ap.CurrentPosition - 10;
                }
                else if (type == "R")
                {
                    rp.SetPosition(rp.GetPosition() - 10000);
                }
            }
            catch
            {
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void enregistrerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (enregistrement==false)
            {
                SF.ShowDialog();
                int i = SF.FileName.CompareTo("*.wav");
                if (i != 0)
                {
                    ra.Record(SF.FileName);
                    enregistrement = true;
                    SF.FileName = "*.wav";
                }
            }
            else
            {
                ra.StopRecording();
                enregistrement = false;
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void albumsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            albums frm = new albums();
            frm.album.AddRange(album);
            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                Mise_A_Jour_ComBox();
                album = frm.album;
                FillList();
                try
                {
                    LoadFile(album[0]);
                    SetTrackBar();
                    PlayFile();
                }
                catch
                {
                    MessageBox.Show("l'album selectionné est vide", "Attention");
                }

            }
            else
            {
                Mise_A_Jour_ComBox();
            }
        }

        private void muetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (mute.Checked)
            {
                hv.Volume = 0;
                mute.Checked = false;
            }
            else
            {
                hv.Volume = vt.Value;
                mute.Checked = true;
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void augmenterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (hv.Volume <= 9)
            {
                hv.Volume += 1;
                vt.Value += 1;
                Vol.Text = "Vol : " + Convert.ToString(hv.Volume);
            }
            else MessageBox.Show("Volume Maximum", "Attention");
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void diminuerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (hv.Volume >= 1)
            {
                hv.Volume -= 1;
                vt.Value -= 1;
                Vol.Text = "Vol : " + Convert.ToString(hv.Volume);
            }
            else MessageBox.Show("Volume Minimum", "Attention");
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void pleinEcranToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (vp.Fullscreen == false) vp.Fullscreen = true;
            }
            catch
            {
                MessageBox.Show("Impossible d'activer le Plein Ecran, verifiez que le fichier en cours de lecture est de Type vidéo", "Attention");
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void ouvrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OF.ShowDialog();
            int i = OF.FileName.CompareTo("Choisissez un fichier");
            if (i != 0)
            {
                album.AddRange(OF.FileNames);
                try
                {
                    LoadFile(album[0]);
                    FillList();
                    SetTrackBar();
                    PlayFile();
                }
                catch
                {
                    MessageBox.Show("Le fichier selectionné n'est pas pris en charge", "Attention");
                }
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void SetLength()
        {
            try
            {
                int h = 0;
                int m = 0;
                int s = 0;
                string h_string;
                string m_string;
                string s_string;
                if (type == "V")
                {
                    h = Convert.ToInt32(Math.Floor(vp.Duration / (3600)));
                    m = Convert.ToInt32(Math.Floor((vp.Duration - (3600 * h))/60));
                    s = Convert.ToInt32(vp.Duration - (3600 * h) - (60 * m));
                }
                else if (type == "A")
                {
                    h = Convert.ToInt32(Math.Floor(ap.Duration / (3600)));
                    m = Convert.ToInt32(Math.Floor((ap.Duration - (3600 * h)) / 60));
                    s = Convert.ToInt32(ap.Duration - (3600 * h) - (60 * m));
                }
                else if (type == "R")
                {
                    h = Convert.ToInt32(Math.Floor(Convert.ToDouble(rp.GetLength() / 3600000)));
                    m = Convert.ToInt32(Math.Floor((Convert.ToDouble(rp.GetLength() / 1000) - (3600 * h)) / 60));
                    s = Convert.ToInt32((rp.GetLength() / 1000) - (3600 * h) - (60 * m));
                    
                }
                if (h < 10) h_string = "0" + Convert.ToString(h); else h_string = Convert.ToString(h);
                if (m < 10) m_string = "0" + Convert.ToString(m); else m_string = Convert.ToString(m);
                if (s < 10) s_string = "0" + Convert.ToString(s); else s_string = Convert.ToString(s);
                length = h_string + ":" + m_string + ":" + s_string;
            }
            catch
            {
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        void SetPosition()
        {
            try
            {
                int h = 0;
                int m = 0;
                int s = 0;
                string h_string;
                string m_string;
                string s_string;
                if (type == "V")
                {
                    h = Convert.ToInt32(Math.Floor(vp.CurrentPosition / 3600));
                    m = Convert.ToInt32(Math.Floor((vp.CurrentPosition - (3600 * h)) / 60));
                    s = Convert.ToInt32(vp.CurrentPosition - (3600 * h) - (60 * m));
                }
                else if (type == "A")
                {
                    h = Convert.ToInt32(Math.Floor(ap.CurrentPosition / 3600));
                    m = Convert.ToInt32(Math.Floor((ap.CurrentPosition - (3600 * h)) / 60));
                    s = Convert.ToInt32(ap.CurrentPosition - (3600 * h) - (60 * m));
                }
                else if (type == "R")
                {
                    h = Convert.ToInt32(Math.Floor(Convert.ToDouble(rp.GetPosition() / 3600000)));
                    m = Convert.ToInt32(Math.Floor((Convert.ToDouble(rp.GetPosition() / 1000) - (3600 * h)) / 60));
                    s = Convert.ToInt32((rp.GetPosition() / 1000) - (3600 * h) - (60 * m));
                }
                if (h < 10) h_string = "0" + Convert.ToString(h); else h_string = Convert.ToString(h);
                if (m < 10) m_string = "0" + Convert.ToString(m); else m_string = Convert.ToString(m);
                if (s < 10) s_string = "0" + Convert.ToString(s); else s_string = Convert.ToString(s);
                len.Text = h_string + ":" + m_string + ":" + s_string + " / " + length;
            }
            catch
            {
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            OF.ShowDialog();
            int i = OF.FileName.CompareTo("Choisissez un fichier");
            if (i != 0)
            {
                album.AddRange(OF.FileNames);
                try
                {
                    LoadFile(album[0]);
                    FillList();
                    SetTrackBar();
                    PlayFile();
                }
                catch
                {
                    MessageBox.Show("Le fichier selectionné n'est pas pris en charge", "Attention");
                }
            }
        }

        private void toolStripMenuItem12_Click(object sender, EventArgs e)
        {
            System.Environment.Exit(0);
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem7_Click(object sender, EventArgs e)
        {
            try
            {
                if (vp.Fullscreen == false) vp.Fullscreen = true;
            }
            catch
            {
                MessageBox.Show("Impossible d'activer le Plein Ecran, verifiez que le fichier en cours de lecture est de Type vidéo", "Attention");
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            F_Play_Pause();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            PauseFile();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            StopFile();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem5_Click(object sender, EventArgs e)
        {
            F_Avancer();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem6_Click(object sender, EventArgs e)
        {
            F_Reculer();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem9_Click(object sender, EventArgs e)
        {
            F_Augmenter_Volume();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem10_Click(object sender, EventArgs e)
        {
            F_Diminuer_Volume();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem11_Click(object sender, EventArgs e)
        {
            mute.Checked = !mute.Checked;
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem14_Click(object sender, EventArgs e)
        {
            if (enregistrement == false)
            {
                SF.ShowDialog();
                int i = SF.FileName.CompareTo("*.wav");
                if (i != 0)
                {
                    ra.Record(SF.FileName);
                    enregistrement = true;
                    SF.FileName = "*.wav";
                }
            }
            else
            {
                ra.StopRecording();
                enregistrement = false;
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        string ConvertSecondeToHMS(double x)
        {
            int h = 0;
            int m = 0;
            int s = 0;
            string h_string;
            string m_string;
            string s_string;
                
                h = Convert.ToInt32(Math.Floor(x / 3600));
                m = Convert.ToInt32(Math.Floor((x - (3600 * h))/60));
                s = Convert.ToInt32(x - (3600 * h) - (60 * m));
                if (h < 10) h_string = "0" + Convert.ToString(h); else h_string = Convert.ToString(h);
                if (m < 10) m_string = "0" + Convert.ToString(m); else m_string = Convert.ToString(m);
                if (s < 10) s_string = "0" + Convert.ToString(s); else s_string = Convert.ToString(s);
                return(h_string + ":" + m_string + ":" + s_string);
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void Action_en_cours_TextChanged(object sender, EventArgs e)
        {

        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void gérrerLesAlbumesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            albums frm = new albums();
            frm.album.AddRange(album);
            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                Mise_A_Jour_ComBox();
                album = frm.album;
                FillList();
                try
                {
                    LoadFile(album[0]);
                    SetTrackBar();
                    PlayFile();
                }
                catch
                {
                    MessageBox.Show("l'album selectionné est vide", "Attention");
                }

            }
            else
            {
                Mise_A_Jour_ComBox();
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void laminePlayerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a  Réalsisé par:  \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\n \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a  Ouadjaout Lamine  \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\n  \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a  Le : 23/03/2008  \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\n          Je remerci dieu que j'ai pu réaliser ce lecteur, après ça je remerci y85.fox 'HOUMAT EL-NAHDA' ;)", "A propos de Lamine Player");
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void p1_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (vp.Fullscreen == false) vp.Fullscreen = true;
            }
            catch
            {
                MessageBox.Show("Impossible d'activer le Plein Ecran, verifiez que le fichier en cours de lecture est de Type vidéo", "Attention");
            }
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void normalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            F_Type_Lecture();
        }
        /****************************************************************************************/
        /****************************************************************************************/
        private void toolStripMenuItem3_Click_1(object sender, EventArgs e)
        {
            F_Type_Lecture();
        }

        private void p2_Paint(object sender, PaintEventArgs e)
        {

        }
        /****************************************************************************************/
        /****************************************************************************************/
    }
}

Conclusion :


Merci pour Houmat El Nahda

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.