01 October 2022, 09:58 | #1 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
Ptplayer question
In order to play an sfx, I'm using _mt_playsfx. Is it possible to know when sfx finishes playing?
|
01 October 2022, 12:24 | #2 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,406
|
Not that I can see in the docs, no. But don't you know how long your SFX takes to play? You should be able to use that knowledge, or alternatively use the period/frequency and length to calculate it if that's desirable.
|
01 October 2022, 15:04 | #3 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
It's hidden, but it is documented. When you look at the description of
_mt_playfxin the ptplayer.readme, you can read: Code:
RETURN VALUES: A pointer to a channel-status structure (see ptplayer.h) when the sample is scheduled for playing, and NULL when the request was ignored. Code:
typedef struct SfxChanStatus { UWORD n_note; UWORD n_cmd; UBYTE n_index; /* channel index 0..3 */ UBYTE n_sfxpri; /* sfx_pri when playing, becomes 0 when done */ /* Rest of structure is currently not exported. Don't rely on it! */ } SfxChanStatus; n_sfxpri. It means that you can poll this byte until it becomes zero, which means the channel has become idle. It works and I used it in some of my games. |
03 October 2022, 09:48 | #4 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
@phx
Is it the same with asm? |
03 October 2022, 11:09 | #5 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Sure. The structure offset of
n_sfxpriis obviously 5, so try this: Code:
bsr _mt_playfx move.l d0,a0 playing tst.b 5(a0) bne playing |
03 October 2022, 11:26 | #6 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
@phx Thanks for your help and time! I'm using V3.8b version. Is there any new one?
|
03 October 2022, 13:41 | #7 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Not sure what you mean. I never released such a version. The last release was V6.2: http://aminet.net/package/mus/play/ptplayer
|
03 October 2022, 13:53 | #8 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
@phx
Sorry, my fault, it is the protracker version: v2.3b |
03 October 2022, 14:34 | #9 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Originally I based my player on the source text and features of the official V2.3b source, but that has no longer much relevance.
|
03 October 2022, 14:41 | #10 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,406
|
Quote:
Nice to see it's in there though! |
|
04 October 2022, 14:07 | #11 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
@phx Works very good! I like it, very usefull! Thanks
|
06 October 2022, 05:47 | #12 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
@phx
Speaking about sample rate, is there a way to get it from a sample, or do I have to set it by myself every time? When I play an sfx, I can hear some sort of "tac" when it start, do I have to take care of something to avoid it? (sorry for my dummy guestions, but I'm not a very well into music and sfx stuffs) Last edited by sandruzzo; 06 October 2022 at 06:39. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PTPlayer / Vertical Blank Interrupt / 060 | DanielAllsopp | Coders. Asm / Hardware | 41 | 08 April 2022 23:15 |
Amiblitz 3 and PtPlayer | Nightshft | Coders. Blitz Basic | 4 | 14 November 2021 00:28 |
Problem with ptplayer | MacSpain | support.Other | 2 | 23 January 2020 19:52 |
Amiga 1200...board revisions question / wire link modification question | voyager_1701e | support.Hardware | 3 | 20 February 2014 12:32 |
T.F.X Question ???? | synchro | Amiga scene | 29 | 13 September 2004 01:13 |
|
|