Author Topic: Direct bass : Vb.net (vb2008, vb2010, vb6, vc#, vc++, devC++, delphi, AutoIt)  (Read 183386 times)

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #100 on: 27 Jul '13 - 11:13 »
ScrollPosition function, this's change current position with mouse.

Using code BassChannelSetPosition, add trackBar volume and convert secound to byte.

Code: [Select]
public: bool ScrollPosition(int handle, int volPos)
{
return Bass::BASS_ChannelSetPosition(handle, Bass::BASS_ChannelSeconds2Bytes(handle, volPos), BASSMode::BASS_POS_BYTES);
}
    private: System::Void trackBar1_Scroll(System::Object^  sender, System::EventArgs^  e)
{
ScrollPosition(strm, trackBar1->Value);
}
}; //end class
} //end namespace
« Last Edit: 29 Jul '13 - 17:49 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #101 on: 27 Jul '13 - 11:56 »
Get code one touch button is Pause&Resume function

Code: [Select]
public: void PauseResume(int handle, Button ^ btnPause)
{
if (btnPause->Text == L"Pause")
{
Bass::BASS_ChannelPause(strm);
                btnPause->Text = L"Resume";
   }
else
{
Bass::BASS_ChannelPlay(strm, false);
                btnPause->Text = L"Pause";
}
}
   private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e)
{
PauseResume(strm, button4); //button4 is name of pause button to use.
}
}; //end class
} //end namespace
« Last Edit: 27 Jul '13 - 20:23 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #102 on: 27 Jul '13 - 13:03 »
Duration function, for post messageTime numer digi is totalTime and currentTime (00:00)

If selected selOption = 1 is using into total time duration. (event open button)
If selected selOption = 2 is using into current time duration. (event timer)

Code: [Select]
public: String ^ DurationTimeString(int handle, String ^ Fstring, int selOptin)
{
   String ^ Ret;
   if (selOptin == 1)
  {
   Ret = Utils::FixTimespan(MaxPosition(handle), Fstring);
  }
else
  {
   Ret = Utils::FixTimespan(CurrentPosition(handle), Fstring);  
  }
   return Ret;
}
« Last Edit: 27 Jul '13 - 22:21 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #103 on: 28 Jul '13 - 00:40 »
Spectrum Visualizer function

Code: [Select]
private: static Un4seen::Bass::Misc::Visuals ^ spec = gcnew Un4seen::Bass::Misc::Visuals;
     public: Bitmap ^ Spectrum(int handle, int picWidth, int picHeight, System::Drawing::Color ^ col1, System::Drawing::Color ^ col2, System::Drawing::Color ^ peakCol)
{
return  spec->CreateSpectrumLinePeak(handle, picWidth, picHeight, col1->DeepSkyBlue, col2->DeepSkyBlue, peakCol->White, System::Drawing::Color::Black, 4, 2, 1, 20, false, false, true);
}

Example:
Code: [Select]
private: static Color ^ specCol = gcnew Color;
   private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e)
{
label2->Text = DurationTimeString(strm, "mm:ss", 2);  
trackBar1->Value = CurrentPosition(strm);
pictureBox1->Image = Spectrum(strm, pictureBox1->Width, pictureBox1->Height, specCol->DeepSkyBlue, specCol->DeepSkyBlue, specCol->White);
Repeat(strm);
}
« Last Edit: 28 Jul '13 - 00:46 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #104 on: 28 Jul '13 - 00:55 »
PlayList function

Code: [Select]
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)
{
if (openFileDialog1->ShowDialog()== System::Windows::Forms::DialogResult::OK)
{
PlayList(openFileDialog1, listBox1);
}
}
public: void PlayList(OpenFileDialog^ fDlg, ListBox^ list)
{
for each (String^ files in fDlg->FileNames)
       {
       list->Items->Add(System::IO::Path::GetFileName(files));
       }
}
« Last Edit: 28 Jul '13 - 21:49 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #105 on: 28 Jul '13 - 20:41 »
NoneStop function

'itemList' is name of the listbox to use.
'btnPlay' is name of the button to use.
Add code into the timer.

Code: [Select]
public: void NoneStop(int handle, ListBox^ itemList, Button^ btnPlay)
       {
  if (CurrentPosition(handle)== MaxPosition(handle))
             {
try
    {
      itemList->SelectedIndex += 1;
      btnPlay->PerformClick();
    }
catch (System::Exception^ ex)
    {
      ex->Message->Empty;
                      itemList->SelectedIndex = 0;
                      btnPlay->PerformClick();
            }
      }
  else
             {
             }
       }
« Last Edit: 28 Jul '13 - 21:36 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #106 on: 28 Jul '13 - 21:28 »
SelectClearItemList function

Code: [Select]
public: void SelectItemClear(ListBox^ cList)

        {
cList->Items->RemoveAt(cList->SelectedIndex);
}
« Last Edit: 28 Jul '13 - 21:50 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net
« Reply #107 on: 29 Jul '13 - 17:11 »
Tip: Selected active play state.. stop or repeat ..using CheckBox component.

if checkbox = repeat.
if unchecked = stop.

Example:vb.net
Code: [Select]
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If CheckBox1.CheckState = CheckState.Checked Then
            If Bass.BASS_ChannelBytes2Seconds(stream, Bass.BASS_ChannelGetPosition(stream, BASSMode.BASS_POS_BYTES)) = Bass.BASS_ChannelBytes2Seconds(stream, Bass.BASS_ChannelGetLength(stream, BASSMode.BASS_POS_BYTES)) Then
                Bass.BASS_ChannelPlay(stream, True) 'Repeat when song end.
            End If
        Else
            If Bass.BASS_ChannelIsActive(stream) = BASSActive.BASS_ACTIVE_STOPPED Then
                Button3.PerformClick() 'This is name of stop button to use.
            End If                     'Stop when song end.
        End If
    End Sub
« Last Edit: 29 Jul '13 - 17:27 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #108 on: 29 Jul '13 - 18:46 »
Tip: Auto LoadFilesList ;D

Info:
This is copy files browse to song database and load items file from database to the playlist.
DoubleClick itemList to playing.

Discription:
References Bass.net.dll and add bass.dll into debug folder.
Object components to use:
1. Button1
2. ListBox1
3. TextBox1
4. OpenFileDialog1

