English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 12 January 2017, 16:23   #21
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,646
I wonder if Shatterhand's problem would go away if he has a routine synced to CIA. What do you think?
Amiga1992 is offline  
Old 12 January 2017, 16:53   #22
Anakirob
Unregistered User
 
Anakirob's Avatar
 
Join Date: Nov 2005
Location: Tasmania
Age: 42
Posts: 893
Quote:
Originally Posted by Akira View Post
I wonder if Shatterhand's problem would go away if he has a routine synced to CIA. What do you think?
That is the general concensus, but unfortunately Blitz's CIA module playing routines are for >WB2. Adapting a 68k replayer would be one solution, but I imagine that is probably a little bit beyond Shatterhand's Amiga coding skills at the moment. It's not quite as simple as just copying the ASM code into your Blitz code, there are a few restrictions on which registers can be used safely for one thing.
Anakirob is offline  
Old 13 January 2017, 05:13   #23
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
Just to let you guys know.. today I had a full day, I got home like 1 Am. It's about 2 am right now and I need to go to bed.

But I did a quick test with Winuae putting the Playmed command BEFORE the VWait instead of after like the manual suggests.

The flicker is gone on Winuae. Tomorrow I'll test in real hardware because I really need to go to sleep now.

And I just found out the crash I had using this library had nothing to do with playing music, but with another problem with the code (if you don't press enter in your last line of code Blitz will ignore it, heh )
Shatterhand is offline  
Old 13 January 2017, 06:58   #24
Anakirob
Unregistered User
 
Anakirob's Avatar
 
Join Date: Nov 2005
Location: Tasmania
Age: 42
Posts: 893
Quote:
Originally Posted by Shatterhand View Post
Just to let you guys know.. today I had a full day, I got home like 1 Am. It's about 2 am right now and I need to go to bed.

But I did a quick test with Winuae putting the Playmed command BEFORE the VWait instead of after like the manual suggests.

The flicker is gone on Winuae. Tomorrow I'll test in real hardware because I really need to go to sleep now.

And I just found out the crash I had using this library had nothing to do with playing music, but with another problem with the code (if you don't press enter in your last line of code Blitz will ignore it, heh )
Allow me to reiterate. You really want to execute that PlayMED command during the VBlank, not before or after it.
Anakirob is offline  
Old 14 January 2017, 02:04   #25
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
Quote:
Originally Posted by Anakirob View Post
Allow me to reiterate. You really want to execute that PlayMED command during the VBlank, not before or after it.
NO NO NO MAN let me be stubborn and try out things the wrong way

Yeah, I wasn't going to mess with code yesterday, I got home really tired, but it came to my mind that if the routine was making sprites at the top of screen flicker, if I executed it at the end of the frame (while the video beam would be closer to the bottom), maybe it would stop the flicker.

It was more an investigating curiosity than an attempt to do something right.

I tried doing

setint 5
playmed
endint

and I got a nasty and quick Guru as soon as the code reaches the setint 5 command while testing on Winuae.

I'll try on real hardware to see if I still have the same problem.

By the way, thank you a lot for trying to help me. I wrote a "thank you" section on my game for everyone helping me out here, I am really very grateful for all the help I am getting here at EAB (not that would expect any different )
Shatterhand is offline  
Old 14 January 2017, 03:14   #26
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,547
Quote:
Originally Posted by Shatterhand View Post
NO NO NO MAN let me be stubborn and try out things the wrong way

Yeah, I wasn't going to mess with code yesterday, I got home really tired, but it came to my mind that if the routine was making sprites at the top of screen flicker, if I executed it at the end of the frame (while the video beam would be closer to the bottom), maybe it would stop the flicker.

It was more an investigating curiosity than an attempt to do something right.

I tried doing

setint 5
playmed
endint

and I got a nasty and quick Guru as soon as the code reaches the setint 5 command while testing on Winuae.

I'll try on real hardware to see if I still have the same problem.

By the way, thank you a lot for trying to help me. I wrote a "thank you" section on my game for everyone helping me out here, I am really very grateful for all the help I am getting here at EAB (not that would expect any different )
did you do the setint after entering Blitz mode..?
earok is offline  
Old 14 January 2017, 05:32   #27
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
I tried after, tried before and also tried as the very first instruction of the code (before Blitz).

Debugging, as soon as I get in the setint 5 line, I get a guru.
Shatterhand is offline  
Old 14 January 2017, 06:58   #28
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
No problems using SetInt on real hardware, gotta be something with my Winuae configuration.

But using playmed on the VBlank interrupt made things even worse, even more flicker and artefacts appearing randomly on screen.

I found this interesting because I can play music even while loading files (this worked really well).

The best result I got so far was doing the playmed before VWait, this eliminates any flicker, but like Anakirob pointed out, when I miss a frame the music slows down (also I miss frames where I wasn't missing without music... without music I can have my boss firing 12 bullets at the same time while keeping moving without problem. With the music playing this send me to slowdown land).

Well.. anyone has any other ideas? I am all open to any suggestions. If you guys thinking I may be doing something really stupid, don't hold off and tell me please And yes, I am displaying the correct bitmap with the double buffer routine.

I am using 12 queues for the QBlits, could this be a problem? I had to raise the number of queues on the compiler option. I did it like that because I have some stuff being drawn/erased at different moments and I thought it would be better this way. I am pretty sure I can make it with less queues if needed.

Maybe something else I could change on the Compiler options? (I am already selecting "make smallest code" and turning off runtime debug)

Also, I have a display palette command running every frame, I was worried this could be causing trouble, but turning it off didn't make the flicker go away.


This is frustrating me a little bit. I am thinking about trying that Kick2 library, if I can make it work better, just make the game check if the user have 2.0 kick or not. If it does, use it. It now, use playmed before the VWait and deal with slowdown, but it's far from being the best solution.
Shatterhand is offline  
Old 14 January 2017, 08:46   #29
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
SOLVED. YEAH!

I was getting ready to going to bed when something came to mind, so I knew I wouldn't sleep if I didn't test it before.

Every example on Blitz Manual puts the Vwait BEFORE the DisplayBitmap.

I tried putting the Vwait AFTER the DisplayBitmap command.

Everything works like a charm now, using the VBlank interrupt to play the music flawless. No flicker, no artefacts on screen, everything working perfectly on my A600.

I am very happy now. Anakirob, THANK YOU A LOT for your tips, and thank you everyone.
Shatterhand is offline  
Old 15 January 2017, 04:39   #30
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,348
That doesn't make sense. Does VWait wait for too long?
idrougge is offline  
Old 29 January 2017, 03:39   #31
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
I dont know. I just thought that displaying the bitmap and playing the module were fighting for time in the beginning of the frame. So I display the bitmap as the last thing instead of the first and things worked.

I am not sure if this makes any sense, I was just thinking along the lines Earok settled

Now I was having trouble using SFX and Music together... the music uses just channels 0,1 and 2 while the sfx uses sound 3. Music would *still* mute the sfx.

So I found about the SetMedMask command, which let you choose what channels you're going to use for playing the song. Except it wasn't working, up until I put it right before the PlayMed command on the Interrupt #5.

I don't know if this makes sense either, but it only worked like this.
Shatterhand is offline  
Old 29 January 2017, 11:23   #32
Master484
Registered User
 
Master484's Avatar
 
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 525
I just tried to replicate this problem with my Megaman X code, which also plays MED modules.

My normal Main Loop does things in this order:

-----------------
VWAIT

Show bitmap
Playmed

Draw graphics
-----------------


And this works OK.

But then I tried to change the order of Show and Playmed, so that it looked like:

-----------------
VWAIT

Playmed
Show bitmap

Draw graphics
-----------------


And with this command order I started getting problems; not flicker, but scrolling and graphics started "jumping". I think this happened because the Playmed command takes so much time to execute, and so the "Show" is executed too late; the display beam has already drawn the upper parts of the screen when Show finally happens.

And if my code would use a standard Double Buffering method instead of Single Buffering, then I guess also flickering would have happened.

---

So maybe the problem that you had was just the order of the commands after VWAIT: "Show" or "DisplayBitmap" should always be the first command that happens after VWAIT, and Playmed and everything else should come after these.

And although you already solved the problem by moving the DisplayBitmap command before Vwait, you could also try out that simple command order of "VWAIT - DisplayBitmap - PlayMed".

Because right now, even if your code works without flicker, with DisplayBitmap located before VWAIT, I think this also means that the bitmaps now get flipped in the middle of the frame, because the display beam has not yet drawn the full screen when DisplayBitmap happens, and I think this could cause some "screen tearing" effects, meaning that the upper screen half displaying the previous frame and the lower half displaying the current frame.

Quote:
Now I was having trouble using SFX and Music together... the music uses just channels 0,1 and 2 while the sfx uses sound 3. Music would *still* mute the sfx.

So I found about the SetMedMask command, which let you choose what channels you're going to use for playing the song. Except it wasn't working, up until I put it right before the PlayMed command on the Interrupt #5.

I don't know if this makes sense either, but it only worked like this.
I too have had this music + sound effects problem, I have to try out this command...although I think I tried it once, but it didn't work, but most likely that is the reason; it has to be located right before PlayMed, so I'll try if it works that way.

Command order seems to be very important in Blitz, I have noticed that all Sprite commands too are very "orderly", maybe because they too are "channels", just like the sound channels.
Master484 is offline  
Old 29 January 2017, 15:49   #33
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
I am doing the playmed command on the VBlank interrupt like it has been suggested here, so the playmed command is always executed even if the game skips a frame (and it does happen).

Doing the way you are doing, the music will slowdown together with the game and this is awful.


One interesting thing when doing this is that you can play music at *any* point of the program, even while loading files or while the game is doing something out of the main loop, for example.
Shatterhand is offline  
Old 29 January 2017, 20:03   #34
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,348
Indeed it makes sense to flip the screen before playing sound. It is of utmost importance that the screen is flipped in the vblank interval, and it is an atomic operation of a constant cycle count. A sound routine may or may not take so long on any given frame that the screen flipping is delayed until the raster beam has already started redrawing the old screen.
idrougge is offline  
Old 07 February 2017, 08:22   #35
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,348
Try the Enhanced Music Library: http://aminet.net/package/dev/basic/eml17b
Quote:
"What is the Enhanced Music Library?"

Basically, the Enhanced Music Library is my attempt to port my Enhanced
Music Extension for Amos/AmosPro to the Blitz Basic 2 environment.

The library itself is quite similar to it Amos counterpart, featuring:

The new features include:

o FULL Protracker CIA Playroutines (VBL also supported)

o Tracker support commands to change volume, read titles etc

o Improved tracker looping

o Control of tracker voices (on/off)

o Functions to return song information including current pattern,
songlength, sample periods etc.

o Functions to return instrument information and parameters
idrougge is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Shapes Retro1234 Coders. Blitz Basic 53 17 March 2017 11:41
HippoPlayer very slow down system when playing module michaljarz support.WinUAE 6 21 February 2016 20:34
Shapes (PD) Devlin HOL data problems 0 17 July 2015 19:03
FS: Scandoubler/Flicker Fixer DCE Flicker Magic lopos2000 MarketPlace 15 23 October 2007 11:18
What Makes a Game Worth Playing for You? Dastardly Retrogaming General Discussion 7 09 April 2004 21:49

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:26.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09694 seconds with 12 queries