• Welcome to Theos PowerBasic Museum 2017.

BassBox

Started by Patrice Terrier, October 08, 2007, 10:57:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge

These are two versions of Soundscape which should be free of glErrors, one of which Petr located in the Stars.

1. Soundscape.dll - a corrected version of the original with snowy peaks.

2. SoundscapeA.dll - an updated and racy version where the landscape is terraformed at the horizon, and flies forward at considerable speed.

I have switched back to using GDIplus. It is a little more suitable for our needs, but the FreeImage commands are still present in the TexImage Function, commented out. And it is nice to know that switching between the GDIplus and FreeImage is so easy.

Kent Sarikaya

Thanks Charles, the new A version is working nice and quickly but alas the flicker is back. The regular soundscape is working fine however now.
It must be something in my video card settings or installation as I am the only one having any problems, so don't worry about it.
I like this new version as the motion forward seems more natural and seeing the terrain in front spawning is nicer!

Charles Pegge

#377
Kent, this is an attempt at resolving the flickering problem. If it happens on your PC, it is bound to happen on others.

The scene rendering system is now two stroke. The first phase, prepares landscape strips and compiles them as required. The second phase deals exclusively with rendering. So glList building is not mixed in with scene rendering any more.

This plugin generates timing data in a file called SoundScapeReport.txt in the BBplugin folder.

Timings vary a lot but a typical set of figures on my PC looks like this:

Soundscape Diagnostics

Time Stamp Values in NanoSeconds:

Phase 1 prepare scene:  270763
Phase 2 render scene:   560572
2 Frame Interval:       33073730
wglMakeCurrent:         186194
clear buffers etc:      6574

Error checks:           0    0             0


The rendering only takes about 2% of CPU time and this does not seem to change by going into Max mode on my system.


Kent Sarikaya

#378
Thanks Charles, sorry to report flicker is there for soundscapeA, but soundscape original is fine.
The flicker is incredibly noticeable, and can be called tearing at fullscreen.

I do have vertical synch on in my video card as it says video synch set on with triple buffering gives good performance in speed. And I need that with this card as it is slow.

Here is my report listing, nice idea:
Soundscape Diagnostics

Time Stamp Values in NanoSeconds:

Phase 1 prepare scene:  18724440
Phase 2 render scene:   792080
2 Frame Interval:       80632500
wglMakeCurrent:         192911
clear buffers etc:      4451

Error checks:           0    0             0


Added after original post above:
Ok, I turned off vertical sync and disabled triple buffering, it cleared the problem. My frame rate went from 62fps to 66. Fullscreen there is a flicker now with 22fps but no massive tearing as before, obviously caused by slow video card.

Here is speed report with turned off settings:
Soundscape Diagnostics

Time Stamp Values in NanoSeconds:

Phase 1 prepare scene:  25743
Phase 2 render scene:   849023
2 Frame Interval:       58839843
wglMakeCurrent:         281991
clear buffers etc:      9880

Error checks:           0    0             0

Charles Pegge

Thanks Kent, that is very interesting. It may well be that Max Mode on 1280x1024 resolution is too close to the edge for many video cards. All the full-screen video games I have seen so far turn the resolution way down. This is disguised by clever shading but if you look at the screen closely, you can see how blocky they are. Online Java driven games tend to work the other way, often limiting the viewport to postcard size.

But hardware specs are evolving so rapidly - what was state-of-the-art four years ago is now standard kit for home PCs, so these limitations are likely to be very transient.

The performance data, averaged out over several frames can be used to control features or quality level.

The curious thing is that the Original Soundscape uses much more CPU than the new one - the entire landscape is generated with every frame without using glLists for the strips of landscape, yet your video card can handle it. Vulcan also works the video quite hard in terms of polygon count but mostly on a pre-compiled glList. I wonder if the performance of your card is limited by old drivers.


Petr Schreiber

#380
Hi Charles,

SoundscapeA rocks! That is exactly what I like!

Regarding technical issues, I still cannot see any problem here,
only tricky think could be creating display lists on the fly, not only in INIT section. I think this can make driver a bit scared, but as openGL reports no errors ... very interesting.

Regarding report, here it goes:

Soundscape Diagnostics

Time Stamp Values in NanoSeconds:

Phase 1 prepare scene:  16404
Phase 2 render scene:   883135
2 Frame Interval:       52824353
wglMakeCurrent:         129685
clear buffers etc:      176199

Error checks:           0    0             0


Kent, by flicker do you mean low framerate or really pulsing screen as on ZX spectum when too much lines rendered in combination with clear screen :) ?


Thanks,
Petr
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Charles Pegge

Thanks Petr, if we can get this working reliably, the technique can be used for generating all sorts of non-repeating terrains.

Kent,

To test the hypothesis that generating gLists on-the-fly is causing the flicker I have added an invisible control to this version of Soundscape.

If you click on the top left corner of the scene (within 100 pixels) the landscape loop will be locked, and the landscape strip lists will not be renewed. The terrain will repeat itself in an endless loop and you will see gaps where it turns over. Clicking again will unlock the landscape enabling list generation again.