Example:
Code: [Select]
Imports WindowsApplication1.SongListDataBase 'using namespace and class.
Imports Un4seen.Bass
Public Class Form1
    Inherits Form
    Private strm As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim device As Integer = Bass.BASS_GetDevice
        Dim freq As Integer = 44100
        BassNet.Registration("email", "serials")
        Try
            Bass.BASS_Init(device, freq, BASSInit.BASS_DEVICE_DEFAULT, Me.Handle.ToInt32)
        Catch ex As Exception
            MsgBox(Bass.BASS_ErrorGetCode)
            Me.Close()
        End Try
            LoadFilesList(ListBox1) 'auto load items file from song database to the playlist.
    End Sub

    Sub New()
        MyBase.New()
        InitializeComponent()
        Me.Text = "LoadSongList Sample"  'set object control properties.
        Me.CenterToScreen()
        Me.TopMost = True
        Button1.Text = "Open"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        CreateFilesDataBase(OpenFileDialog1, ListBox1)  'browse and load FilesList.
    End Sub 'get files browse to database and add items to the playlist.

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Bass.BASS_StreamFree(strm)                                         'set select item.
        TextBox1.Text = ListBox1.SelectedItem 'view SongName.
        strm = Bass.BASS_StreamCreateFile(String.Concat(SongListDataBase.db, "\", ListBox1.SelectedItem), 0, 0, BASSFlag.BASS_DEFAULT)
    End Sub

    Private Sub ListBox1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDoubleClick
        Bass.BASS_ChannelPlay(strm, True) 'doubleClick a item list to playing.
    End Sub  'doubleClick itemList to playing.
End Class
'=====================================================================
Public Class SongListDataBase
    Inherits Object
    Public Shared db As String = String.Concat(My.Computer.FileSystem.SpecialDirectories.MyMusic, "\", "SongDataBase")

    Public Shared Sub CreateFilesDataBase(ByVal f As OpenFileDialog, ByVal l As ListBox)
        f.FileName = Nothing
        f.Filter = "Song Files(*.mp3;*.wav)|*.mp3;*.wav|All Files(*.*)|*.*"
        f.Multiselect = True
        Dim files As String = Nothing
        If Not My.Computer.FileSystem.FileExists(db) Then My.Computer.FileSystem.CreateDirectory(db)
        If f.ShowDialog = DialogResult.OK Then
            Try
                For Each files In f.FileNames
                    My.Computer.FileSystem.CopyFile(files, String.Concat(db, "\", My.Computer.FileSystem.GetName(files)), True)
                Next files
            Catch ex As Exception When files = String.Empty
                MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error!")
                Exit Sub
            Finally
                For Each j As String In My.Computer.FileSystem.GetFiles(db, FileIO.SearchOption.SearchTopLevelOnly, "*.mp3", "*.wav")
                    l.Items.Add(System.IO.Path.GetFileName(j))
                Next j
                MsgBox("Load FilesItemsList Successes.", MsgBoxStyle.Information, "")
            End Try
        End If
    End Sub

    Public Shared Sub LoadFilesList(ByVal l As ListBox)
        Try
            For Each k As String In My.Computer.FileSystem.GetFiles(db, FileIO.SearchOption.SearchTopLevelOnly, "*.mp3", "*.wav")
                l.Items.Add(System.IO.Path.GetFileName(k))
            Next k
        Catch ex As Exception
        End Try
    End Sub
End Class
================================================================
Download: LoadFilesPlayList.net.dll Click here

Support: vb, C#, C++

Instruction:
Reference  LoadFilesPlayList.dll, After Imports LoadFilesPlayList.SongListDataBase.
Functions to use, same as with Example.
=============================================================
Example: using LoadFilesPlayList.dll in C#
=============================================================
Example: using LoadFilesPlayList.dll in C++

Instruction:
References Bass.net.dll, LoadFilesPlayList.dll and add bass.dll into debug folder.

Code: [Select]
#pragma once
namespace BassPlayer {
    using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace Un4seen::Bass;
using namespace LoadFilesPlayList;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
///          'Resource File Name' property for the managed resource compiler tool
///          associated with all .resx files this class depends on.  Otherwise,
///          the designers will not be able to interact properly with localized
///          resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
    public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
    this->CenterToScreen();
this->Text = L"C++ : Bass PlayList";
this->TopMost = true;
button1->Text = L"Open";
            button2->Text = L"Play";
            button3->Text = L"Stop";
}
    protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^  button1;
protected:
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Button^  button3;
private: System::Windows::Forms::ListBox^  listBox1;
private: System::Windows::Forms::OpenFileDialog^  openFileDialog1;

private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(12, 231);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(109, 231);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 23);
this->button2->TabIndex = 1;
this->button2->Text = L"button2";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// button3
//
this->button3->Location = System::Drawing::Point(206, 231);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(75, 23);
this->button3->TabIndex = 2;
this->button3->Text = L"button3";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// listBox1
//
this->listBox1->FormattingEnabled = true;
this->listBox1->Location = System::Drawing::Point(12, 12);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(268, 186);
this->listBox1->TabIndex = 3;
this->listBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listBox1_SelectedIndexChanged);
this->listBox1->DoubleClick += gcnew System::EventHandler(this, &Form1::listBox1_DoubleClick);
//
// openFileDialog1
//
this->openFileDialog1->FileName = L"openFileDialog1";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 266);
this->Controls->Add(this->listBox1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);

}
#pragma endregion   
private: int strm; //handle.
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)
{   
SongListDataBase::CreateFilesDataBase(openFileDialog1, listBox1); //add to open button.
}
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e)
{
try
{
Bass::BASS_Init(-1, 44100, BASSInit::BASS_DEVICE_DEFAULT, this->Handle);
}
catch (System::Exception^ ex)
{
MessageBox::Show(L" The debug folder has not bass.dll file.", "Error!",MessageBoxButtons::OK ,MessageBoxIcon::Error);
     ex->Message->Empty;
}
SongListDataBase::LoadFilesList(listBox1); //add to form load.
}
    private: System::Void listBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e)
{
Bass::BASS_StreamFree(strm);                       //create full path.
strm = Bass::BASS_StreamCreateFile(String::Concat(SongListDataBase::db, "\\", listBox1->SelectedItem), 0, 0, BASSFlag::BASS_DEFAULT);
}
    private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e)
{
if (strm != 0)
{
Bass::BASS_ChannelPlay(strm, true);
}
else
{
}
}
    private: System::Void listBox1_DoubleClick(System::Object^  sender, System::EventArgs^  e)
{
                         if (strm != 0)
{
         button2->PerformClick();
}
else
{
}
}
    private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e)
{
if (Bass::BASS_ChannelIsActive(strm)== BASSActive::BASS_ACTIVE_PLAYING)
{
Bass::BASS_ChannelStop(strm);
}
else
{
}
}   
};
}




 
« Last Edit: 30 Jul '13 - 22:04 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #109 on: 31 Jul '13 - 00:29 »
Mini Windows Media Player  ;D

when playing dsp zoom out.
when stopped dsp keep in.

Code: [Select]
Public Class Form1
    Inherits Form
    Private fdlg As OpenFileDialog
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "Windows Media Player"
        Me.CenterToScreen()
        Me.Height = 80
    End Sub
    Sub New()
        MyBase.New()
        InitializeComponent()
        Me.MaximizeBox = False
        Me.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
        fdlg = New OpenFileDialog
        fdlg.FileName = Nothing
        fdlg.Filter = "Song File(*.mp3)|*.mp3|All File(*.*)|*.*"
    End Sub
    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
        If fdlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            AxWindowsMediaPlayer1.URL = fdlg.FileName
        End If
    End Sub
    Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
        If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsPlaying Then
            Me.Height = 180
            Label1.Top = 129
        Else
            If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
                Me.Height = 80
                Label1.Top = 29
            End If
        End If
    End Sub
End Class

« Last Edit: 31 Jul '13 - 00:33 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #110 on: 31 Jul '13 - 10:44 »
Tip: Example Frequency to use is fft at to using in the spectrum visualizer. ;D

I'm try , it's balance and smooth (nice)


« Last Edit: 31 Jul '13 - 12:17 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #111 on: 28 Aug '13 - 21:38 »
Basic Programming : Bass Player into the AutoIt v3 (*.au3) ;D

Download : Bass AutoIt v3 Auto Installer (Please wait!)

Example:

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #112 on: 9 Dec '13 - 08:53 »
Basic Programming : Audio DJ Studio & Record and Editor ;D

Get AutoExitAboutForm Splash Screen
Get Player (audio & video and net stream)
Get Sound Record
Get EQualizer
Get Graphic Level & WaveForm and Spectrum
Get Effected  Tempo, Rate and Pitch
Get Edit WaveForm
---------------------------------------------------------------
Free Download : AudioDJStudio.net AutoSetup.exe Click here
Free Download : AudioSoundStudio.net AutoSetup.exe Click here

« Last Edit: 14 Dec '13 - 15:45 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #113 on: 11 Dec '13 - 17:35 »
Added Dll Component is AudioDjStudio.dll into the ToolBox.

Events and threads of the basic sound DJ player

