20 May '13 - 10:00 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 [2] 3 4 5  All
  Reply  |  Print  
Author Topic: Direct bass : Vb.net  (Read 8233 times)
sak2005
Posts: 82


« Reply #20 on: 3 Jul '12 - 08:35 »
Reply with quoteQuote

Tip: Winmm 'mciSendString' MediaControl Lib Function

Browse lib file MediaControl.dll from MyPlayer_vb sample project add to referents of new project at create.

Add buttons. For open, play and stop) on the form.

Writting code now.

Example:
Public Class Form1
    Private media As New MediaControl.AudioPlayer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fdlg As New OpenFileDialog
        fdlg.FileName = ""
        fdlg.Filter = "Song file(*.mp3)|*.mp3"
        If fdlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            media.Close()
            media.Open(fdlg.FileName)
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        media.Play()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        media.Stop()
    End Sub

    Public Sub New()
        InitializeComponent()
        Me.CenterToScreen()
        Button1.Text = "Open"
        Button2.Text = "Play"
        Button3.Text = "Stop"
    End Sub
End Class
============================================================
Sample2: Out of Referents

If not referents dll file. You must add dll file in to a debug folder of new project. And writting function code on Class.

Get start : Add new buttons is Button1, Button2 and Button3 on the form.
               Add new labels is Label1, Label2, Label3 and Label4 on the form.
               Add TrackBar1 and TrackBar2 on the form.
               Add ToolTip and Timer1 on the form.
Writting code now...

