try
{
using (var stream = new FileStream(fistBank, FileMode.Open))
{
var waveFile = new WaveFile(stream);
signal = waveFile[Channels.Left];
}
}
catch(Exception ex)
{
Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
}
Added to the project, added permissions for reading files, I get the path to the file. I press the button and silence... The file does not play... It does not even generate signals from examples
I check the wiki of NWaves. Playing and recording work only on Windows, since they use winmm.dll and MCI commands. You could use MediaPlayer
in Xamarin.Android instead.
string fileName = "WAV_1MG.wav";
var player = new MediaPlayer();
var fd = Application.Context.Assets.OpenFd(fileName);
player.Prepared += (s, e) =>
{
player.Start();
};
player.SetDataSource(fd.FileDescriptor, fd.StartOffset, fd.Length);
player.Prepare();
WAV_1MG.wav
file is in the Android Assets
folder with the AndroidAsset
Build Action.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.