1. On FormLoad add code.. InitSoundSystem(), Same as BASS Init
2. On Load song button add code.. LoadSound(), Same as BASS stream create file
3. On Playing buton add code.. PlaySound(), Same as BASS chanel play
4. On Stop button add code.. StopSound(), Same as  BASS chanel stop
5. On FormClosing add code..CloseSound(), Same as BASS free

Example:
Code: [Select]
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports AudioDjStudio

Public Class Form1
    Inherits System.Windows.Forms.Form

    Friend WithEvents btnLoad As New System.Windows.Forms.Button
    Friend WithEvents btnPlay As New System.Windows.Forms.Button
    Friend WithEvents btnStop As New System.Windows.Forms.Button
    Private fDlg As New System.Windows.Forms.OpenFileDialog

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim nOutputs As Int32 = AudioDjStudio1.GetOutputDevicesCount()
        If nOutputs = 0 Then
            MessageBox.Show("No output device detected and/or connected: the program will now close. If you are running under Windows Vista or higher, jack-sensing could disable an existing sound card if no speaker is physically connected so, if you are sure that a sound card is installed, try to plug a couple of speakers into the sound card before launching again this program.")
            Me.Close()
        End If     
        AudioDjStudio1.InitSoundSystem(1, 0, 0, 0, 0)
    End Sub

    Public Sub New()
        MyBase.New()
        Me.StartPosition = FormStartPosition.CenterScreen

        InitializeComponent()

        Me.Height = 70
        Me.Text = "DJ Player Sample"
        Me.MaximizeBox = False
        Me.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
        Me.ShowIcon = False

        fDlg.FileName = Nothing
        fDlg.Filter = "Supported Sounds (*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" & "*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" & "*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" & "*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda)|" & "*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" & "*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" & "*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" & "*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda|" & "MP3 and MP2 sounds (*.mp3;*.mp2)|*.mp3;*.mp2|" & "AAC and MP4 sounds (*.aac;*.mp4)|*.aac;*.mp4|" & "WAV sounds (*.wav)|*.wav|" & "OGG Vorbis sounds (*.ogg)|*.ogg|" & "AIFF sounds (*.aiff)|*.aiff|" & "Windows Media sounds (*.wma;*.wmv;*.asx;*.asf)|*.wma;*.wmv;*.asx;*.asf|" & "AC3 sounds (*.ac3)|*.ac3;|" & "ALAC sounds (*.m4a)|*.ac3;|" & "FLAC sounds (*.flac)|*.flac;|" & "WavPack sounds (*.wv)|*.wv;|" & "MOD music (*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3)|*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3|" & "CD tracks (*.cda)|*.cda|" & "All files (*.*)|*.*"

        btnLoad.Location = New System.Drawing.Point(20, 10)
        btnLoad.Text = "Load"
        btnLoad.Cursor = Cursors.Hand

        btnPlay.Location = New System.Drawing.Point(110, 10)
        btnPlay.Text = "Play"
        btnPlay.Cursor = Cursors.Hand

        btnStop.Location = New System.Drawing.Point(200, 10)
        btnStop.Text = "Stop"
        btnStop.Cursor = Cursors.Hand

        Me.Controls.AddRange(New Control() {btnLoad, btnPlay, btnStop})
    End Sub

    Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
        If fDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            If AudioDjStudio1.LoadSound(0, fDlg.FileName) <> enumErrorCodes.NOERROR Then
                MessageBox.Show(String.Concat("Cannot load file ", fDlg.FileName, ""))
            End If
            Me.Text = System.IO.Path.GetFileName(fDlg.FileName)
        End If
    End Sub

    Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
        AudioDjStudio1.PlaySound(0, True)
    End Sub

    Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
        AudioDjStudio1.StopSound(0)
    End Sub
End Class

« Last Edit: 11 Dec '13 - 18:50 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #114 on: 11 Dec '13 - 19:15 »
VUmeter LinePeak and Spectrum LinePeak, using.. Label 

Events and threads

For VUmeter LinePeak
On FormLoad add code.. DisplayVUMeter.Create(), DisplayVUMeter.set_ColorBackground() and DisplayVUMeter.Show()

For Spectrum LinePeak
On FormLoad add code.. DisplaySpectrum.Create(), DisplaySpectrum.set_ColorBackground() and DisplaySpectrum.Show()

Example:
Code: [Select]
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports AudioDjStudio

Public Class Form1
    Inherits System.Windows.Forms.Form

    Friend WithEvents btnLoad As New System.Windows.Forms.Button
    Friend WithEvents btnPlay As New System.Windows.Forms.Button
    Friend WithEvents btnStop As New System.Windows.Forms.Button
    Private lblVUmeter As New System.Windows.Forms.Label
    Private lblSpectrum As New System.Windows.Forms.Label
    Private fDlg As New System.Windows.Forms.OpenFileDialog

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim nOutputs As Int32 = AudioDjStudio1.GetOutputDevicesCount()
        If nOutputs = 0 Then
            MessageBox.Show("No output device detected and/or connected: the program will now close. If you are running under Windows Vista or higher, jack-sensing could disable an existing sound card if no speaker is physically connected so, if you are sure that a sound card is installed, try to plug a couple of speakers into the sound card before launching again this program.")
            Me.Close()
        End If
        AudioDjStudio1.InitSoundSystem(1, 0, 0, 0, 0)
    End Sub

    Public Sub New()
        MyBase.New()
        Me.StartPosition = FormStartPosition.CenterScreen

        InitializeComponent()

        Me.Height = 250
        Me.Text = "DJ Player Sample"
        Me.MaximizeBox = False
        Me.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
        Me.ShowIcon = False

        fDlg.FileName = Nothing
        fDlg.Filter = "Supported Sounds (*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" & "*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" & "*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" & "*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda)|" & "*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" & "*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" & "*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" & "*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda|" & "MP3 and MP2 sounds (*.mp3;*.mp2)|*.mp3;*.mp2|" & "AAC and MP4 sounds (*.aac;*.mp4)|*.aac;*.mp4|" & "WAV sounds (*.wav)|*.wav|" & "OGG Vorbis sounds (*.ogg)|*.ogg|" & "AIFF sounds (*.aiff)|*.aiff|" & "Windows Media sounds (*.wma;*.wmv;*.asx;*.asf)|*.wma;*.wmv;*.asx;*.asf|" & "AC3 sounds (*.ac3)|*.ac3;|" & "ALAC sounds (*.m4a)|*.ac3;|" & "FLAC sounds (*.flac)|*.flac;|" & "WavPack sounds (*.wv)|*.wv;|" & "MOD music (*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3)|*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3|" & "CD tracks (*.cda)|*.cda|" & "All files (*.*)|*.*"

        btnLoad.Location = New System.Drawing.Point(20, 10)
        btnLoad.Text = "Load"
        btnLoad.Cursor = Cursors.Hand

        btnPlay.Location = New System.Drawing.Point(110, 10)
        btnPlay.Text = "Play"
        btnPlay.Cursor = Cursors.Hand

        btnStop.Location = New System.Drawing.Point(200, 10)
        btnStop.Text = "Stop"
        btnStop.Cursor = Cursors.Hand

        lblVUmeter.SetBounds(10, 50, 30, 150)
        lblVUmeter.AutoSize = False
        lblVUmeter.BackColor = Color.Black

        lblSpectrum.SetBounds(50, 50, 228, 150)
        lblSpectrum.AutoSize = False
        lblSpectrum.BackColor = Color.Black

        Me.Controls.AddRange(New Control() {btnLoad, btnPlay, btnStop, lblVUmeter, lblSpectrum})
    End Sub

    Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
        If fDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            If AudioDjStudio1.LoadSound(0, fDlg.FileName) <> enumErrorCodes.NOERROR Then
                MessageBox.Show(String.Concat("Cannot load file ", fDlg.FileName, ""))
            End If
            Me.Text = System.IO.Path.GetFileName(fDlg.FileName)

            AudioDjStudio1.DisplayVUMeter.Create(0, lblVUmeter.Handle)
            AudioDjStudio1.DisplayVUMeter.set_ColorBackground(0, Color.Black)
            AudioDjStudio1.DisplayVUMeter.Show(0, True)

            AudioDjStudio1.DisplaySpectrum.Create(0, lblSpectrum.Handle)
            AudioDjStudio1.DisplaySpectrum.set_ColorBackground(0, Color.Black)
            AudioDjStudio1.DisplaySpectrum.Show(0, True)
        End If
    End Sub

    Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
        AudioDjStudio1.PlaySound(0, True)
    End Sub

    Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
        AudioDjStudio1.StopSound(0)
    End Sub