Public Class Form1
    'Call soundMedia DLLs
    Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal strCommand As String, ByVal strReturn As System.Text.StringBuilder, ByVal iReturnLength As Integer, ByVal hwndCallback As System.IntPtr) As Long
    Public Sub New()
        MyBase.New()
        InitializeComponent()
        fgProperties()
    End Sub
    '----------------------- Function mciMedia Control ----------------------------------------------------------
    Dim fdlg As OpenFileDialog = New OpenFileDialog()
    Public Sub SoundOpen()
        fdlg.FileName = ""
        fdlg.Filter = "Mpeg file(*.mp3)|*.mp3"
        If fdlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            SoundClose()
            Dim strCommand As String = String.Concat("open """, fdlg.FileName, """ type mpegvideo alias mpegfile")
            mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
            Dim lBuff = New System.Text.StringBuilder(128)
            Dim lCommand As String = "status mpegfile length"
            mciSendString(lCommand, lBuff, lBuff.Capacity, IntPtr.Zero)
            Label4.Text = FileIO.FileSystem.GetName(fdlg.FileName)
        End If
    End Sub
    Public Sub SoundPlay()
        If Timer1.Enabled = True Then Timer1.Enabled = False
        If fdlg.FileName <> "" Then
            Dim strCommand As String = "play mpegfile"
            mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
            ResPos()
            Timer1.Enabled = True
        End If
    End Sub
    Public Sub SoundStop()
        Dim strCommand As String = "stop mpegfile"
        ResPos()
        mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
        If fdlg.FileName <> "" Then
            ResTextPos()
        End If
        Timer1.Enabled = False
    End Sub
    Public Sub SoundClose()
        Dim strCommand As String = "close mpegfile"
        mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
    End Sub
    Public Sub ResTextPos()
        Dim Zero As Integer = 0
        Label2.Text = TimeSpan.Zero.ToString
        Label3.Text = Zero.ToString & "%"
        TrackBar1.Value = TrackBar1.Minimum
    End Sub
    Public Sub ResPos()
        Dim FstrCommand As String = String.Concat("play mpegfile from ", 0)
        mciSendString(FstrCommand, Nothing, 0, System.IntPtr.Zero)
    End Sub
    '-------------------------- Object Event Control -------------------------------------------------------------
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SoundOpen()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SoundPlay()
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        SoundStop()
    End Sub
    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        tbScrollPos(TrackBar1.Value)
        ToolTip1.SetToolTip(TrackBar1, TrackBar1.Value * 100 / 100)
    End Sub
    Private Sub TrackBar2_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.Scroll
        mciSendString(String.Concat("setaudio mpegfile volume to ", TrackBar2.Value * 1000 / 100), Nothing, 0, System.IntPtr.Zero)
        ToolTip1.SetToolTip(TrackBar2, TrackBar2.Value * 100 / 100)
    End Sub
    Private Sub TrackBar1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.MouseLeave
        ToolTip1.SetToolTip(TrackBar1, "")
    End Sub
    Private Sub TrackBar2_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.MouseLeave
        ToolTip1.SetToolTip(TrackBar2, "")
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        SoundClose()
    End Sub
    Dim percent As Integer
    Dim LstrBuffer = New System.Text.StringBuilder(128)
    Dim PstrBuffer = New System.Text.StringBuilder(128)
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim sCommand As String = "status mpegfile position"
        Dim lCommand As String = "status mpegfile length"
        mciSendString(lCommand, LstrBuffer, LstrBuffer.Capacity, System.IntPtr.Zero)
        mciSendString(sCommand, PstrBuffer, PstrBuffer.Capacity, IntPtr.Zero)
        percent = Math.Round((PstrBuffer.ToString / LstrBuffer.ToString) * 100, 0)
        Label1.Text = CalcTimes(LstrBuffer.ToString)
        Label2.Text = CalcTimes(PstrBuffer.ToString)
        Label3.Text = tbPercentValue() & "%"
        TrackBar1.Value = tbPercentValue()
        If tbPercentValue() >= 100 And Label2.Text >= Label1.Text Then
            SoundStop()
            ResTextPos()
            Timer1.Enabled = False
        End If
    End Sub
    '---------Set Form Object Properties ---------
    Public Sub fgProperties()
        Me.Text = "Sound Player Sample"
        Me.CenterToScreen()
        Label1.Text = ""
        Label2.Text = ""
        Label3.Text = ""
        Label4.Text = ""
        Button1.Text = "Open"
        Button2.Text = "Play"
        Button3.Text = "Stop"
        TrackBar1.TickStyle = TickStyle.None
        TrackBar1.Maximum = 100
        TrackBar2.TickStyle = TickStyle.Both
        TrackBar2.Maximum = 100
        TrackBar2.Value = TrackBar2.Maximum
    End Sub
    '---------------------------Set Scroll Position --------------------------------------
    Public Function tbScrollPos(ByVal tbValue As Integer) As Integer
        If fdlg.FileName <> "" Then
            Dim lBuff = New System.Text.StringBuilder(128)
            Dim lCommand As String = "status mpegfile length"
            mciSendString(lCommand, lBuff, lBuff.Capacity, IntPtr.Zero)
            Dim iLength As Integer = Math.Round(lBuff.ToString / 100)
            Dim fCommand As String = String.Concat("play mpegfile from ", tbValue.ToString * iLength.ToString)
            mciSendString(fCommand, Nothing, 0, System.IntPtr.Zero)
            If percent >= 100 Then
                TrackBar1.Value = 0
                Timer1.Enabled = True
            Else
                Timer1.Enabled = True
            End If
        End If
    End Function
    '-------------------------- Set TimeSpan ----------------------------
    Public Function CalcTimes(ByVal milliseconds As Double) As String
        Dim VtimeSpan As System.TimeSpan
        VtimeSpan = System.TimeSpan.FromMilliseconds(milliseconds)
        Return Strings.Left(VtimeSpan.ToString, 8)
    End Function
    '----------------------- Set PercentValuePosition ---------------------
    Public Function tbPercentValue() As Integer
        Return Math.Round((PstrBuffer.ToString / LstrBuffer.ToString) * 100)
    End Function
End Class
« Last Edit: 7 Jul '12 - 08:08 by sak2005 » Logged
skygamer
Posts: 3


« Reply #21 on: 5 Jul '12 - 07:09 »
Reply with quoteQuote

thats amazing.  Grin  thank you.

But i need 10 bands equalizer. How can i implement it? I've searched but nothing found for vb.net
Logged
sak2005
Posts: 82


« Reply #22 on: 5 Jul '12 - 12:35 »
Reply with quoteQuote

thats amazing.  Grin  thank you.

But i need 10 bands equalizer. How can i implement it? I've searched but nothing found for vb.net

Yes, It's not has in the internet. You must modify convert from C# to VB.net.
Logged
sak2005
Posts: 82


« Reply #23 on: 9 Jul '12 - 00:55 »
Reply with quoteQuote

Tip!: Create Timer Event Handler on the Class

Add ProgressBar1 , Label1 and Button1 on the form. Writting code now.

Public Class Form1
    'create new timer
    Private time As New Timer()

    'call form design
    Public Sub New()
        InitializeComponent()
        Me.CenterToScreen()
        Button1.Text = "Start"
        Label1.Text = "0% Completed"

        'create add event handle
        AddHandler time.Tick, AddressOf Progress_tick
        time.Interval = 250
    End Sub

   'create event timer tick function
    Public Sub Progress_tick(ByVal sender As Object, ByVal e As EventArgs)
        Dim rand As New Random
        ProgressBar1.Increment(rand.Next(0, 10))
        Label1.Text = ProgressBar1.Value.ToString() + "% Completed"
        If ProgressBar1.Value = ProgressBar1.Maximum Then
            time.Stop()
            MsgBox("100% Completed")
            ProgressBar1.Value = ProgressBar1.Minimum
            Label1.Text = "0% Completed"
        End If
    End Sub

    'start timer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        time.Start()
    End Sub
End Class
================================================================
Tip: EventClass EventHandler

Create Form1 and add Button1. Writting code now.

Example:
Public Class Form1

    '2.Call and Create New EventClass.
    Dim WithEvents Eclass As New EventClass

    '3.Create EventHandle Function.(get to send)
    Sub Eclass_EventHandler() Handles Eclass.Aevent
        MsgBox("Received Event.")
    End Sub

    '4.EventClass Test.(send to EventHandler)
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Eclass.RaiseEvents()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CenterToScreen()
    End Sub
End Class

'1.Create EventClass..RaiseEvent.
Class EventClass
    Public Event Aevent()
    Sub RaiseEvents()
        RaiseEvent Aevent()
    End Sub
End Class
« Last Edit: 11 Jul '12 - 16:58 by sak2005 » Logged
dregalia
Posts: 10


« Reply #24 on: 9 Jul '12 - 06:19 »
Reply with quoteQuote

Hey brotha, Loving the VB.NET stuff.. Do you have an example that I can use to play one song after another? 
Logged
sak2005
Posts: 82


« Reply #25 on: 9 Jul '12 - 11:44 »
Reply with quoteQuote

Hey brotha, Loving the VB.NET stuff.. Do you have an example that I can use to play one song after another? 

Did you mean.. create list of songs and can select playing a song in the list?
« Last Edit: 10 Jul '12 - 10:33 by sak2005 » Logged
dregalia
Posts: 10


« Reply #26 on: 10 Jul '12 - 07:32 »
Reply with quoteQuote

Yeah... either play an entire list of songs, or have it use the crossfade between 2 different songs and send that one stream to the broadcast server.
Logged
sak2005
Posts: 82


« Reply #27 on: 10 Jul '12 - 10:25 »
Reply with quoteQuote

Yeah... either play an entire list of songs, or have it use the crossfade between 2 different songs and send that one stream to the broadcast server.

For you.. try. Click here

If you wanted modify. You must decompile *.exe with.. - Spices.Net - application.
=============================================================
Example: Create SongsList

Create Form1 and writting code now.

Public Class Form1
    'Call DLLs
    Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
    (ByVal strCommand As String, _
     ByVal strReturn As System.Text.StringBuilder, _
     ByVal iReturnLength As Integer, _
     ByVal hwndCallback As System.IntPtr) As Long

    'Creaet New Object
    Private Lbl1 As New Label
    Private sList1 As New ListBox
    Private btn1 As New Button
    Private btn2 As New Button
    Private btn3 As New Button
    Private fDlg1 As New OpenFileDialog

    'Operate Variable
    Private FileName As String

    'Call Form.Desinger
    Public Sub New()
        InitializeComponent()
        Me.CenterToScreen()
        Me.Text = "SongsList Sample"
        Lbl1.Text = "SongsList:"
        Lbl1.Location = New Point(20, 20)
        sList1.Size = New Size(250, 100)
        sList1.Location = New Point(20, 50)
        btn1.Text = "Open"
        btn2.Text = "Play"
        btn3.Text = "Stop"
        btn1.Location = New Point(20, 200)
        btn2.Location = New Point(110, 200)
        btn3.Location = New Point(200, 200)
        Me.Controls.Add(Lbl1)
        Me.Controls.Add(sList1)
        Me.Controls.Add(btn1)
        Me.Controls.Add(btn2)
        Me.Controls.Add(btn3)

        'Create EventHandle
        AddHandler btn1.Click, AddressOf ButtonOpen_Click
        AddHandler btn2.Click, AddressOf ButtonPlay_Click
        AddHandler btn3.Click, AddressOf ButtonStop_Click
        AddHandler sList1.SelectedIndexChanged, AddressOf ListBox1_SelectedIndexChanged
    End Sub

    'Load file to the list
    Public Sub ButtonOpen_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        fDlg1.FileName = String.Empty
        fDlg1.Filter = "MpegFile(*.mp3)|*.mp3"
        If fDlg1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim nIndex As Integer = sList1.Items.Add(FileIO.FileSystem.GetName(fDlg1.FileName))
            sList1.SelectedIndex = nIndex
            ResetFilePosition()
        End If
    End Sub
    Public Sub ButtonPlay_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        ResetFilePosition()
        Dim strCommand As String = "play oursong"
        mciSendString(strCommand, Nothing, 0, System.IntPtr.Zero)
      End Sub
    Public Sub ButtonStop_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim strCommand As String = "stop oursong"
        mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
        ResetFilePosition()
    End Sub

    'Selected ItemFileIndex to Playing
    Public Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        mciSendString("close oursong", Nothing, 0, IntPtr.Zero)
        FileName = sList1.SelectedItem.ToString
        Dim strCommand As String = String.Concat("open """, FileName, """ type mpegvideo alias oursong")
        mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
    End Sub
    Public Sub ResetFilePosition()
        Dim pCommand As String = String.Concat("play oursong to ", 0)
        mciSendString(pCommand, Nothing, 0, IntPtr.Zero)
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        ResetFilePosition()     
        mciSendString("close oursong", Nothing, 0, IntPtr.Zero)
    End Sub
End Class
===============================================================
DoubleClick Item to Playing

Public Class Form1
    'Call DLLs
    Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
    (ByVal strCommand As String, _
     ByVal strReturn As System.Text.StringBuilder, _
     ByVal iReturnLength As Integer, _
     ByVal hwndCallback As System.IntPtr) As Long

    'Creaet New Object
    Private Lbl1 As New Label
    Private sList1 As New ListBox
    Private btn1 As New Button

    Private btn3 As New Button
    Private fDlg1 As New OpenFileDialog

    'Operate Variable
    Private FileName As String

    'Call Form.Desinger
    Public Sub New()
        InitializeComponent()
        Me.CenterToScreen()
        Me.Text = "SongsList Sample"
        Lbl1.Text = "SongsList:"
        Lbl1.Location = New Point(20, 20)
        sList1.Size = New Size(250, 100)
        sList1.Location = New Point(20, 50)
        btn1.Text = "Open"

        btn3.Text = "Stop"
        btn1.Location = New Point(20, 200)

        btn3.Location = New Point(200, 200)
        Me.Controls.Add(Lbl1)
        Me.Controls.Add(sList1)
        Me.Controls.Add(btn1)

        Me.Controls.Add(btn3)

        'Create EventHandle
        AddHandler btn1.Click, AddressOf ButtonOpen_Click

        AddHandler btn3.Click, AddressOf ButtonStop_Click
        AddHandler sList1.MouseDoubleClick, AddressOf ListBox1_MouseDoubleClick
    End Sub

    'Add files to the list
    Public Sub ButtonOpen_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        fDlg1.FileName = String.Empty
        fDlg1.Filter = "MpegFile(*.mp3)|*.mp3"
        If fDlg1.ShowDialog = Windows.Forms.DialogResult.OK Then
            sList1.Items.Add(FileIO.FileSystem.GetName(fDlg1.FileName))
        End If
    End Sub
   
    Public Sub ButtonStop_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim strCommand As String = "stop oursong"
        mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
        ResetFilePosition()
    End Sub

    'DoubleClick Item to Playing
    Public Sub ListBox1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)
        mciSendString("close oursong", Nothing, 0, IntPtr.Zero)
        Try
            FileName = sList1.SelectedItem.ToString
            Dim strCommand As String = String.Concat("open """, FileName, """ type mpegvideo alias oursong")
            mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
        Catch
        End Try
        ResetFilePosition()
        Try
            Dim strCommand As String = "play oursong"
            mciSendString(strCommand, Nothing, 0, IntPtr.Zero)
        Catch
        End Try
    End Sub
    Public Sub ResetFilePosition()
        Dim pCommand As String = String.Concat("play oursong to ", 0)
        mciSendString(pCommand, Nothing, 0, IntPtr.Zero)
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        ResetFilePosition()
        mciSendString("close oursong", Nothing, 0, IntPtr.Zero)
    End Sub
End Class
« Last Edit: 12 Jul '12 - 14:56 by sak2005 » Logged
sak2005
Posts: 82


« Reply #28 on: 15 Jul '12 - 07:56 »
Reply with quoteQuote

Get creating object event handle

Download: BassUn4SeenPlayer.exe Sample project Click here
Download: SourceCode Click here


« Last Edit: 15 Jul '12 - 08:15 by sak2005 » Logged
sak2005
Posts: 82


« Reply #29 on: 17 Jul '12 - 06:09 »
Reply with quoteQuote

Free File INI.Net.dll  ..For mem data. :: Download Click here

Using: Create Form1 and Referents file.dll into your project solution.

Example: IniWrite  ..Write or Create ini file name.. 'Setting.ini'
Public Class Form1
    Private fileName As String = String.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "\Setting.ini")
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim vb As New INI.Class1
        vb.IniWrite("Section", "Key", "Value", fileName)
    End Sub
End Class
===========================================================
Example: IniRead  ..read value of the ini file.
Private RetString As New System.Text.StringBuilder(128)
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim vb As New INI.Class1
        Dim defultValue As String = "Not Found"
        vb.IniRead("Section", "Key", defultValue, RetString, RetString.Capacity, fileName)
        MsgBox(RetString.ToString)
    End Sub
« Last Edit: 17 Jul '12 - 06:47 by sak2005 » Logged
sak2005
Posts: 82


« Reply #30 on: 19 Jul '12 - 10:46 »
Reply with quoteQuote

nbass Stream Player Sample Project VB2008 SourceCode :: Download: Click here


====================================================
Get function code folder browser : AddItemsSongsList

Paste all code in to the class form.

Create ListBox and Button and Paste headcode: AddItemsSongsList() in to the button event click function.

Public Sub AddItemsSongsList()
    Dim folderBrowserDialog1 As New FolderBrowserDialog
    If folderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
       Dim arrayList As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
       arrayList = My.Computer.FileSystem.FindInFiles(folderBrowserDialog1.SelectedPath, Nothing, False, FileIO.SearchOption.SearchTopLevelOnly, "*.mp3", "*.wma")
       For Each filesName As String In arrayList
           listBox1.Items.Add(filesName)
       Next filesName
    End If
End Sub
« Last Edit: 23 Jul '12 - 02:55 by sak2005 » Logged
sak2005
Posts: 82


« Reply #31 on: 23 Jul '12 - 03:12 »
Reply with quoteQuote

Tip: Get code win player out of bass player. Try now.

Create Form1

Add References Com and select Windows Media Player ..click OK

Writting code now

Public Class Form1
    Private WinMedia As New WMPLib.WindowsMediaPlayer
    Private filedlg As New OpenFileDialog
    Private btnLoad As New Button
    Private btnPlay As New Button
    Private btnStop As New Button
    Private lblSongName As New Label
    Private lblDuration As New Label
    Private lblPosition As New Label
    Private lblState As New Label
    Private checkPol As New CheckBox
    Private checkRp As New CheckBox
    Private timer1 As New Timer
    Public Sub New()
        MyBase.New()
        InitializeComponent()
        Me.CenterToScreen()
        Me.Size = New Size(340, 200)
        Me.Text = "WMPLip Player (References Com)"
        Me.MaximizeBox = False
        filedlg.FileName = ""
        filedlg.Filter = "Song file(*.mp3;*.mid;*.wma)|*.mp3;*.mid;*.wma|All file(*.*)|*.*"
        btnLoad.Text = "Load"
        btnPlay.Text = "Play"
        btnStop.Text = "Stop"
        checkPol.Text = "PlayOnLoad"
        checkRp.Text = "RePlay"
        lblSongName.Text = "SongName:"
        lblDuration.Text = "00:00"
        lblPosition.Text = "00:00"
        lblState.Text = "State: - - - - -"
        btnLoad.Location = New Point(45, 130)
        btnPlay.Location = New Point(125, 130)
        btnStop.Location = New Point(205, 130)
        lblSongName.Location = New Point(50, 10)
        lblDuration.Location = New Point(10, 45)
        lblPosition.Location = New Point(10, 75)
        lblState.Location = New Point(100, 100)
        checkPol.Location = New Point(120, 40)
        checkRp.Location = New Point(120, 70)
        checkPol.Checked = True
        checkRp.Checked = True
        lblSongName.AutoSize = True
        lblSongName.Cursor = Cursors.Hand
        Me.Controls.AddRange(New Control() {btnLoad, btnPlay, btnStop, lblSongName, checkPol, lblDuration, lblPosition, lblState, checkRp})
        AddHandler btnLoad.Click, AddressOf btnLoad_Click
        AddHandler btnPlay.Click, AddressOf btnPlay_Cilck
        AddHandler btnStop.Click, AddressOf btnStop_Click
        AddHandler lblSongName.Click, AddressOf lblSongName_Click
        AddHandler timer1.Tick, AddressOf timer1_Tick
    End Sub
    Public Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If filedlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            lblSongName.Text = "SongName: " & My.Computer.FileSystem.GetName(filedlg.FileName)
            If checkPol.CheckState = CheckState.Checked Then btnPlay.PerformClick()
        End If
    End Sub
    Public Sub btnPlay_Cilck(ByVal sender As System.Object, ByVal e As System.EventArgs)
        WinMedia.URL = filedlg.FileName
        timer1.Enabled = True
    End Sub
    Public Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        lblPosition.Text = "00:00"
        lblState.Text = "State: Stopped"
        WinMedia.close()
    End Sub
    Public Sub lblSongName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        btnPlay.PerformClick()
    End Sub
    Public Sub timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Select Case WinMedia.playState
            Case WMPLib.WMPPlayState.wmppsPlaying
                lblState.Text = "State: Playing..."
                lblDuration.Text = WinMedia.currentMedia.durationString
                lblPosition.Text = WinMedia.controls.currentPositionString
            Case WMPLib.WMPPlayState.wmppsStopped
                If checkRp.CheckState = CheckState.Checked Then
                    btnPlay.PerformClick()
                Else
                    lblState.Text = "State: Stopped"
                    lblPosition.Text = "00:00"
                    timer1.Enabled = False
                End If
        End Select
    End Sub
End Class



« Last Edit: 24 Jul '12 - 19:41 by sak2005 » Logged
steph_tsf
Posts: 7


« Reply #32 on: 23 Jul '12 - 07:26 »
Reply with quoteQuote

Thank you so much for the two examples you have provided.
I am running WinXp SP3
Loaded your two VB2008 projects on VB 2010, no problem when VB2010 converts them to VB2010.
Build happens without error.

First example without spectrum analyzer runs OK in debug mode.

Second example labelled "StreamTest" with spectrum analyzer behaves differently. In debug mode I'm getting the following fatal error:

System.InvalidOperationException was unhandled
Exception.InnerException.
L'erreur est : C:\Documents and Settings\Administrator\My Documents\DvRE.v3164812328.AiO.Hypnox\logo2010.png
  Source=StreamTest
  StackTrace:
       à My.MyProject.MyForms.Create__Instance__[T](T Instance) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 190
       à My.MyProject.MyForms.get_Form1()
       à StreamTest.Form1.Main() dans C:\SC documents\Audio DSP on WinPC\BASS examples\sak2005 Direct bass Vb.net\Example_02\StreamTest\Form1.Designer.vb:ligne 0
       à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       à System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.IO.FileNotFoundException
       Message=C:\Documents and Settings\Administrator\My Documents\DvRE.v3164812328.AiO.Hypnox\logo2010.png
       Source=System.Drawing
       StackTrace:
            à System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
            à System.Drawing.Image.FromFile(String filename)
            à StreamTest.Form1..ctor() dans C:\SC documents\Audio DSP on WinPC\BASS examples\sak2005 Direct bass Vb.net\Example_02\StreamTest\Form1.vb:ligne 42

Is it related to INI.dll that I may have omitted or misplaced?
Logged
sak2005
Posts: 82


« Reply #33 on: 23 Jul '12 - 11:39 »
Reply with quoteQuote

You must is 'Advance Programming' to modify Code to Error!. Please wait!.. Now I'll help.

Try create code with your own.

Example: Draw Graphic Visualizer. Use bass.dll for nBass 1.8

Private Const BASS_DATA_FFT1024 As Integer = &H80000001
Public Sub DrawGraphicVisualizer()
        Dim bit As Bitmap = New Bitmap(PicVis1.Width, PicVis1.Height)
        Dim graph As Graphics = Graphics.FromImage(bit)
        Dim WhitePen As New Pen(Color.Azure, 2)
        Dim PurplePen As New Pen(Color.BlueViolet, 2)
        Dim d(1023) As Single
        Dim X As Integer
        playing = BASS_ChannelIsActive(Strm)
        If playing = 0 Then Exit Sub
        BASS_ChannelGetData(Strm, d(0), BASS_DATA_FFT1024)
        For X = 0 To PicVis1.Width Step 4
            Y = Sqrt(d(X + 1)) * 3 * PicVis1.Height ' - 4
            If Y > PicVis1.Height Then Y = PicVis1.Height
            If Y < 0 Then Y = 0
            graph.DrawLine(WhitePen, X + 2, PicVis1.Height \ 2, X + 2, PicVis1.Height \ 2 - Y) ' \ 2)
            graph.DrawLine(PurplePen, X + 2, PicVis1.Height \ 2 + Y, X + 2, PicVis1.Height \ 2)  '- Y \ 2)
        Next
        PicVis1.Image = bit
    End Sub
« Last Edit: 23 Jul '12 - 12:16 by sak2005 » Logged
steph_tsf
Posts: 7


« Reply #34 on: 23 Jul '12 - 16:58 »
Reply with quoteQuote

You must is 'Advance Programming' to modify Code to Error!. Please wait!.. Now I'll help. Try create code with your own. Example: Draw Graphic Visualizer. Use bass.dll for nBass 1.8

Indeed, I am not an experienced programmer. I understand there are three different ways to get VB2010 connecting to BASS:

1. the "direct" approach where the needed wrapper fragments are provided in a ModuleBASS.vb file (your first example)
2. relying on the nBASS wrapper - in VB2010, how do you specify that you are using the nBASS wrapper?
3. installing the BASSNET wrapper, supplied by from un4seen

I like your minimalist "direct" VB approach. It enables me to concentrate on the VB Form, on the VB Code and on the wrapper fragments that are required to talk with BASS, in the .net context. I only need to concentrate on few BASS function calls. A particular BASS demo that's catching my eyes is the \BASS\bass24\vb\DSPtest demo supplied by un4seen. It is catching my eyes because this is a genuine sample-by-sample audio DSP. I would like to have that particular demo working in VB2010, so I can start modifying a few lines in the audio DSP, and measure the result.

In my computer, the \BASS\bass24\delphi\DspTest demo is already running on Delphi 7, but due to the fact that I already have a few graphical front-ends written for VB2010, containing Charts elements introduced in VB2010, I prefear  working with VB2010.

I also tried \BASS\bass24\c\dsptest using VC++2010, but no luck, it completely fails.
As I am using VC++2010, the project automatically gets converted when doing "file" then "open", but after the conversion I'm getting this warning saying:
MSB8012: $(TargetPath) ('C:\Documents and Settings\Administrateur\Mes documents\Downloads\Audio DSP on WinPC\BASS and BASSASIO audio lib\BASS\bass24\c\dsptest\..\bin\dsptest.exe') does not match the Linker's OutputFile property value '..\bin\dsptest.exe' ('C:\Documents and Settings\Administrateur\Mes documents\Downloads\Audio DSP on WinPC\BASS and BASSASIO audio lib\BASS\bass24\c\bin\dsptest.exe') in project configuration 'Release|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetPath) property value matches the value specified in %(Link.OutputFile).
Unfortunately, I don't know how to correct the wrong path that's invoved there. Anyway, from there everything goes weird. Upon rebuilding the app, I get a warning saying that the debug info is missing. Browsing the files, I can find the C++ code but I cannot find the Form. And I see there is a 27 megabyte dsptest.sdf file, I particulary hate this. If I try a "run", nothing happens. That's my misery with VC++2010.

Would be a fantastic help if you show your minimalist "direct" .net BASS wrapper approach, applied to the  \BASS\bass24\vb\DSPtest demo supplied by un4seen. "The less, the best".

Regards,
Steph
Logged
sak2005
Posts: 82


« Reply #35 on: 29 Jul '12 - 01:38 »
Reply with quoteQuote

Free SourceCode : Mini BASS Player Click here


================================================================
Free Best SourceCode: Bass Player Pro. Download: Click here

PullUp keep songs list.

Auto Update Files to the List. But cannot clear items in the list ..modifying


===============================================================
Free SourceCode: Bass Pro LED Level Meter Click here


=================================================================
Download: Mini Bass Player Advance :: SourceCode Click here


=============================================================
Download: Bass_LED_Visualizer SourceCode Click here








« Last Edit: 4 Aug '12 - 12:52 by sak2005 » Logged
sak2005
Posts: 82


« Reply #36 on: 5 Aug '12 - 22:23 »
Reply with quoteQuote

To Create your own waves visualizer. Draw graphics on the PictureBoxs (VB.Net2008)

1. Use 1 or 2 PictureBox Object Component.
2. Use BASS FFT command or other.
3. Use draw bitmap command or paint form command.

Example: Creatting 2 waves visaulizer (Draw image). Not use FFT
Please wait!
« Last Edit: 5 Aug '12 - 22:32 by sak2005 » Logged
sak2005
Posts: 82


« Reply #37 on: 11 Aug '12 - 16:53 »
Reply with quoteQuote

WmpLipMod Player SourceCode (Decompile from WMPLip.dll)
Module WMPLipMod
    Private sForm1 As New System.Windows.Forms.Form
    Private button1 As New System.Windows.Forms.Button
    Private button2 As New System.Windows.Forms.Button
    Private button3 As New System.Windows.Forms.Button
    Private fdlg As New System.Windows.Forms.OpenFileDialog
    Private label1 As New System.Windows.Forms.Label
    Private label2 As New System.Windows.Forms.Label
    Private label3 As New System.Windows.Forms.Label
    Private label4 As New System.Windows.Forms.Label
    Private label5 As New System.Windows.Forms.Label
    Private media As New WMPLib.WindowsMediaPlayer
    Private timer1 As New System.Windows.Forms.Timer
    Private fileName As String
    Sub New()
        sForm1.StartPosition = FormStartPosition.CenterScreen
        sForm1.Size = New Size(300, 170)
        sForm1.Text = "WMP Player"
        sForm1.MaximizeBox = False
        sForm1.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
        button1.Text = "Open"
        button2.Text = "Pause"
        button3.Text = "Stop"
        button1.Cursor = Cursors.Hand
        button2.Cursor = Cursors.Hand
        button3.Cursor = Cursors.Hand
        label1.Text = "00:00"
        label2.Text = "00:00"
        label3.Text = "No Song"
        label4.Text = "Stopped"
        label5.Text = "0%"
        button1.Location = New System.Drawing.Point(27, 100)
        button2.Location = New System.Drawing.Point(107, 100)
        button3.Location = New System.Drawing.Point(187, 100)
        label1.Location = New System.Drawing.Point(30, 10)
        label2.Location = New System.Drawing.Point(225, 10)
        label3.Location = New System.Drawing.Point(90, 43)
        label4.Location = New System.Drawing.Point(110, 68)
        label5.Location = New System.Drawing.Point(130, 10)
        sForm1.Controls.AddRange(New Control() _
        {button1, button2, button3, label1, label2, label3, label4, label5})
        AddHandler sForm1.FormClosing, AddressOf sForm1_FormClosing
        AddHandler button1.Click, AddressOf Button1_Click
        AddHandler button2.Click, AddressOf Button2_Click
        AddHandler button3.Click, AddressOf Button3_Click
        AddHandler timer1.Tick, AddressOf Timer1_Tick
        timer1.Enabled = False
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If button2.Text = "Resume" Then button2.Text = "Pause"
        LoadPlaySound()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        SoundPause()
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If button2.Text = "Resume" Then button2.Text = "Pause"
        SoundStop()
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        label1.Text = media.currentMedia.durationString
        label2.Text = media.controls.currentPositionString
        label5.Text = Math.Round((media.controls.currentPosition / media.currentMedia.duration) * 100, 0) & "%"
        Select Case media.playState
            Case WMPLib.WMPPlayState.wmppsPlaying
                label4.Text = "Playing.."
            Case WMPLib.WMPPlayState.wmppsPaused
                label4.Text = "Paused"
            Case WMPLib.WMPPlayState.wmppsStopped
                label2.Text = "00:00"
                label4.Text = "Song end"
                label5.Text = "0%"
        End Select
    End Sub
    Public Sub LoadPlaySound()
        Select Case button1.Text
            Case "Open"
                fdlg.FileName = ""
                fdlg.Filter = "Media Files(*.mp3;*.wav)|*.mp3;*.wav|All files(*.*)|*.*"
                If fdlg.ShowDialog = Windows.Forms.DialogResult.OK Then
                    fileName = fdlg.FileName
                    button1.Text = "Play"
                    label3.Text = My.Computer.FileSystem.GetName(fileName)
                End If
            Case "Play"
                media.URL = fileName
                timer1.Enabled = True
        End Select
    End Sub
    Public Sub SoundPause()
        Select Case button2.Text
            Case "Pause"
                If media.playState = WMPLib.WMPPlayState.wmppsPlaying Then
                    media.controls.pause()
                    button2.Text = "Resume"
                End If
            Case "Resume"
                If media.playState = WMPLib.WMPPlayState.wmppsPaused Then
                    media.controls.play()
                    button2.Text = "Pause"
                End If
        End Select
    End Sub
    Public Sub SoundStop()
        Select Case media.playState
            Case WMPLib.WMPPlayState.wmppsPaused
                label2.Text = "00:00"
                label4.Text = "Stopped"
                label5.Text = "0%"
                button1.Text = "Open"
                timer1.Enabled = False
            Case WMPLib.WMPPlayState.wmppsPlaying
                media.controls.stop()
                label2.Text = "00:00"
                label4.Text = "Stopped"
                label5.Text = "0%"
                button1.Text = "Open"
                timer1.Enabled = False
            Case WMPLib.WMPPlayState.wmppsStopped
                If label4.Text = "Stopped" Then
                    label2.Text = "00:00"
                    label5.Text = "0%"
                    timer1.Enabled = False
                End If
        End Select
    End Sub
    Public Sub GuiWMPLipMediaPlayer()
        sForm1.ShowDialog()
    End Sub
    Private Sub sForm1_FormClosing(ByVal mySender As System.Object, ByVal myEvent As System.EventArgs)
        If timer1.Enabled = True Then timer1.Enabled = False
        media.close()
        Application.Exit()
    End Sub
End Module
=================================================================
Example:
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        GuiWMPLipMediaPlayer()
    End Sub
End Class
« Last Edit: 11 Aug '12 - 17:50 by sak2005 » Logged
sak2005
Posts: 82


« Reply #38 on: 14 Aug '12 - 10:12 »
Reply with quoteQuote

Bass EQualizer
« Last Edit: 14 Aug '12 - 21:18 by sak2005 » Logged
hexsharp
Posts: 4


« Reply #39 on: 16 Aug '12 - 07:51 »
Reply with quoteQuote

Could you upload the project files again please?... can't seem to download it from the links you've given ...
Logged
Pages: 1 [2] 3 4 5  All
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines