English Amiga Board


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

 
 
Thread Tools
Old 21 October 2019, 17:44   #61
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
An update to the latest version of Phx's library is probably overdue. :/
idrougge is offline  
Old 18 November 2019, 11:35   #62
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Quote:
Originally Posted by idrougge View Post
An update to the latest version of Phx's library is probably overdue. :/
I used a diff tool in an attempt to build a 5.3 version of this library. Got nowhere though. I'm not familiar with assemblers, I tried Asm-One, but get an error at the first astatement, next line "args word,byte" throws an error: "Illegal operand". What assembler did you use to build this and what extra steps would one need to take?

Attached is the updated source if you want to try and build it.

Last edited by MickGyver; 27 November 2019 at 08:41. Reason: Removed the attached source, not needed any more.
MickGyver is offline  
Old 18 November 2019, 12:02   #63
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
I tried VASM, there I get a few errors about missing symbols (runerrs, _soundobjectcheck and _volumecheck). Searched the sources and it seems that those symbols are indeed missing.

EDIT: I replaced the symbol names with zeroes, it then compiles, I get no errors when I run an example, but only get silence. Building the source on GitHub with vasm also results in just silence, no errors or crashes. Maybe that version you (idrougge) uploaded to GitHub is an older unfinished version?

Code:
error 3009 in line 7 of "libheader": undefined symbol <runerrs> at CODE+0x2c, reloc type 1
        called from line 112 of "ptplayer.asm"
>            Dc.l    \4,0,0,0,\5

error 3009 in line 2 of "subs": undefined symbol <_soundobjectcheck> at CODE+0x202, reloc type 1
        called from line 153 of "ptplayer.asm"
>            Dc.w    \2

error 3009 in line 2 of "subs": undefined symbol <_volumecheck> at CODE+0x270, reloc type 1
        called from line 159 of "ptplayer.asm"
>            Dc.w    \2

Last edited by MickGyver; 18 November 2019 at 19:30.
MickGyver is offline  
Old 27 November 2019, 08:40   #64
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Since I couldn't get any sound from idrougge's source when compiling with VASM, I started from "scratch" with the v5.3 source and referenced the library source based on v5.0 by idrougge. This version might still need some fixes, I have not tested everything thoroughly yet.

Attached is version 5.3 of the bb2 library, with an added statement (below). All the statements from v5.0 work but the author of the original library (phx) recommends to use the new MTPlayFX statement instead of MTSoundFX.

New statement and newtype to use with it
Code:
MTPlayFX sfxStructAddress.l

NEWTYPE .sfx
  sfxPtr.l ; Pointer to sample start in chip ram, even address
  sfxLen.w ; Sample length
  sfxPer.w ; Hardware replay period for sample
  sfxVol.w ; Volume 0..64, is unaffected by the song's master volume
  sfxCha.b ; 0..3 selected replay channel, -1 selects best channel
  sfxPri.b ; unsigned priority, must be non-zero
End NEWTYPE
The archive includes an include file with the sfx structure as a newtype, and a statement to initialize the newtype from a sound object. Also included is the source, an example and a .bat file with the command used to compile the library using VASM.

Changelog (for the original library)
Code:
5.1:
- Included C header file, ptplayer.h, provided by BSzili.
- Fixed bug where other level 6 interrupts could trigger sample replay.
- Eliminated relocations in the fine-tune table, by replacing pointers
  with word-offsets (asman).
- More optimizations in the Timer B interrupt handlers and made it
  PC-relative (asman).
- Include a public domain license.

5.2:
- Make it work with broken mods, which have a sample repeat length of zero.
- Never break looped samples with sound effects, except we have looped
  samples on all four channels at once!
- New variable _mt_SongEnd to automatically stop the song when having
  played the last position. Don't use it! Doesn't work perfectly yet.

5.3:
- No longer clear the first word of each sample for idle looping.
  Either we have a good Amiga tracker MOD with repeat-length one, which
  already cleared that word, or we have a PC tracker MOD with a zero
  repeat length. In the latter case the idle loop will now point to
  address $0. Make sure that the word at this address is cleared!
- Treat samples with a length of one word the same as with zero length
  as a workaround for broken PC trackers.
