After several days of happily using your wrappers I have encountered a problem with creating and turning on a DSP unit.
Actually all works well in the “FSOUND_DSP_Create” function but the actual activation of the DSP unit in the “FSOUND_DSP_SetActive” function causes fmod.dll to crash.
—– code snippet ——
dspCallBack = new FSOUND_DSPCALLBACK(DspCallbackHandler);
FmodManaged.FSOUND.Function.Initialization.FSOUND_Init(44100, 32, 0);
ptr1 = FmodManaged.FSOUND.Function.DSP.FSOUND_DSP_Create(dspCallBack.Method.MethodHandle.GetFunctionPointer(), FmodManaged.FSOUND.Enums.FSOUND_DSP_PRIORITIES.FSOUND_DSP_DEFAULTPRIORITY_USER, IntPtr.Zero);
FmodManaged.FSOUND.Function.DSP.FSOUND_DSP_SetActive(ptr1, true); // Causes fmod.dll to crash.
—– code snippet ——
With kind regards,
- Xipetotec answered 13 years ago
I have this :
private IntPtr mStream;
private int mChannel = -1;
public delegate void DelegateStreamDSPCallback(ref IntPtr originalbuffer, ref IntPtr newbuffer, int length, ref IntPtr userdata);
FmodManaged.FSOUND.Function.Initialization.FSOUND_Init(44100, 1024, FmodManaged.FSOUND.Enums.FSOUND_INIT_FLAGS.FSOUND_INIT_STREAM_FROM_MAIN_THREAD);
FmodManaged.FSOUND.Function.Initialization.FSOUND_SetBufferSize(1000 * 4096 / 44100);
// create stream
mStream = FmodManaged.FSOUND.Function.Stream.FSOUND_Stream_Open(pSource, FmodManaged.FSOUND.Enums.FSOUND_MODES.FSOUND_MPEGACCURATE, 0, 0);
IntPtr dsp = FmodManaged.FSOUND.Function.Stream.FSOUND_Stream_CreateDSP(mStream, new DelegateStreamDSPCallback(StreamDSPCallback).Method.MethodHandle.GetFunctionPointer(), 0, IntPtr.Zero);
mChannel = FmodManaged.FSOUND.Function.Stream.FSOUND_Stream_Play((int)FmodManaged.FSOUND.Enums.FSOUND_MISC_VALUES.FSOUND_FREE, mStream);
Now, i want to get the data through the dsp callback… with the function here :
public void StreamDSPCallback(ref IntPtr originalbuffer, ref IntPtr newbuffer, int length, ref IntPtr userdata)
byte bufferTmp = new byte[length * 2];
System.Runtime.InteropServices.Marshal.Copy(originalbuffer, bufferTmp, 0, length * 2);
but the program crashes when it gets to the Marshal Copy…
what am I doing wrong ? and moreover, why is length =~ 200 000 000 …
Based off the .net interface provided here, I have made the "X Sound Engine". You can download it here at [url:26x8uj6s]http://thp.x10hosting.com/downloads/xsoundsystem.zip[/url:26x8uj6s].
This is 0.1 version of it. Features at the moment are:
- Access to FSound functions
- Access to FMusic functions
- Access to Channel functions
- Access to Sample functions
All the functions are not complete but this has been tested and it works for playing music or sound. Since it has access to FMusic functions, you can now play all modules sound files (Ex. midi, mod, s3m, it, ect.). You will have to put the fmod 3.7.5 dll in the directory of where the application that you want to use this is located for this engine to work. If you find a problem send a private message to me and I’ll get to it when I can. Enjoy!
- trueamer3 answered 10 years ago
I got an error using sound wrapper in .net on HP ipaq h1915..When trying to initailaze next error is ocuring…
A managed NullReferenceException occured at form1::.ctor+0x29
OK to terminate
It seems to be problem with sample rate,buth i change it and it still come with same error..
Before sending the code (that is really complex, because it is part of a big mess… that works with other decoders, such as FmodEx..), could you tell me how you did use the callback for DSP (you said you tried to reproduce the “bug”..) ?
I don’t know how to set up a callback for the dsp, tu capture the samples while they are read…
[quote="dariofmod":3pi1axmw]how to use fmod managed??it doesent hawe any samples…Can you maby sent me some examples??
Sorry. I’m not in my house today. Tomorrow i send sample…
For you error mmm… you can send a sample your code?
I am new to the FMOD.NET thing, arn’t we all ?
But I must say it looks promising.
How ever, I cant figure out how to get the callback to work.
I am using a deligate issn’t this the way its done ?
FmodManaged.FSOUND.Function.Stream.FSOUND_Stream_SetEndCallback(PlayerStream,new EndFile(EndFileFunction).Method.MethodHandle.GetFunctionPointer(), IntPtr.Zero);
This does not work, infact it litteraly crashes my session !
I am using the same code as in test sample for sound.dll wraper, I build wraper with fmodce.dll and in test example code i only changed line with mixRate:
sound = new SoundEngine();
s = new SoundStream(“\Windows\test.mp3”, Modes.Hardware2D);
sample = new Sample(“\Windows\tada.wav”, Modes.Bits16 | Modes.Stereo);
c = new Channel(s, sound);
d = new Channel(sample, sound);
I’m using goldfix’s FmodManaged.dll, and I’m having problems with FSOUND_Stream_GetTagField. Here’s the declaration from Function.Stream.cs:
public static extern bool FSOUND_Stream_GetTagField(IntPtr FSOUND_STREAM_stream,int num,ref FmodManaged.FSOUND.Enums.FSOUND_TAGFIELD_TYPE type,ref string name,IntPtr val,ref int length);
And here’s the bit of code I’m using to try this function out:
FmodManaged.FSOUND.Enums.FSOUND_TAGFIELD_TYPE Ftype = new FmodManaged.FSOUND.Enums.FSOUND_TAGFIELD_TYPE(); IntPtr val = new IntPtr(0); string name = ""; int num = 1; int length = new int(); FmodManaged.FSOUND.Function.Stream.FSOUND_Stream_GetTagField(i, num,ref Ftype,ref name,val,ref length);
These are the variable values after stepping through the function:
Ftype = FSOUND_TAGFIELD_ID3V1
length = 12
name = “ARTIST”
val = 0
So it seems that everything is working except for using IntPtr for val. Am I doing something incredibly stupid?? Is there a way to make this work? Any help would be appreciated…
That error i Posted before is not as I post..I it almost same but it come with fmod error line,and error initilazing sound engine..Probaly i dont declare everything correctly..Or maby i chosse wrong fmod wersion.I hawe HP IPAQ 1915 ,and I am not sure should i use ARM,MIPS,SH3 OR X86,and also what version of windows to use,WINCE,WINCE4 OR WINCE211…That confuse me.If fmod wersion is not ptoblem,than i declare something wrong.I despertly need some help because i work an mp3 player for pocket pc for my final year project in high school..If anyboy make fmodce working with vb.net please send me the code.My email is firstname.lastname@example.org..Thanks.
New version for FmodManaged:
0.5.0.0: First Version
0.6.0.0 (this ver.): Add: 3D Function
Add: Documentation XML Code (approximately 40-45%)
Correct: CD Function
EDIT: posted in the wrong thread :p
I did make a modification to goldfix’s wrapper, though: I changed FSOUND_Stream_SetSubStreamSource from taking a ref int to an int*. You have to use unsafe code, but it’s the only way I could get it to work.
- Flecko answered 12 years ago
Please login first to submit.