I think you may be being bitten by the desktop USB flakiness with the library. Sound uploading is a several part process, uploading the file chunk-by-chunk. Because my USB layer is a bit flakey, it sometimes likes to write packets that seem to be successful
that wind up never making it to the other side. So it sounds like you could be getting a corrupted upload.
As for the values not available immediately, that's one of the known issues with desktop USB as well. I find that values can be up to a second delayed (sometimes even more). They don't stream smoothly as they do over bluetooth/wifi/USB on WinRT.
Overall, my only suggestion to you is to change to bluetooth or wifi as your connection layer and see if that clears up the issue. Your code above is perfectly valid, but I'll also give you one suggestion just for better async usage: if you have a method that
only includes an await as the final line of the method, instead of awaiting it, return the Task instead and await it at the caller. For example:
public static async Task PlaySoundFileAsync()
await myBrick.DirectCommand.PlaySoundAsync(100, soundBrickPath + soundShortFileNameNoExt);
public static Task PlaySoundFileAsync()
return myBrick.DirectCommand.PlaySoundAsync(100, soundBrickPath + soundShortFileNameNoExt);
It saves you a setting up an async action when it's not necessary in cases like this. Hope that makes some kind of sense, but it's not anything to do with the issue you're experiencing, just a suggestion. :)