- Changed APTR to void* in the C headers, for better Kickstart 1.x
  OS header file compatibility.
- Fixed detection of negative fine-tuning (broken due to optimizations
  in V5.1).
Attached Files
File Type: zip ptplayer53.zip (52.9 KB, 251 views)
MickGyver is offline  
Old 27 November 2019, 12:49   #65
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Excellent, thanks! I'll try this library out in a project I'm working on (when I have the time...)

The first change about not clearing the first word: Is that fixing an issue I think I had with the older version where certain sound effects were getting stuck playing a high pitched note? I hadn't gotten around to clearing the first two bytes of the sample to confirm it...
Daedalus is online now  
Old 27 November 2019, 13:43   #66
Cobe
Registered User
 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 41
Posts: 999
Fabulous!
I've just fiddled with the example and it works.
sfxCha.b was exactly what I missed in previous version.
Thanks!
Cobe is offline  
Old 27 November 2019, 13:49   #67
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Quote:
Originally Posted by Daedalus View Post
The first change about not clearing the first word: Is that fixing an issue I think I had with the older version where certain sound effects were getting stuck playing a high pitched note? I hadn't gotten around to clearing the first two bytes of the sample to confirm it...
I have no idea to be honest, I still think the first word needs to be cleared. It has got something to do with it, that's for sure.
MickGyver is offline  
Old 28 November 2019, 11:17   #68
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by Daedalus View Post
The first change about not clearing the first word: Is that fixing an issue I think I had with the older version where certain sound effects were getting stuck playing a high pitched note? I hadn't gotten around to clearing the first two bytes of the sample to confirm it...
This was probably a PC-tracker MOD with a zero repeat-length (which doesn't happen in original Amiga MODs). A zero repeat length was just increased to two, as a workaround, before 5.3. As a consequence this required the first word to be zero, which usually is not the case in PC-MODs. As a result it is playing the high pitched noise there, as long as you don't clear the word yourself.

To conclude: Yes, this should hopefully be fixed with 5.3.
phx is offline  
Old 28 November 2019, 11:21   #69
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
That's great, thanks for the detailed explanation And, of course, your work on the original library!
Daedalus is online now  
Old 28 November 2019, 15:39   #70
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Quote:
Originally Posted by MickGyver View Post
I used a diff tool in an attempt to build a 5.3 version of this library. Got nowhere though. I'm not familiar with assemblers, I tried Asm-One, but get an error at the first astatement, next line "args word,byte" throws an error: "Illegal operand". What assembler did you use to build this and what extra steps would one need to take?[/S]
I used PhxAss, by Phx himself.
idrougge is offline  
Old 29 November 2019, 10:49   #71
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
Thanks for the updates! Amazing work all

I still had some issues with high pitch after some samples, but I didn't know about the first word thing before. With this tiny tweak to the included sample function

Code:
Statement SFXInit {*fx.sfx, snd.w, vol.w, cha.b, pri.b}
  *_snd.sound=Addr Sound(snd)  ; Get the pointer to the sound
  Poke.w *_snd\_data,0 ; Set first word of sample data to 0
  *fx\sfxPtr=*_snd\_data       ; Copy the data
  *fx\sfxLen=*_snd\_length     ; ...
  *fx\sfxPer=*_snd\_period
  *fx\sfxVol=vol
  *fx\sfxCha=cha
  *fx\sfxPri=pri
End Statement
Everything came right for me
earok is offline  
Old 29 November 2019, 13:13   #72
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Quote:
Originally Posted by earok View Post
Thanks for the updates! Amazing work all

I still had some issues with high pitch after some samples, but I didn't know about the first word thing before. With this tiny tweak to the included sample function

Code:
Statement SFXInit {*fx.sfx, snd.w, vol.w, cha.b, pri.b}
  *_snd.sound=Addr Sound(snd)  ; Get the pointer to the sound
  Poke.w *_snd\_data,0 ; Set first word of sample data to 0
  *fx\sfxPtr=*_snd\_data       ; Copy the data
  *fx\sfxLen=*_snd\_length     ; ...
  *fx\sfxPer=*_snd\_period
  *fx\sfxVol=vol
  *fx\sfxCha=cha
  *fx\sfxPri=pri
End Statement
Everything came right for me
Cheers! By the way, you should be able to use MTInstall 1=PAL/0=NTSC with this version and you NEED to call MTRemove when you want to remove the CIA player from the system.

Last edited by MickGyver; 30 November 2019 at 07:46.
MickGyver is offline  
Old 30 November 2019, 03:03   #73
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
Quote:
Originally Posted by MickGyver View Post
Cheers! By the way, you should be able to use MTInstall 1=PAL/2=NTSC with this version and you NEED to call MTRemove when you want to remove the CIA player from the system.
Thanks for the heads up!
earok is offline  
Old 30 November 2019, 07:49   #74
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Quote:
Originally Posted by earok View Post
Thanks for the heads up!
For MTInstall, it is 1 for PAL and 0 for NTSC, I corrected my post above.
MickGyver is offline  
Old 27 December 2019, 11:47   #75
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
I recently released a port of Raid Over Moscow using this library, but it seems that there's some cases where audio doesn't work at all, I've got no idea if it's an issue I've caused or not. It appears the common thread is towered A1200's with sound cards. I know almost nothing about AHI and sound cards so I have no idea what to try, any suggestions would be appreciated!



Raid Over Moscow thread: http://eab.abime.net/showthread.php?...67#post1367467
earok is offline  
Old 27 December 2019, 12:11   #76
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
I cross build the ptplayer lib with vasm without issues:

Code:
vasmm68k_mot -devpac -Faout -o ptplayer.o ptplayer.asm
jotd is offline  
Old 27 December 2019, 14:27   #77
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by earok View Post
I recently released a port of Raid Over Moscow using this library, but it seems that there's some cases where audio doesn't work at all, I've got no idea if it's an issue I've caused or not. It appears the common thread is towered A1200's with sound cards. I know almost nothing about AHI and sound cards so I have no idea what to try, any suggestions would be appreciated!
Ptplayer was designed for games which take over the system. It doesn't use the OS and programs Paula's hardware registers directly, so it will never work with AHI or any other sound hardware than Paula.

I have never seen an Amiga sound card, and I don't even understand why you need one in an Amiga, but from what I have read, some sound cards can use the Paula-output as external input (into their mixer?). Probably this won't work either when it requires any OS support.

Quote:
Originally Posted by jotd View Post
Code:
vasmm68k_mot -devpac -Faout -o ptplayer.o ptplayer.asm
BTW, -devpac is suboptimal when assembling ptplayer.asm, as it disables all optimizations. And I always write code which relys on assembler optimizations (mostly branch sizes).
phx is offline  
Old 27 December 2019, 14:40   #78
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
As far as I know AHI and Paula direct are independent from each other. So if the library don't use AHI then it shouldn't responsible for audio issues.

Edit: phx was faster.
daxb is offline  
Old 28 December 2019, 02:57   #79
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
Thanks guys.

As I understand it, Paula feeds audio directly into the sound card so (for example) WHDLoad games still output audio.

My current line of thinking is that it's to do with how I'm dropping in-and-out of OS friendly mode to load from disk when needed, though I'm not sure why it'd only affect some machines. I'll try some things for the next build.
earok is offline  
Old 28 December 2019, 09:41   #80
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
problem when you want to be 100% user friendly it's very difficult to achieve performance or perform things that you can so more easily with hardware banging (reading joysticks, double buffering, blitting). I'm sure AHI interface is super simple stream based and works perfect with a sound card, but so few games will benefit from it.

no wonder why all great games from the golden era were asm+hardware banging. Personally I'd recommend C or C++ instead of asm. You never have register size issues, register corruption, custom write size errors, ... Problem is: it creates much bigger executables. Once again paying for simplicity...
jotd 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
Demos with music or sound effects in time with graphic effects mark_k request.Demos 7 07 December 2016 20:23
Sound issue, not all sound effects played. Connorsdad support.WinUAE 16 23 February 2015 16:32
Sound Effects in IK+ noel411 support.Games 3 07 September 2007 03:12
IK+ sound effects not working andreas support.WinUAE 4 26 July 2005 20:21
How to rip sound / effects wlcina support.Games 16 18 April 2005 03:09

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 17:57.

Top

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