Closed robertmccraith closed 10 years ago
Can you please provide more information about exception? The message, stack-trace, a minimal code that can reproduce it, from what folder you reference SharpDX assemblies, what version is used, etc.
The following code works fine on both WP8.1 emulator and real device (NL920):
var xAudio = new XAudio2();
xAudio.StartEngine();
using (var s = new NativeFileStream("ergon.wav", NativeFileMode.Open, NativeFileAccess.Read))
using (var ss = new SoundStream(s))
{
// mandatory, otherwise SourceVoice creation fails.
var mv = new MasteringVoice(xAudio);
var sourceVoice = new SourceVoice(xAudio, ss.Format, VoiceFlags.None, XAudio2.MaximumFrequencyRatio);
sourceVoice.SubmitSourceBuffer(new AudioBuffer(ss.ToDataStream()), null);
// 2 different classes here, both seem to work:
//var reverb = new SharpDX.XAudio2.Fx.Reverb();
var reverb = new SharpDX.XAPO.Fx.Reverb();
var effectDescriptor = new EffectDescriptor(reverb);
sourceVoice.SetEffectChain(effectDescriptor);
sourceVoice.EnableEffect(0);
}
xAudio.StopEngine();
I haven't tested it further, but no exceptions are thrown in the fragment above. You can insert it in any WP8.1 project using SharpDX.dll
and SharpDX.XAudio2.dll
.
Hi, Thank you for the response. I'm afraid I get the same error with this code also. I got SharpDX 2.6.2 from NuGet and have
using SharpDX.IO;
using SharpDX.Multimedia;
using SharpDX.XAudio2;
using SharpDX.XAPO.Fx;
in the file. The SetEffectChain gives this as its message:
A first chance exception of type 'SharpDX.SharpDXException' occurred in SharpDX.DLL
HRESULT: [0x88960001], Module: [SharpDX.XAudio2], ApiCode: [XAUDIO2_E_INVALID_CALL/InvalidCall], Message: Unknown
With stack trace:
at SharpDX.Result.CheckError()
at SharpDX.XAudio2.Voice.SetEffectChain(Nullable`1 effectChainRef)
at SharpDX.XAudio2.Voice.SetEffectChain(EffectDescriptor[] effectDescriptors)
at App1.DXPlayer.WavePlayer.PlayWave()
And data:
System.Collections.ListDictionaryInternal
XAUDIO2_E_INVALID_CALL
signals about an API usage issue. Can you try to upgrade to SharpDX v2.6.3, create and empty WP8.1 project, insert the code I posted into MainPage.OnNavigatedTo
method and run it. If it will crash - zip the project and send it to me (via OneDrive, Dropbox or whatever) so I can check it on my side.
Btw, have you tried to run this on emulator or on a real device?
I sent you an email with the zip of the project. I have tried both the emulator and on a NL820.
I didn't received any emails, looks like you sent it to wrong address. Please share it via any available file sharing service.
2014-07-17 19:35 GMT+01:00 robertmccraith notifications@github.com:
I sent you an email with the zip of the project. I have tried both the emulator and on a NL820.
— Reply to this email directly or view it on GitHub https://github.com/sharpdx/SharpDX/issues/447#issuecomment-49346093.
Ok its up on google drive here: https://drive.google.com/folderview?id=0B3_6lu-PFrauMkNpTFNKcUtHUmM&usp=sharing
Ok, I have investigated your sample project and found that the sound file you are using is not supported by the Reverb
effect. The sound file has the following format: 8bit, 11kHz, 1 channel, while the effect you are trying to create requires it to be at least 20kHz. Try to use a sound effect from the sample and you will see that it works properly.
I'm closing this issue as it is an invalid API usage and not a problem with SharpDX itself.
Ok thank you for all the help.
Calling SetEffect on a SourceVoice raises an exception on Windows Phone 8.1.
var sourceVoice = new SourceVoice(xAudio, w.WaveFormat); sourceVoice.SubmitSourceBuffer(w.Buffer, null);
var reverb = new Reverb(); var effectDescriptor = new EffectDescriptor(reverb); sourceVoice.SetEffectChain(effectDescriptor); sourceVoice.EnableEffect(0);