![]() |
![]() |
#141 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
I notice the aminet version is 6.3 now; would anyone be interested in me updating the repo accordingly?
|
![]() |
![]() |
#142 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
I did it anyway
![]() blitz_ptplayer updated to v6.3, latest on aminet. Disclaimer: I've not tested it! https://github.com/E-Penguin/blitz_ptplayer |
![]() |
![]() |
#143 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
|
Nice work
![]() |
![]() |
![]() |
#144 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
Not all of the functions in ptplayer.asm are exposed as blitz functions. I'm going to work on adding them to the next release. Some of them take a pointer to a memory structure as an argument, what's the best way to expose this to blitz (presumably as a NewType)? Some sort of res file?
|
![]() |
![]() |
#145 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
|
Yeah, a NewType sounds like the way to go. You could use a .res file or an include - I'd start with an Include anyway for testing.
|
![]() |
![]() |
#146 |
Registered User
Join Date: Jun 2017
Location: Ruhrgebiet / Germany
Posts: 55
|
Is there a way (in Amiblitz3) to use the PTPlayer.library to detect if a MOD file has been played completely to the end, so that I can load and play the next one?
I have several MOD files and would like to play them one after the other. Thank you |
![]() |
![]() |
#147 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
There's a "_mt_SongEnd" flag that you might be able to keep an eye on. It's not exported in the current version of the library but I suppose I could add a function to get it. In exchange you can test it for me
![]() -------------- Edited to add: added the function to the attached updated version of the library. MTSongEnd should return the value of the mt_SongEnd flag. Now, precisely what this new flag does I'm not sure, but please let us know how you get on. Last edited by E-Penguin; 07 August 2023 at 16:48. |
![]() |
![]() |
#148 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
|
If you are refering to my ptplayer, then there is currently no way to stop it, once all patterns from the song arrangement list have been played. It will immediately restart with the first position.
IIRC, it is not so trivial to implement as it may seem. The last pattern positions may have started a sample which lasts longer than the pattern. It doesn't sound great to cut it immediately. Letting Audio DMA continue is also no option, because looped samples will continue forever. I'm open for suggestions, of course! ![]() Just checked the source and remembered that I already worked on it. There is an experimental Byte-sized variable (for C and assembler, may need BlitzBasic support) called mt_SongEnd(defaults to 0), which is incremented every time the song ends and repeats (when reaching 128 repetitions it flips back to 0). Setting it to $ff(-1), after starting the MOD, will theoretically stop replay when reaching the end. But it doesn't stop DMA or turn down volume. That would be up to you. (Not sure if I ever tested that.) EDIT: Pengiun was faster. I shouldn't fall asleep while checking the source. ![]() Last edited by phx; 07 August 2023 at 16:34. Reason: Zzzz |
![]() |
![]() |
#149 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
My new function just returns mt_SongEnd, doesn't set it. I'll have to modify that. One moment...
If I've understood what's going on (and that is a big "if"...) if SongEnd is set to 0xFF (-1) then at the end of the current loop, mt_Enabled is set to false and playback stops. So you can poll MTIsEnabled to get the current state of the playback. ------------ OK, new version added: Code:
; takes a value to set (0xFF = "end after this loop") statement MTSongEnd byte Code:
; returns whether the playback is ongoing or not function MTIsEnabled Edited to remove attachment - updated one below Last edited by E-Penguin; 11 August 2023 at 15:16. |
![]() |
![]() |
#150 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,308
|
I guess the problem is that Protracker modules do not really have an end. They just start from the beginning in a loop. Modules can play in random order. Some mods use the command F00 (if I remember right) to stop it but this also doesn't mean that the mod is finished (sample still playing like phx mentioned). It is more or less guessing the end of a mod if you don't know it. For most mods it will work but some will be cut or play longer.
|
![]() |
![]() |
#151 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
|
Quote:
You could even set SongEnd to 0xFE (-2) to play a MOD twice, then stop. |
|
![]() |
![]() |
#152 |
Registered User
Join Date: Jun 2017
Location: Ruhrgebiet / Germany
Posts: 55
|
Thanks for your help.
I will try it with AmiBlitz3 :-) |
![]() |
![]() |
#153 | |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,603
|
Quote:
|
|
![]() |
![]() |
#154 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,308
|
F00 is a valid command so a fix should be done. Mod players handle it differently (stop or skip at least).
|
![]() |
![]() |
#155 |
Registered User
Join Date: Jun 2017
Location: Ruhrgebiet / Germany
Posts: 55
|
Hello...
I still have some problems using the PTPlayer.library with AmiBlitz3.9.9 There is an example code in the Examples folder from AmiBlitz3, but I can´t get it to work. Every command from this Library is tokanized by AB3 (in blue bold font), exept for one command: MTPlayFX The mod is played fine (so I assume the Library is working correct), but I can not play the clap sound effect by pressing the left mouse button (right mousebuttion ends this example). The command MTSoundFX is working, but it is stated in the documentation, that it is included for compatibility reasons only and that I should use the MTPlayFX command instead. The MTSoundFX command seems to make some problems in my game Settle the World, so I would like to replace it with the MTPlayFX command. What can I do that AmiBlitz "recordnize" this MTPlayFX command to play sound effects? Sorry for this question, but I am trying around with this already for many hours.... Code:
WBStartup INCLUDE "ptplayer_inc.ab3" MTInstall 1 ; Install the CIA MOD player routine (1=PAL,0=NTSC) LoadBank 0,"playingw.mod",2 ; Load a module into chipmem addrMod.l=Bank(0) ; Get the pointer to the module DEFTYPE .sfx clap ; Create a sfx instance LoadSound 0,"909Clap.iff" ; Load a sound ; Initialize a sfx for ptplayer SFXInit{&clap,0,64,-1,1} ; {*pointer.sfx, sound_index, volume, channel (-1=best), priority (>0) } MTInit 0,0 ; Initialize a module from bank 0, start position = 0 MTPlay On ; Start playing the module While Joyb(0)<2 VWait If Joyb(0)=1 MTPlayFX &clap EndIf Wend MTEnd ; Stop playing the current mod MTRemove ; Remove the CIA MOD player routine End Last edited by TheoTheoderich; 09 August 2023 at 15:41. |
![]() |
![]() |
#156 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
|
Quote:
MTPlayFXis missing there. MTSoundFXis defined, as you already mentioned. Should be easy to add, as the _mt_playfx_stubstub is already there. Quote:
![]() |
||
![]() |
![]() |
#157 | ||
Registered User
Join Date: Jun 2017
Location: Ruhrgebiet / Germany
Posts: 55
|
Quote:
![]() I only can work with BlitzBasic/AmiBlitz3 code...i never learned ASM :-( EDIT: Could one of you please be so kind and add the MTPlayFX command to the PTPlayer.library, so I can use it with AmiBlitz3? Thank you very much ![]() EDIT2: I think this is the part that needs to be added, but I do not know how to compile library ![]() -Removed because of EDIT3- EDIT3: Ok, found out how to add the following code part into the ptplayer.asm and how to run the vasmm68k_mot to compile a new ptplayer.obj. I also found out how to replace the ptplayer.library in AmiBlitz3. Now the MTPlayFX command is displayed with blue bold font, like any other AB3 command. Code:
astatement args long libs subs _mt_playfx,0,0 name "MTPlayFX","sfxStructAddress.l" There is still an error somewhere. When I try to run the ptplayer example from AmiBlitz3 it tells me that in line Code:
MTPlayFX &clap ![]() When I try it with my game, some strange errors occurs, like if AB3 can not find an end of a for-next or loop....after that it crashes most of the time. Using MTSoundFX (the command which is not recommended anymore) the soundeffekt will be played, but after that it got the error "GURU! - Illegal Instruction". Quote:
So after playing a sound sample sometimes the music is played way to fast. Last edited by TheoTheoderich; 09 August 2023 at 23:53. |
||
![]() |
![]() |
#158 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
|
Quote:
![]() I am as unsure as you how to define a new BlitzBasic statement. I wonder why there are double args, subs and libs for some statements. Quote:
_mt_playfx_stubinstead? Quote:
|
|||
![]() |
![]() |
#159 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
I'll compile you up a new lib tomorrow with the blitz function fixed (the stub should sort out the registers saving and restoring).
Could you try the previous version? I used it with sound effects in Father Christmas vs Dinosaurs so I'm pretty sure that worked. https://github.com/E-Penguin/blitz_p...b/ptplayer.obj If I ever get a spare five minutes I'd like to create a test program in blitz all the functions and use that in regression testing. |
![]() |
![]() |
#160 |
Registered User
Join Date: Jun 2017
Location: Ruhrgebiet / Germany
Posts: 55
|
I tried the version from your link, but it is missing the MTPlayFX command in AmiBlitz.
This command is also missing in your ptplayer.asm on the same github page. The OS is turned off in my game because I am using the BLITZ command, so I hope that is not the problem. Last edited by TheoTheoderich; 11 August 2023 at 08:31. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
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 |
|
|