I need to import tracks from a CD, but so far I can’t do this. I can successfully import .mp3 or many other audio formats from a CD. First, for import purposes, I scan the files and folder of the CD. Then I show the list of files for the user and copies the files that the user selects from the list.
Here is my code to scan a directory or CD:
List<StorageFile> allTrackFiles = null; private async Task GetFiles(StorageFolder folder) { if(!scanningRemovableTask) { return; } try { if(allTrackFiles == null) { allTrackFiles = new List<StorageFile>(); } var items = await folder.GetItemsAsync(); foreach (var item in items) { if (item.GetType() == typeof(StorageFile)) { StorageFile storageFile = item as StorageFile; allTrackFiles.Add(storageFile); var basicProperties = await storageFile.GetBasicPropertiesAsync(); var musicProperties = await storageFile.OpenReadAsync(); } else await GetFiles(item as StorageFolder); } } catch(Exception e) { } }
I pass the CD path to this function and it creates a list of files for me. This code works great when there is only .mp3 or any known audio format on the CD. But this creates problems when the CD has .CDA extension tracks. Since we know that .CDA files themselves cannot be played back, they are simply combined with the original media files.
Now I'm stuck here. How to read .CDA files or import .CDA files into our local directory in a universal Windows application.
c # windows-store-apps uwp windows-10-universal
Waqas ahmed khan
source share