End Class
« Last Edit: 11 Dec '13 - 19:48 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #115 on: 11 Dec '13 - 20:05 »
Exit SplashScreen on FormLoad, Using code AutoItX3

Added this code on the FormShown

Code: [Select]
Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
        ExitSplash("Trial version reminder")
    End Sub

    Public Function ExitSplash(ByVal title As String) As String
        Dim oAutoIt As New AutoItX3Lib.AutoItX3
        Do Until CBool(oAutoIt.WinWaitClose("Trial version reminder")) : Loop
        Return title
    End Function

OR

Code: [Select]
Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
        Dim oAutoIt As New AutoItX3Lib.AutoItX3
        Do Until CBool(oAutoIt.WinWaitClose("Trial version reminder")) : Loop
    End Sub
« Last Edit: 12 Dec '13 - 18:59 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #116 on: 11 Dec '13 - 21:33 »
Creatting Graphic LED VUmeter and Graphic LED Spectrum Analyzer

Graphic LED VUmeter Function
Code: [Select]
Private Function CreateVuMeter(ByVal ctrlPosition As Label, ByVal nOrientation As enumGraphicBarOrientations) As IntPtr
        Dim hWnd As IntPtr = AudioDjStudio1.GraphicBarsManager.Create(Me.Handle, ctrlPosition.Left, ctrlPosition.Top, ctrlPosition.Width, ctrlPosition.Height)
        AudioDjStudio1.GraphicBarsManager.SetRange(hWnd, 0, 32767)
        Dim settings As GRAPHIC_BAR_SETTINGS = New GRAPHIC_BAR_SETTINGS()
        AudioDjStudio1.GraphicBarsManager.GetGraphicalSettings(hWnd, settings)
        settings.bAutomaticDrop = True
        settings.nOrientation = nOrientation
        AudioDjStudio1.GraphicBarsManager.SetGraphicalSettings(hWnd, settings)
        Return hWnd
    End Function

Graphic LED Spectrum Analyzer Function
Code: [Select]
Private Function CreateSpectrumBand(ByVal ctrlPosition As Label, ByVal nLeftPosition As Int32) As IntPtr
        Dim hWnd As IntPtr = AudioDjStudio1.GraphicBarsManager.Create(Me.Handle, nLeftPosition, ctrlPosition.Top, ctrlPosition.Width, ctrlPosition.Height)
        AudioDjStudio1.GraphicBarsManager.SetRange(hWnd, 0, 100)
        Dim settings As GRAPHIC_BAR_SETTINGS = New GRAPHIC_BAR_SETTINGS()
        AudioDjStudio1.GraphicBarsManager.GetGraphicalSettings(hWnd, settings)
        settings.bAutomaticDrop = False
        settings.nOrientation = enumGraphicBarOrientations.GRAPHIC_BAR_ORIENT_VERTICAL
        AudioDjStudio1.GraphicBarsManager.SetGraphicalSettings(hWnd, settings)
        Return hWnd
    End Function

Events and Threads

For LEDmeter threads to use on the FormLoad
- DisplayVUMeter.Create()
- hVU_L = CreateVuMeter()
- hVU_R = CreateVuMeter()

Events to use
- VUMeterValueChange()

Example:
Code: [Select]
Imports AudioDjStudio

Public Class Form1
    Friend WithEvents lblLEmeter_L As New Label
    Friend WithEvents lblLEDmeter_R As New Label
    Private lblFileName As New Label
    Private fDlg As New OpenFileDialog
    Private m_hWndLedMeterLeft As IntPtr = New IntPtr
    Private m_hWndLedMeterRight As IntPtr = New IntPtr

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AudioDjStudio1.InitSoundSystem(1, 0, 0, 0, 0)

        Me.TopMost = True
        Me.Location = New Point(My.Computer.Screen.WorkingArea.Width / 2 + 200, My.Computer.Screen.WorkingArea.Height / 2 + 200)
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None

        lblLEmeter_L.SetBounds(0, 128, 230, 12)
        lblLEmeter_L.AutoSize = False

        lblLEDmeter_R.SetBounds(0, 140, 230, 12)
        lblLEDmeter_R.AutoSize = False

        lblFileName.Location = New Point(0, 95)
        lblFileName.Font = New Font("Courier New", 10, FontStyle.Regular)
        lblFileName.ForeColor = Color.White
        lblFileName.AutoSize = True

        Me.Controls.AddRange(New Control() {lblLEmeter_L, lblLEDmeter_R, lblFileName})

        fDlg.FileName = Nothing
        fDlg.Filter = "Song File(*.mp3)|*.mp3"

        If fDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            lblFileName.Text = System.IO.Path.GetFileName(fDlg.FileName)
            If AudioDjStudio1.LoadSound(0, fDlg.FileName) = enumErrorCodes.NOERROR Then
                AudioDjStudio1.DisplayVUMeter.Create(0, lblLEmeter_L.Handle)
                AudioDjStudio1.DisplayVUMeter.Create(0, lblLEDmeter_R.Handle)
                m_hWndLedMeterLeft = CreateVuMeter(lblLEmeter_L, enumGraphicBarOrientations.GRAPHIC_BAR_ORIENT_VERTICAL)
                m_hWndLedMeterRight = CreateVuMeter(lblLEDmeter_R, enumGraphicBarOrientations.GRAPHIC_BAR_ORIENT_VERTICAL)
                AudioDjStudio1.PlaySound(0, False)
            End If
        Else
            Application.Exit()
        End If
    End Sub

    Private Sub AudioDjStudio1_VUMeterValueChange(ByVal sender As System.Object, ByVal e As AudioDjStudio.VUMeterValueChangeEventArgs) Handles AudioDjStudio1.VUMeterValueChange
        AudioDjStudio1.GraphicBarsManager.SetValue(m_hWndLedMeterLeft, e.nPeakLeft)
        AudioDjStudio1.GraphicBarsManager.SetValue(m_hWndLedMeterRight, e.nPeakRight)
    End Sub

    Private Function CreateVuMeter(ByVal ctrlPosition As Label, ByVal nOrientation As enumGraphicBarOrientations) As IntPtr
        Dim hWnd As IntPtr = AudioDjStudio1.GraphicBarsManager.Create(Me.Handle, ctrlPosition.Left, ctrlPosition.Top, ctrlPosition.Width, ctrlPosition.Height)
        AudioDjStudio1.GraphicBarsManager.SetRange(hWnd, 0, 32767)
        Dim settings As GRAPHIC_BAR_SETTINGS = New GRAPHIC_BAR_SETTINGS()
        AudioDjStudio1.GraphicBarsManager.GetGraphicalSettings(hWnd, settings)
        settings.bAutomaticDrop = True
        settings.nOrientation = enumGraphicBarOrientations.GRAPHIC_BAR_ORIENT_HORIZONTAL
        settings.colorBackground = System.Drawing.SystemColors.Control
        settings.bAutomaticDrop = True
        AudioDjStudio1.GraphicBarsManager.SetGraphicalSettings(hWnd, settings)
        Return hWnd
    End Function

    Private Sub AudioDjStudio1_SoundDone(ByVal sender As System.Object, ByVal e As AudioDjStudio.PlayerEventArgs) Handles AudioDjStudio1.SoundDone
        Me.Close()
    End Sub

    Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Escape Then Application.Exit()
    End Sub
End Class

LedSpectrum sample cannot post long code : Download  Click here

Using.. You can drag move graphic LedSpectrum to the other
           Because it has not the background

« Last Edit: 20 Dec '13 - 15:20 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #117 on: 14 Dec '13 - 00:10 »
Basic WaveForm  ;D

Threads and Events

On the FormLoad, code to use

- DisplayWaveform.Create()
- DisplayWaveform.Show()

Example:
Code: [Select]
Imports AudioDjStudio

Public Class Form1
    Private lblWaveForm As New Label
    Private fDlg As New OpenFileDialog
   
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CenterToScreen()
        Me.Size = New Size(416, 120)
        lblWaveForm.Dock = DockStyle.Fill
        lblWaveForm.AutoSize = False
        lblWaveForm.BackColor = Color.Black
        Me.Controls.Add(lblWaveForm)
        AudioDjStudio1.InitSoundSystem(1, 0, 0, 0, 0)
        fDlg.FileName = Nothing
        fDlg.Filter = "Supported Sounds (*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" & "*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" & "*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" & "*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda)|" & "*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" & "*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" & "*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" & "*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda|" & "MP3 and MP2 sounds (*.mp3;*.mp2)|*.mp3;*.mp2|" & "AAC and MP4 sounds (*.aac;*.mp4)|*.aac;*.mp4|" & "WAV sounds (*.wav)|*.wav|" & "OGG Vorbis sounds (*.ogg)|*.ogg|" & "AIFF sounds (*.aiff)|*.aiff|" & "Windows Media sounds (*.wma;*.wmv;*.asx;*.asf)|*.wma;*.wmv;*.asx;*.asf|" & "AC3 sounds (*.ac3)|*.ac3;|" & "ALAC sounds (*.m4a)|*.ac3;|" & "FLAC sounds (*.flac)|*.flac;|" & "WavPack sounds (*.wv)|*.wv;|" & "MOD music (*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3)|*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3|" & "CD tracks (*.cda)|*.cda|" & "All files (*.*)|*.*"
        If fDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            Me.Text = System.IO.Path.GetFileName(fDlg.FileName)
            If AudioDjStudio1.LoadSound(0, fDlg.FileName) = enumErrorCodes.NOERROR Then
                AudioDjStudio1.PlaySound(0)
            End If
        End If
        AudioDjStudio1.DisplayWaveform.Create(0, lblWaveForm.Handle)
        AudioDjStudio1.DisplayWaveform.Show(0, True)
    End Sub

    Private Sub AudioDjStudio1_SoundDone(ByVal sender As System.Object, ByVal e As AudioDjStudio.PlayerEventArgs) Handles AudioDjStudio1.SoundDone
        Me.Close()
    End Sub
End Class
« Last Edit: 14 Dec '13 - 11:20 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #118 on: 14 Dec '13 - 00:53 »
Advance WaveForm, You can read track sound and select playing track range of the waveform.

Example:
Long code, Cannot post  ;D Download: Click here
 
« Last Edit: 14 Dec '13 - 15:37 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #119 on: 14 Dec '13 - 11:18 »
EQualizer and effects speed is tempo, rate and pitch  ;D

Long code sample, Cannot post. Download Click here

-----------------------------------------------------------------------------------

Free Download: DesktopSpectrumSpeaker Click here

Using: When you do play song, spectrum will show graphic display on the desktop

http://www.dailymotion.com/video/x18jnoz_desktop-spectrum-sound-speakers_news

Free Download : Desktop Level Sound Speakers Click here

-----------------------------------------------------------------------------------

Desktop Internet Radio Stations :: FreeDownload: Click here

Info: Has many radio stations and you can search songs station

« Last Edit: 18 Dec '13 - 19:25 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #120 on: 20 Dec '13 - 15:14 »
It easy for programming with copy all code and paste to the form and run now ;D

Free download: Audio Sound Recorder Setup Click here
                      AudioDjStudio Setup Click here
                      Register AutoItX3 DLL Click here

