Ich versuche, einen Sound mit Audiodiagramm zu spielen, und es ist nicht möglich, einen Dateiausgangsknoten aus einer Speicherdatei zu erstellen. Ich habe überprüft und die Speicherdatei ist nicht null; Der Fehler, den ich bekomme, ist nur ein unbekannter Fehler und hilft nichtUWP spielt eine .aif-Datei mit AudioGraph
Irgendwelche Ideen?
private async void HandlePlayCommand()
{
if (_audioGraph == null)
{
var settings = new AudioGraphSettings(AudioRenderCategory.Media);
var createResults = await AudioGraph.CreateAsync(settings);
if (createResults.Status != AudioGraphCreationStatus.Success) return;
_audioGraph = createResults.Graph;
var deviceResult = await _audioGraph.CreateDeviceOutputNodeAsync();
if(deviceResult.Status != AudioDeviceNodeCreationStatus.Success) return;
var outputNode = deviceResult.DeviceOutputNode;
StorageFile file = await GetStorageFiles();
var fileResult = await _audioGraph.CreateFileInputNodeAsync(file);
if (fileResult.Status != AudioFileNodeCreationStatus.Success) return;
var fileInputNode = fileResult.FileInputNode;
fileInputNode.AddOutgoingConnection(outputNode);
_audioGraph.Start();
}
}
private async Task<StorageFile> GetStorageFiles()
{
string CountriesFile = @"Assets\909_1.aif";
StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await InstallationFolder.GetFileAsync(CountriesFile);
return file;
}
'string CountriesFile = @" Assets \ 909_1.aif ";' sollte 'String sein CountryFile =" ms-appx: ///Assets/909_1.aif ";' – AVK
Könnten Sie bitte Ihre Audiodateien in '. wav', '.mp3',' .wna' oder etwas anderes? Ich denke, '.aif' wird nicht unterstützt. –
Das war richtig, es war der Dateityp. Seltsam wie ich das .aif spielen konnte, indem ich es im Projekt doppelt klickte. Sowieso funktioniert jetzt. Wenn Sie das als Lösung aufstellen, akzeptieren Sie es nicht. –