1st, Brett that new dll i got works GREAT, fixed the FX to work globally but, when I use a stream, no ‘spectrum’ or for that matter ‘VU’ is ever returned. Oddly it works perfectly for FMUSIC such as xm’s, it’s, ect. If I remove FSOUND_HW2D Or FSOUND_ENABLEFX, it works just great for streams. Anyhow just thought I’d let ya know. If you have a new dll just email it to me at firstname.lastname@example.org
Ok Adion and others. I was fooling around with that spectrum code you sent me and I Just can’t seem to get it to work real well, I mean it does, but its not terribly accurate. I am sampling and drawing at 10ms, and use the following code which is a slightly modied version of what Adion has posted. In respects to a visual showing the spectrum I find that just usign FMODS raw spectrum and drawing lines based on the 1st 50 or so elements from the array is much more accurate, so i was wondering if you Adion or someone else has perfected it. I will post my snip here
First I draw on a hidden picture then blit it on the next frame to the actual display. 2nd I have preset in an array called PreCal the orginal values which i will paste first.
For a = 0 To 15 If a = 0 Then d = 2 If a = 1 Then d = 2 If a = 2 Then d = 3 If a = 3 Then d = 4 If a = 4 Then d = 5 If a = 5 Then d = 7 If a = 6 Then d = 9 If a = 7 Then d = 11 If a = 8 Then d = 14 If a = 9 Then d = 17 If a = 10 Then d = 21 If a = 11 Then d = 26 If a = 12 Then d = 32 If a = 13 Then d = 38 If a = 14 Then d = 45 If a = 15 Then d = 52 preSpec(a) = d Next a
Now for the acutal function.
Public Sub DrawSpectrum()
Dim myPT As POINTAPI
Dim interval As Double
Dim height As Long
Dim hdc As Long
Dim a As Long, b As Long, c As Long, d As Long
Dim tmpVal As Single
Dim DDD As Double
Static total(31) As Single
If SmallMode = True Then Exit Sub If isMinmized = True Then Exit Sub If Mp3Player.IsPlaying = False Then Exit Sub Call GetSpectrum(Spec) Call BitBlt(picSpectrum.hdc, 0, 0, W, H, Picture1.hdc, 0, 0, SRCCOPY) picSpectrum.Refresh Set Picture1.Picture = Nothing hdc = Picture1.hdc interval = Picture1.Width / 16 b = 0 Dim cnt As Single For a = 0 To 15 d = preSpec(a) cnt = 0 For c = 1 To d cnt = cnt + Spec(b) b = b + 1 Next If Not cnt = 0 Then total(a) = (total(a) * 1 + Log(cnt)) / 2 Else total(a) = (total(a) * 9) / 10 End If tmpVal = (total(a) + 1) / 2 Call MoveToEx(hdc, interval * a, H, myPT) Call LineTo(hdc, interval * a, (H - (tmpVal * H))) Next
If someone has done a really nice spectrum that is both accurate and fast please post them here.
VU, spectrum and global dsp effects do not work on hardware streams because hardware streams are mixed by directsound, not by fmod. This means fmod does not get the mixed data on which it would do the spectrum analysis.
I suppose by accuracy you mean it only has 16 bars? I think it can be more accurately by spreading the values over more bars, but I haven’t found yet what numbers to take for a realistic balance. I guess it’s logarithmic but I haven’t tested yet.
I will let you know if I have it.
- Adion answered 16 years ago
Sigh, I’ve used a filter and divided the spectrum into a set number of frequencies, lokos pretty good, not as fast as I would like to do it but that will prbobably be solved once I port it to C++ anyhow.
One thing I would like to see is the help files updated, it woulda saved me alot of work if I had known the EQ would stop VU/spectrum from working, oh well easier to rip then create I guess. I’ll miss the FX effects but I really like the displays, and i’am not about to loose the specturm display/VU meter for FX.
Please login first to submit.