0
0

Does anyone know why the following code snippet doesn’t quite work:

Begin sub …

Dim samplesR(44100) As Long
Dim I As Single

Fill array with sine values
For I = 1 To 44100: samplesR(I) = 32767 * Sin(2 * (3.141592) * (Base) * (I / 44100)): Next

FMOD Allocate,upload, play, loop and pan right
sampleHandle2 = FSOUND_Sample_Alloc(FSOUND_FREE, 44100, FSOUND_NORMAL, 44100, 255, 255, 255)
FSOUND_Sample_Upload(sampleHandle2, samplesR(0), FSOUND_NORMAL)
sampleChannel2 = FSOUND_PlaySound(FSOUND_FREE, sampleHandle2)
FSOUND_SetLoopMode sampleChannel2, fsound_loop_normal
FSOUND_SetPan sampleChannel2, 255 ‘Full Right

End Sub …

Base is a global integer frequency ie. 100,200,330,700 etc.

Problem (1) Why is the resulting sound frequency much lower than the Base (about half)?
Problem (2) Why do even Base frequencies play fine while odd ones pick up a slight tick on the loop, indicating a wave cycle mismatch, even though the data looks OK?

Someone mentioned a similar problem in one of the other threads using VC and callbacks.
The suggestion was made that the problem was caused by buffer handling under FMod and in the case of callbacks, a local vs. a global time-slice counter.

  • You must to post comments
0
0

have you tried doing upload with the FSOUND_MONO flag?

  • You must to post comments
0
0

you might also want to specify fsound_16bits to force fmod to treat your samples as 16 bits also is long a 16bit data type?

  • You must to post comments
0
0

Thanks Birty. I tried the _Mono flag by itself and guess what? We have discovered a brand new way to make a busy signal.

I do think, However, that you may be zeroing in on the problem.

FSound_Normal is _16bits or’ed with _Signed and _Mono. An Integer in VB is 16 bits and that’s all I really need, but I was forced to use A Long (32 bits) so I could get a handle on the array to pass to FMod.

The problem with using Mono instead of stereo is that I am trying to direct different frequencies to right and left and I don’t think that you can do that with Mono.

  • You must to post comments
0
0

[quote="RonM":3g9cet69]
The problem with using Mono instead of stereo is that I am trying to direct different frequencies to right and left and I don’t think that you can do that with Mono.[/quote:3g9cet69]
i think if you use two mono samples an pan one left and one right then this should work

  • You must to post comments
0
0

If I can pan left and right using Mono, it would be the same as what I am trying to do, but remember, when I use stereo I get a nice wave on even frequencies and a click on odd, but when I use mono alone I get a beep..beep..beep, sounding like a busy signal on all frequencies.

I am starting to feel that FMod is just not for VB programmers. The only sample given is “Simplest”, and it’s an uphill battle trying to accomplish anything even remotely complex, such as callbacks.

I tried to shift to VC, not really my thing, but couldn’t even link to fmodvc.lib ( fatal error LNK1106). Maybe God is trying to tell me something (not you, Brett)! So it’s back to the drawing board, for me.

  • You must to post comments
0
0

RonM tell me your e-mail address and i’ll try and help you

  • You must to post comments
0
0

[quote="RonM":65w44fnd]
I am starting to feel that FMod is just not for VB programmers. The only sample given is “Simplest”, and it’s an uphill battle trying to accomplish anything even remotely complex, such as callbacks.
[/quote:65w44fnd]

I have done a lot of work with VB and FMOD using callbacks, if you send me your code via email I could help you with it!! It is true that fmod doesnt come with a very complete example, but there are a lot of things that fmod is capable of that is available through VB.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.