Example: Easy Recorder
Code: [Select]
Imports AudioSoundRecorder 'reference .net AudioSoundRecorder dll component
Imports AutoItX3Lib 'reference com AutoItX3 DLL
Public Class Form1

    Private WithEvents btnStartRecord As New Button
    Private WithEvents btnStopRecord As New Button
    Private lblRecInfo As New Label
    Private oAutoIt As New AutoItX3
    Private saveFileDlg As New SaveFileDialog
    Private m_nCurrInputDevice As Int16 = 0  'sound driver
    Private m_nCurrInputChannel As Int16 = 1 'mono rec mix = 0 , stereo rec mix = 1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AudioSoundRecorder1.InitRecordingSystem() 'open working record
        Do Until CBool(oAutoIt.WinClose("Trial version reminder")) : Loop 'remove splash screen
    End Sub

    Public Sub New()
        InitializeComponent()
        Me.CenterToScreen()
        Me.Text = "Record Sample"
        Me.Size = New Size(220, 100)
        Me.MaximizeBox = False
        Me.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
        Me.ShowIcon = False
        btnStartRecord.Text = "Record"
        btnStopRecord.Text = "Stop"
        btnStartRecord.Location = New Point(20, 20)
        btnStopRecord.Location = New Point(120, 20)
        btnStartRecord.Cursor = Cursors.Hand
        btnStopRecord.Cursor = Cursors.Hand
        lblRecInfo.Text = "Size in bytes: 0"
        lblRecInfo.Location = New Point(45, 50)
        lblRecInfo.AutoSize = True
        Me.Controls.AddRange(New Control() {btnStartRecord, btnStopRecord, lblRecInfo})
        saveFileDlg.FileName = "song"
        saveFileDlg.Filter = "MP3 format (*.mp3)|*.mp3|All files (*.*)|*.*"
    End Sub

    Private Sub btnStartRecord_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnStartRecord.Click
        If saveFileDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            AudioSoundRecorder1.EncodeFormats.ForRecording = enumEncodingFormats.ENCODING_FORMAT_MP3 'selected convert sound type
            AudioSoundRecorder1.EncodeFormats.MP3.EncodeMode = enumMp3EncodeModes.MP3_ENCODE_CBR
            AudioSoundRecorder1.EncodeFormats.MP3.CBR = 1 'default = 0 , device = 1
            AudioSoundRecorder1.EncodeFormats.ResampleMode = enumResampleModes.RESAMPLE_MODE_NATIVE_FORMAT
            AudioSoundRecorder1.EncodeFormats.ResampleNativeFormat = 1 'default = 0 , device = 1
            AudioSoundRecorder1.SetInputDeviceChannelVolume(m_nCurrInputDevice, m_nCurrInputChannel, 1) 'set record mixer volume = 1
            AudioSoundRecorder1.StartFromDirectSoundDevice(m_nCurrInputDevice, m_nCurrInputChannel, saveFileDlg.FileName) 'start record and save
            lblRecInfo.Text = "Size in bytes: 0"
        End If
    End Sub

    Private Sub audioSoundRecorder1_RecordingSize(ByVal sender As Object, ByVal e As AudioSoundRecorder.RecordingSizeEventArgs) Handles AudioSoundRecorder1.RecordingSize
        lblRecInfo.Text = "Size in bytes: " & e.nDataSize.ToString() 'get record file size
    End Sub

    Private Sub btnStopRecord_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnStopRecord.Click
        AudioSoundRecorder1.Stop() 'stop record
    End Sub

    Private Sub AudioSoundRecorder1_RecordingStarted(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AudioSoundRecorder1.RecordingStarted
        btnStartRecord.Enabled = False 'Active if record is Startting
    End Sub

    Private Sub AudioSoundRecorder1_RecordingStopped(ByVal sender As System.Object, ByVal e As AudioSoundRecorder.RecordingStoppedEventArgs) Handles AudioSoundRecorder1.RecordingStopped
        btnStartRecord.Enabled = True 'Active if record is Stopped
    End Sub
End Class
« Last Edit: 1 Jan '14 - 04:57 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #121 on: 1 Jan '14 - 04:25 »
Advance sound recorder many format (both)

Get sample project Click here
« Last Edit: 4 Jan '14 - 23:30 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #122 on: 27 Jan '14 - 08:18 »
Sample Code : DirectX Audio & Video Playback ;D

You must References dll files is.. Microsoft.DirectX.dll and Microsoft.DirectX.AudioVideoPlayback.dll Click here

Method for sound player:

1. Open file using.. New Audio(add filename)
2. Get maximum sound position using.. Duration
3. Get current sound position using.. CurrentPosition
4. Scrolling sound position using.. CurrentPosition = Value of the TrackBar
5. ActiveplayState using.. State

I writting code , Easy for you , You copy and paste all code on the form only and run test now.

Example:
Code: [Select]
Imports System.Windows.Forms
Imports Microsoft.DirectX
'Imports Microsoft.DirectX.Direct3D
'Imports Microsoft.DirectX.DirectSound
'Imports Microsoft.DirectX.DirectPlay
Imports Microsoft.DirectX.AudioVideoPlayback

Public Class Form1
    Private openFiles As OpenFileDialog
    Private WithEvents playList As ListBox
    Private WithEvents openBtn As Button
    Private WithEvents playBtn As Button
    Private WithEvents pauseBtn As Button
    Private WithEvents stopBtn As Button
    Private lblDuration As Label
    Private lblStatus As Label
    Private lblPosition As Label
    Private WithEvents trackPosition As TrackBar
    Private WithEvents timePosition As Timer
    Private pl As Audio

    Public Sub New()
        MyBase.New()
        Me.StartPosition = FormStartPosition.CenterScreen
        InitializeComponent()
        openFiles = New OpenFileDialog
        openFiles.FileName = Nothing
        openFiles.Filter = "Audio Files(*.wav;*.mp3;*.cda)|*.wav;*.mp3;*.cda|All Files(*.*)|*.*"
        openFiles.Multiselect = True
        playList = New ListBox
        playList.SetBounds(5, 5, 280, 150)
        playList.HorizontalScrollbar = True
        openBtn = New Button
        openBtn.Text = "Open"
        openBtn.Width = 60
        openBtn.Location = New Point(10, 230)
        playBtn = New Button
        playBtn.Text = "Play"
        playBtn.Width = 60
        playBtn.Location = New Point(80, 230)
        pauseBtn = New Button
        pauseBtn.Text = "Pause"
        pauseBtn.Width = 60
        pauseBtn.Location = New Point(150, 230)
        stopBtn = New Button
        stopBtn.Text = "Stop"
        stopBtn.Width = 60
        stopBtn.Location = New Point(220, 230)
        lblDuration = New Label
        lblDuration.Text = "00:00"
        lblDuration.AutoSize = True
        lblDuration.Location = New Point(5, 165)
        lblStatus = New Label
        lblStatus.Text = "Stopped"
        lblStatus.AutoSize = True
        lblStatus.Location = New Point(120, 200)
        lblPosition = New Label
        lblPosition.Text = "00:00"
        lblPosition.AutoSize = True
        lblPosition.Location = New Point(250, 165)
        trackPosition = New TrackBar
        trackPosition.SetBounds(35, 165, 220, 20)
        trackPosition.AutoSize = False
        timePosition = New Timer
        Me.Controls.AddRange(New Control() {playList, openBtn, lblDuration, lblStatus, lblPosition, trackPosition, playBtn, pauseBtn, stopBtn})
    End Sub

    Private Sub openBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles openBtn.Click
        On Error Resume Next
        If openFiles.ShowDialog = Windows.Forms.DialogResult.OK Then
            For Each files As String In openFiles.FileNames
                playList.Items.Add(files)
            Next files
            If playList.Items.Count < 0 Then
                playList.SetSelected(0, False)
            Else
                playList.SetSelected(0, True)
            End If
            If Strings.InStr(pauseBtn.Text, "Resume") Then pauseBtn.Text = "Pause"
        End If
    End Sub

    Private Sub playList_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles playList.SelectedIndexChanged
        On Error Resume Next
        If playList.Text = String.Empty Then Return
        pl.StopWhenReady()
        lblStatus.Text = "Ready"
        timePosition.Enabled = False
        If Strings.InStr(pauseBtn.Text, "Resume") Then pauseBtn.Text = "Pause"
    End Sub

    Private Sub playList_DoubleClick(ByVal sender As Object, ByVal e As EventArgs) Handles playList.DoubleClick
        On Error Resume Next
        playBtn.PerformClick()
    End Sub

    Private Sub playBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles playBtn.Click
        On Error Resume Next
        If playList.Text = String.Empty Then Return
        playList_SelectedIndexChanged(sender, e)
        pl = New Audio(playList.SelectedItem)
        lblDuration.Text = DurationString(pl.Duration)
        trackPosition.Maximum = pl.Duration
        trackPosition.TickFrequency = trackPosition.Maximum / 100 * 10
        pl.Play()
        timePosition.Enabled = True
        If Strings.InStr(pauseBtn.Text, "Resume") Then pauseBtn.Text = "Pause"
    End Sub

    Private Sub timePosition_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles timePosition.Tick
        lblPosition.Text = PositionString(pl.CurrentPosition)
        trackPosition.Value = pl.CurrentPosition
        lblStatus.Text = pl.State.ToString
        Dim ind As Integer = playList.SelectedIndex
        Try
            If pl.CurrentPosition >= pl.Duration Then
                playList.SetSelected(ind + 1, True)
                playBtn.PerformClick()
            End If
        Catch ex As Exception
            playList.SetSelected(0, True)
            'if you wanted play NoneStop change code is..
            'timePosition.Enabled = False to playBtn.PerformClick()
            timePosition.Enabled = False
        End Try
    End Sub

    Private Sub trackPosition_Scroll(ByVal sender As Object, ByVal e As EventArgs) Handles trackPosition.Scroll
        On Error Resume Next
        pl.CurrentPosition = CDbl(trackPosition.Value)
    End Sub

    Private Sub pauseBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pauseBtn.Click
        On Error Resume Next
        If pl.State = StateFlags.Stopped Then Return
        Select Case pauseBtn.Text
            Case "Pause"
                pl.Pause()
                pauseBtn.Text = "Resume"
            Case Else
                pl.Play()
                pauseBtn.Text = "Pause"
        End Select
    End Sub

    Private Sub stopBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopBtn.Click
        On Error Resume Next
        pl.StopWhenReady()
        lblStatus.Text = pl.State.ToString
        timePosition.Enabled = False
        If Strings.InStr(pauseBtn.Text, "Resume") Then pauseBtn.Text = "Pause"
    End Sub

    Private ReadOnly Property DurationString(ByVal msDuration As Integer) As String
        Get
            Dim tSpan As TimeSpan
            tSpan = TimeSpan.FromSeconds(msDuration)
            Return Strings.Right(tSpan.ToString, 5)
        End Get
    End Property

    Private ReadOnly Property PositionString(ByVal msPosition As Integer) As String
        Get
            Dim tSpan As TimeSpan
            tSpan = TimeSpan.FromSeconds(msPosition)
            Return Strings.Right(tSpan.ToString, 5)
        End Get
    End Property
End Class
« Last Edit: 27 Jan '14 - 15:11 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #123 on: 6 Feb '14 - 11:39 »
Tip1: Set Selected item on the ListBox is not return select index-0 when the Listbox has items.
Tip:2 Repeat, PlayNoneStop and Sync Files Items List.

BassMod: Update code next time.
Code: [Select]
Public Module BASS
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Private Function BASS_Init(ByVal device As Integer, ByVal freq As Integer, ByVal flags As BASSInit, ByVal win As System.IntPtr, ByVal Guid As System.IntPtr) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", EntryPoint:="BASS_StreamCreateFile", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.[Auto], SetLastError:=False)> _
    Private Function BASS_StreamCreateFileMemory(<Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)> ByVal A_0 As Boolean, ByVal A_1 As System.IntPtr, ByVal A_2 As Long, ByVal A_3 As Long, ByVal A_4 As BASSFlag) As Integer
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", EntryPoint:="BASS_StreamCreateFile", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.[Auto], SetLastError:=False)> _
    Private Function BASS_StreamCreateFileUnicode(<Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)> ByVal A_0 As Boolean, <Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal A_1 As String, ByVal A_2 As Long, ByVal A_3 As Long, ByVal A_4 As BASSFlag) As Integer
    End Function
    Public Function BASS_Init(ByVal device As Integer, ByVal freq As Integer, ByVal flags As BASSInit, ByVal win As System.IntPtr) As Boolean
        Return BASS_Init(device, freq, flags, win, System.IntPtr.Zero)
    End Function
    Public Function BASS_StreamCreateFile(ByVal [file] As String, ByVal offset As Long, ByVal length As Long, ByVal flags As BASSFlag) As Integer
        flags = flags Or BASSFlag.BASS_UNICODE
        Return BASS_StreamCreateFileUnicode(False, [file], offset, length, flags)
    End Function
    Public Function BASS_StreamCreateFile(ByVal memory As System.IntPtr, ByVal offset As Long, ByVal length As Long, ByVal flags As BASSFlag) As Integer
        Return BASS_StreamCreateFileMemory(True, memory, offset, length, flags)
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Public Function BASS_StreamFree(ByVal handle As Integer) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Public Function BASS_ChannelPlay(ByVal handle As Integer, ByVal restart As Boolean) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Public Function BASS_ChannelPause(ByVal handle As Integer) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Public Function BASS_ChannelStop(ByVal handle As Integer) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Public Function BASS_Free() As Boolean
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Private Function BASS_ChannelGetLength(ByVal handle As Integer, ByVal mode As BASSMode) As Long
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Private Function BASS_ChannelGetPosition(ByVal handle As Integer, ByVal mode As BASSMode) As Long
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Private Function BASS_ChannelBytes2Seconds(ByVal handle As Integer, ByVal pos As Long) As Double
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Private Function BASS_ChannelSeconds2Bytes(ByVal handle As Integer, ByVal pos As Double) As Long
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Private Function BASS_ChannelSetPosition(ByVal A_0 As Integer, ByVal handle As Long, ByVal pos As BASSMode) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("bass.dll", SetLastError:=False)> _
    Private Function BASS_ChannelIsActive(ByVal handle As Integer) As BASSActive
    End Function
    Public Function BASS_ChannelResume(ByVal handle As Integer) As Boolean
        Return BASS_ChannelPlay(handle, False)
    End Function
    Private Function BASS_ChannelSetPosition(ByVal handle As Integer, ByVal pos As Long) As Boolean
        Return BASS_ChannelSetPosition(handle, pos, BASSMode.BASS_POS_BYTES)
    End Function
    Public Function BASS_GetVersion(ByVal filename As String) As String
        Dim v_Version As String = Nothing
        Try
            v_Version = FileVersionInfo.GetVersionInfo(filename).FileVersion
        Catch ex As Exception
            MsgBox("Error! No " & ex.Message & " file in the debug folder", MsgBoxStyle.Exclamation, "")
        End Try
        Return v_Version
    End Function
    Public Function BASS_GetVersion() As Boolean
        Return BASS_GetVersion("BASS.dll") = "2.4.8"
    End Function
    Public Function DurationString(ByVal handle As Integer) As String
        Dim span As System.TimeSpan
        span = TimeSpan.FromSeconds(BASS.BASS_ChannelBytes2Seconds(handle, BASS.BASS_ChannelGetLength(handle, BASSMode.BASS_POS_BYTES)))
        Return Strings.Right(Strings.Left(span.ToString, 8), 5)
    End Function
    Public Function PositionString(ByVal handle As Integer) As String
        Dim span As System.TimeSpan
        span = TimeSpan.FromSeconds(BASS.BASS_ChannelBytes2Seconds(handle, BASS.BASS_ChannelGetPosition(handle, BASSMode.BASS_POS_BYTES)))
        Return Strings.Right(Strings.Left(span.ToString, 8), 5)
    End Function
    Public Function MaxPosition(ByVal handle As Integer) As Double
        Return BASS_ChannelBytes2Seconds(handle, BASS_ChannelGetLength(handle, BASSMode.BASS_POS_BYTES))
    End Function
    Public Function ChangePosition(ByVal handle As Integer, ByVal seconds As Double) As Boolean
        Return BASS_ChannelSetPosition(handle, BASS_ChannelSeconds2Bytes(handle, seconds), BASSMode.BASS_POS_BYTES)
    End Function
    Public Function CurrentPosition(ByVal handle As Integer) As Double
        Return BASS_ChannelBytes2Seconds(handle, BASS_ChannelGetPosition(handle, BASSMode.BASS_POS_BYTES))
    End Function
    Public Function Status(ByVal handle As Integer) As String
        Dim v_status As String = Nothing
        Select Case BASS_ChannelIsActive(handle)
            Case BASSActive.BASS_ACTIVE_PAUSED
                v_status = "PAUSED"
            Case BASSActive.BASS_ACTIVE_PLAYING
                v_status = "PLAYING"
            Case BASSActive.BASS_ACTIVE_STALLED
                v_status = "STALLED"
            Case Else
                v_status = "STOPPED"
        End Select
        Return v_status
    End Function
    Public Function PlayNoneStop(ByVal handle As Integer, ByVal ctlList As ListBox, ByVal ctlPlayButton As Button) As Integer
        If BASS_ChannelGetPosition(handle, BASSMode.BASS_POS_BYTES) >= BASS_ChannelGetLength(handle, BASSMode.BASS_POS_BYTES) Then
            Dim ind As Integer = ctlList.SelectedIndex()
            Try
                ctlList.SetSelected(ind + 1, True)
                ctlPlayButton.PerformClick()
            Catch ex As Exception
                ctlList.SetSelected(0, True)
                ctlPlayButton.PerformClick()
            End Try
        Else
            Exit Function
        End If
    End Function
    Public Function Repeat(ByVal handle As Integer) As Boolean
        If BASS_ChannelGetPosition(handle, BASSMode.BASS_POS_BYTES) >= BASS_ChannelGetLength(handle, BASSMode.BASS_POS_BYTES) Then
            BASS_ChannelPlay(handle, True)
        Else
            Exit Function
        End If
    End Function
    Public Function ItemIndexChecked(ByVal ctlList As ListBox) As Integer
        If ctlList.SelectedIndex < 1 Then
            ctlList.SetSelected(0, True)
        End If
    End Function
    Public Function GetFilesPlayList(ByVal ctlList As ListBox, ByVal fDlg As OpenFileDialog) As Boolean
        On Error Resume Next
        Dim tempPath As String = My.Computer.FileSystem.SpecialDirectories.Temp
        Dim files As String() = fDlg.FileNames
        For i As Integer = 0 To UBound(files)
            My.Computer.FileSystem.CopyFile(files(i), tempPath & "\" & My.Computer.FileSystem.GetName(files(i)), True)
        Next i
        Dim items As String() = fDlg.SafeFileNames
        ctlList.BeginUpdate()
        For i As Integer = 0 To UBound(items)
            ctlList.Items.Add(System.IO.Path.GetFileName(items(i)))
        Next i
        ctlList.EndUpdate()
    End Function
    Public Function SetItemsPlayList(ByVal ctlList As ListBox, ByVal fDlg As OpenFileDialog) As Boolean
        On Error Resume Next
        If ctlList.Items.Count <= 0 Then Exit Function
        LoadItemsPlayList(ctlList)
        Dim items As String() = fDlg.SafeFileNames
        ctlList.BeginUpdate()
        For i As Integer = 0 To UBound(items)
            ctlList.Items.Add(System.IO.Path.GetFileName(items(i)))
        Next i
        ctlList.EndUpdate()
        ItemIndexChecked(ctlList)
    End Function
    Public Function LoadItemsPlayList(ByVal ctlList As ListBox) As Boolean
        On Error Resume Next
        For Each foundFiles As String In My.Computer.FileSystem.GetFiles(FileIO.SpecialDirectories.Temp, FileIO.SearchOption.SearchTopLevelOnly, "*.wav", "*.mp3")
            ctlList.Items.Add(System.IO.Path.GetFileName(foundFiles))
        Next foundFiles
        ctlList.SetSelected(ctlList.SelectedIndex() + 1, True)
    End Function
    Public Enum BASSInit
        BASS_DEVICE_DEFAULT = 0
    End Enum
    Public Enum BASSFlag
        BASS_DEFAULT = 0
        BASS_UNICODE = -2147483648
        BASS_MUSIC_LOOP = 4
    End Enum
    Public Enum BASSMode
        BASS_POS_BYTES = 0
        BASS_POS_MUSIC_ORDERS = 1
        BASS_POS_MIDI_TICK = 2
        BASS_MUSIC_POSRESET = 32768
        BASS_MUSIC_POSRESETEX = 4194304
        BASS_MIXER_NORAMPIN = 8388608
        BASS_MIDI_DECAYSEEK = 16384
    End Enum
    Public Enum BASSActive
        BASS_ACTIVE_STOPPED = 0
        BASS_ACTIVE_PLAYING = 1
        BASS_ACTIVE_STALLED = 2
        BASS_ACTIVE_PAUSED = 3
    End Enum
End Module
« Last Edit: 7 Feb '14 - 04:26 by sak2005 »

sak2005

  • Posts: 1007
Re: Direct bass : Vb.net (vb2008, vc#, vc++)
« Reply #124 on: 7 Feb '14 - 04:20 »
Example:
Code: [Select]
Public Class Form1
    Private strm As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CenterToScreen()
        Me.Text = "BASS PLAYER"
        If BASS.BASS_GetVersion() Then
            MsgBox("File OK :: Bass DLL Version: " & BASS.BASS_GetVersion("BASS.dll"), MsgBoxStyle.Information, "")
            BASS.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Me.Handle.ToInt32)
        Else
            MsgBox("Error! Bass Version", MsgBoxStyle.Exclamation, "")
            Application.Exit()
        End If
        With OpenFileDialog1
            .FileName = Nothing
            .Filter = "Audio Files(*.wav;*.mp3)|*.wav;*.mp3|All Files(*.*)|*.*"
            .Multiselect = True
        End With
        ListBox1.HorizontalScrollbar = True
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedToolWindow
        BASS.LoadItemsPlayList(ListBox1)
    End Sub
    Private Sub OpenButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenButton.Click
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            BASS.GetFilesPlayList(ListBox1, OpenFileDialog1)
            BASS.ItemIndexChecked(ListBox1)
        End If
    End Sub
    Private Sub PlayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayButton.Click
        Try
            BASS_StreamFree(strm)
            strm = BASS_StreamCreateFile(FileIO.SpecialDirectories.Temp & "\" & ListBox1.SelectedItem, 0, 0, BASSFlag.BASS_DEFAULT)
            If strm Then
                DurationLabel.Text = BASS.DurationString(strm)
                TrackBar1.Maximum = BASS.MaxPosition(strm)
                TrackBar1.TickFrequency = TrackBar1.Maximum / 100 * 10
                BASS_ChannelPlay(strm, False)
                Timer1.Enabled = True
            End If
        Catch ex As Exception
        End Try
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        StatusLabel.Text = BASS.Status(strm)
        TrackBar1.Value = BASS.CurrentPosition(strm)
        PositionLabel.Text = PositionString(strm)
        If RadioButton1.Checked = True Then
            BASS.PlayNoneStop(strm, ListBox1, PlayButton)
        ElseIf RadioButton2.Checked = True Then
            BASS.Repeat(strm)
        Else
            Exit Sub
        End If
    End Sub
    Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
        Try
            PlayButton.PerformClick()
        Catch ex As Exception
        End Try
    End Sub
    Private Sub PauseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PauseButton.Click
        If ListBox1.Items.Count <= 0 Then Return
        Select Case PauseButton.Text
            Case "Pause"
                BASS.BASS_ChannelPause(strm)
                PauseButton.Text = "Resume"
            Case Else
                BASS.BASS_ChannelResume(strm)
                PauseButton.Text = "Pause"
        End Select
    End Sub
    Private Sub StopButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StopButton.Click
        BASS.BASS_ChannelStop(strm)
    End Sub
    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        BASS.ChangePosition(strm, CDbl(TrackBar1.Value))
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        BASS.BASS_Free()
        Timer1.Stop()
    End Sub
    Private Sub ClearItemSelectedToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearItemSelectedToolStripMenuItem1.Click
        If ListBox1.Items.Count <= 0 Then Return
        ListBox1.Items.RemoveAt(ListBox1.SelectedIndex())
    End Sub
    Private Sub ClearItemsAllToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearItemsAllToolStripMenuItem1.Click
        If ListBox1.Items.Count <= 0 Then Return
        ListBox1.Items.Clear()
    End Sub
    Private Sub DeleteFileSelectedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteFileSelectedToolStripMenuItem.Click
        Try
            If ListBox1.Items.Count <= 0 Then Return
            If BASS.Status(strm) = "PLAYING" Then
                BASS.BASS_StreamFree(strm)
                Timer1.Stop()
            End If
        Catch ex As Exception
        End Try
        Try
            FileIO.FileSystem.DeleteFile(FileIO.SpecialDirectories.Temp & "\" & ListBox1.SelectedItem, FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.DoNothing)
            ListBox1.Items.RemoveAt(ListBox1.SelectedIndex())
        Catch ex As Exception
        End Try
    End Sub
    Private Sub DeleteFilesAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteFilesAllToolStripMenuItem.Click
        If ListBox1.Items.Count <= 0 Then Return
        If MsgBox("Do you wanted to delete all files?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, Nothing) = MsgBoxResult.Yes Then
            Timer1.Stop()
            BASS_StreamFree(strm)
            Try
                For Each items As String In ListBox1.Items
                    FileIO.FileSystem.DeleteFile(FileIO.SpecialDirectories.Temp & "\" & items, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)
                Next items
                ListBox1.Items.Clear()
            Catch ex As Exception
            End Try
        End If
    End Sub
End Class

« Last Edit: 7 Feb '14 - 06:04 by sak2005 »