Locking the landscape in this way should eliminate the flicker. If not, then the problem lies elsewhere.

Thanks!


Patrice Terrier

Indeed I can also see, from time to time, a kind of fugace redrawing echo that occured on the bottom of the screen especialy when there is a sound peak level

For me this is more an error in the programming loop, than a video graphic card problem.

I think that it occures while the current audio is being moved at the end of the list, then sometimes the peak are drawn hover the first plan, "looking like" flickering.

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Kent Sarikaya

Guys, thanks for new versions. In regular screen size, it works fine. When I go fullscreen it steps and that is probably because of my video card not being able to handle the resolution at fullscreen.

Clicking on the corner made no difference in the stepping /flicker like feel. So it has to be my card. Since it runs fine at normal screen size, I am very happy, that is what I normally run it at unless I go to the couch and just relax and watch and listen from there.

Charles Pegge

Well that indicates the technique is basically sound, thank you Kent. I will just have to watch out for fall-offs in performance.

Another thing you may have noticed is that if you click on the Vulcan scene, the terrain stops moving momentarily - the picking procedure seems to be inefficient at checking through a large number of polygons. - it seems to be much slower than rendering, - probably doing most of the work client-side. So I'll have to simplify the scene construction when in SELECT mode, which can be easily done by reducing the recursion level. Each step reduces the polygon count by a factor of 4.

Patrice, I'll see if there is a way of clamping the frame rate more precisely. I think it can be done on the Plugin side, locking into 60 fps for example. This would help slow moving plugins.

Patrice Terrier

#385
--Charles

I have attached a modified version of SoundscapeAA.bas using WimDATA instead of FFT and a new OGG file to help you diagnostic the problems.

While playing bennybenassi.ogg you will see the flickering when there are huge peak levels, and also the sound distortion that could occure when playing full screen.

As i said already, the flickering is caused by the current curve being drawn in the front before being moved in the background.

To see the change i have done, search for '//PATRICE in the source code.

...
 
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

Scary peaks and fortresses of harmonics! After securing my speakers to the floor with Monti bolts, I played in full screen mode. but no audio distortion occurred on my XP machine.

In this version I have put in an attenuation function so their size will always be limited no matter what the volume might be - the peaks will scale down. Normal sensitivity is restored between tracks, when there is a mute period. Peaks at the very front will shrivel to minimise flashing in front.

Many thanks for giving this your attention Patrice, I hope the above steps will resolve the audio distortion on your system.


                 DO
                     IF k>=64 THEN EXIT DO
                     v=SQR(fft(k))*8*atten
                     IF v>4 THEN atten=4/v ' attenuation
                     IF v=0 THEN v=RND*.4: atten=1 ' restore sensitivity
                     vf(i1)=v
                     'vf(i1)=vf(i1)*.5+SQR(fft(k))*4 ' averaged height
                     INCR k: INCR i1
                 LOOP



Patrice Terrier

#387
--Charles

The new Soundscapea version solved the loop problem that caused the "flickering".

There is still sound distortion, however it could be very limited in using
v=SQR(fft(k+8))*8 ' avoid to use the first FFT values to suppress sharp drawing on the left side
instead of
v=SQR(fft(k))*8*atten



Soundscape Diagnostics

Time Stamp Values in NanoSeconds:

Phase 1 prepare scene:  21584748
Phase 2 render scene:   953664
2 Frame Interval:       41847564

Frame interval rt       :    2.09685867896618E-2
Frame per sec rtt       :    47.6903861014149

QueryPerformance Frequency:  14318180
QueryPerformance Counter:    50001799164
Time Stamp:                  6968873829435

Error checks:           0    0             0
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

Yes adding an offset of 8 to avoid the base frequencies, gives a more even landscape. I have tried it with a variety of music and it looks okay. The base frequencies are quite interesting so I can still use them in another way.

But that that help to improve the audio quality on your PC?

The diagnostics show quite a high frame rate (it measures pairs of frames.). It should be around 30-33 but your sample shows 47 fps. The test only measures the last frame pair but I have not seen a figure that high on my machine.

Patrice Terrier

#389
--Charles

Yes, using an offset of 8 suppresses the lows level frequencie peak on the left and help to produce a softer landscape drawing.

I use the bennybenassi.ogg file to stress all my visual plugins and see if they don't produce audio distortion without using the equalizer. Of course if your turn On the equalizer altogether with bass boost, it is quite easy to produce saturation that would cause sound distortion.

My sample shows 47 fps, because I am using VISTA that is highly optimized to perform 3D operation and is a top notch for any intensive graphic application, on that aspect BassBox is a very good prototype to fetch the DWM VISTA limits.
All my tests are done in dual screen mode, with BassBox runing in 1680 x 1650 in plain 32-bit mode and full DWM composited mode.

The same thread handles OpenGL and GDIPLUS (the drawing of the view meter + oscilloscope). Audio decoding is processed in another thread.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com