Menu
Home
Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
VB.NET
Windows Forms
Need to speed up loading MP3 File Info into ListView
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Untamed" data-source="post: 118938" data-attributes="member: 24148"><p>Hello all. I am working on an advanced [at least I'd like to call it that] audio player. Currently, it supports .wmv and .mp3</p><p></p><p>It has the ability to recursively grab all .wmv and .mp3 files in any chosen folder, and add them to a playlist.</p><p></p><p>When opening the playlist, my program adds all the songs to an array, then starts adding the songs to a listview, categorizing them by song, artist, album, and genre, using a dll to access the ID3v1 tags on the .mp3 file.</p><p></p><p>It can successfully create playlists of thousands of songs at a somewhat okay speed, the problem is loading that into the categorized listview.</p><p></p><p>It used around 75% of my friend's CPU while loading his 5k+ song playlist into the listview, and it never finished after loading it in for a couple minutes (it auto updates as it loads, because it is done in a new thread.) </p><p></p><p>It never finished because his OS has a bug where, if the CPU usage is over 100% for more then a few mins, it BSOD's, but that's beside the point.</p><p></p><p>His CPU, by the way, is a quad core 2.33 GHZ processor.</p><p></p><p>The listview loads thousands of songs by using a lot of CPU [low amount of RAM, less then 40MB 99% of the time], and it does it slowly. Any help to lower the amount of CPU usage, and possibly in exchange, increase the RAM usage, as well as increasing the speed in general of loading the songs into the listview, is highly appreciated.</p><p></p><p>The main sub that loads it in [this sub is ran in a new thread]</p><p></p><p>[code] Sub dosinglelist()</p><p> Dim mdi = Nothing</p><p> Try</p><p> For doint = 0 To music.Count - 1</p><p> Try</p><p> Dim MP3 As New UltraID3</p><p> mdi = music(doint)</p><p> MP3.Read(mdi)</p><p> songnamevar = MP3.ID3v1Tag.Title</p><p> albumvar = MP3.ID3v1Tag.Album</p><p> artistvar = MP3.ID3v1Tag.Artist</p><p> genrevar = MP3.ID3v1Tag.GenreName</p><p> Catch</p><p> End Try</p><p> Try</p><p> If String.IsNullOrEmpty(songnamevar) = True Or String.IsNullOrWhiteSpace(songnamevar) = True Then</p><p> Dim tempmdi As String = ToName(mdi)</p><p> songnamevar = tempmdi.Substring(0, tempmdi.Length - 4)</p><p> If String.IsNullOrEmpty(songnamevar) = True Or String.IsNullOrWhiteSpace(songnamevar) = True Then</p><p> songnamevar = "N/A"</p><p> End If</p><p> End If</p><p> If String.IsNullOrEmpty(artistvar) = True Or String.IsNullOrWhiteSpace(artistvar) = True Then</p><p> artistvar = "N/A"</p><p> End If</p><p> If String.IsNullOrEmpty(albumvar) = True Or String.IsNullOrWhiteSpace(albumvar) = True Then</p><p> albumvar = "N/A"</p><p> End If</p><p> If String.IsNullOrEmpty(genrevar) = True Or String.IsNullOrWhiteSpace(genrevar) = True Then</p><p> genrevar = "N/A"</p><p> End If</p><p> Invoke(New ThreadStart(AddressOf dorowsinsert))</p><p></p><p> Catch ex As Exception</p><p> songnamevar = "N/A"</p><p> albumvar = "N/A"</p><p> artistvar = "N/A"</p><p> genrevar = "N/A"</p><p> Invoke(New ThreadStart(AddressOf dorowsinsert))</p><p> End Try</p><p> Next doint</p><p> listloading = False</p><p> Catch ex As Exception</p><p> MsgBox("Major error loading playlist visually! Will try again..." & Environment.NewLine & ex.ToString)</p><p> dosinglelist()</p><p> End Try</p><p> End Sub</p><p> Sub dorowsinsert()</p><p> Dim str(3) As String</p><p> Dim itm As ListViewItem</p><p> str(0) = songnamevar</p><p> str(1) = artistvar</p><p> str(2) = albumvar</p><p> str(3) = genrevar</p><p> itm = New ListViewItem(str)</p><p> SingleList.Items.Add(itm)</p><p> End Sub[/code]</p><p></p><p>I've already redone the sub once or twice to speed it up, and at the moment it's 2-3x faster then it originally was, but it is still very cpu-heavy and quite slow, so any help on improving it is highly appreciated.</p><p></p><p>Thanks for the help guys!</p></blockquote><p></p>
[QUOTE="Untamed, post: 118938, member: 24148"] Hello all. I am working on an advanced [at least I'd like to call it that] audio player. Currently, it supports .wmv and .mp3 It has the ability to recursively grab all .wmv and .mp3 files in any chosen folder, and add them to a playlist. When opening the playlist, my program adds all the songs to an array, then starts adding the songs to a listview, categorizing them by song, artist, album, and genre, using a dll to access the ID3v1 tags on the .mp3 file. It can successfully create playlists of thousands of songs at a somewhat okay speed, the problem is loading that into the categorized listview. It used around 75% of my friend's CPU while loading his 5k+ song playlist into the listview, and it never finished after loading it in for a couple minutes (it auto updates as it loads, because it is done in a new thread.) It never finished because his OS has a bug where, if the CPU usage is over 100% for more then a few mins, it BSOD's, but that's beside the point. His CPU, by the way, is a quad core 2.33 GHZ processor. The listview loads thousands of songs by using a lot of CPU [low amount of RAM, less then 40MB 99% of the time], and it does it slowly. Any help to lower the amount of CPU usage, and possibly in exchange, increase the RAM usage, as well as increasing the speed in general of loading the songs into the listview, is highly appreciated. The main sub that loads it in [this sub is ran in a new thread] [code] Sub dosinglelist() Dim mdi = Nothing Try For doint = 0 To music.Count - 1 Try Dim MP3 As New UltraID3 mdi = music(doint) MP3.Read(mdi) songnamevar = MP3.ID3v1Tag.Title albumvar = MP3.ID3v1Tag.Album artistvar = MP3.ID3v1Tag.Artist genrevar = MP3.ID3v1Tag.GenreName Catch End Try Try If String.IsNullOrEmpty(songnamevar) = True Or String.IsNullOrWhiteSpace(songnamevar) = True Then Dim tempmdi As String = ToName(mdi) songnamevar = tempmdi.Substring(0, tempmdi.Length - 4) If String.IsNullOrEmpty(songnamevar) = True Or String.IsNullOrWhiteSpace(songnamevar) = True Then songnamevar = "N/A" End If End If If String.IsNullOrEmpty(artistvar) = True Or String.IsNullOrWhiteSpace(artistvar) = True Then artistvar = "N/A" End If If String.IsNullOrEmpty(albumvar) = True Or String.IsNullOrWhiteSpace(albumvar) = True Then albumvar = "N/A" End If If String.IsNullOrEmpty(genrevar) = True Or String.IsNullOrWhiteSpace(genrevar) = True Then genrevar = "N/A" End If Invoke(New ThreadStart(AddressOf dorowsinsert)) Catch ex As Exception songnamevar = "N/A" albumvar = "N/A" artistvar = "N/A" genrevar = "N/A" Invoke(New ThreadStart(AddressOf dorowsinsert)) End Try Next doint listloading = False Catch ex As Exception MsgBox("Major error loading playlist visually! Will try again..." & Environment.NewLine & ex.ToString) dosinglelist() End Try End Sub Sub dorowsinsert() Dim str(3) As String Dim itm As ListViewItem str(0) = songnamevar str(1) = artistvar str(2) = albumvar str(3) = genrevar itm = New ListViewItem(str) SingleList.Items.Add(itm) End Sub[/code] I've already redone the sub once or twice to speed it up, and at the moment it's 2-3x faster then it originally was, but it is still very cpu-heavy and quite slow, so any help on improving it is highly appreciated. Thanks for the help guys! [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
VB.NET
Windows Forms
Need to speed up loading MP3 File Info into ListView
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom