05 June 2017, 15:39 | #41 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,315
|
What does your Player do with samples of size >64kb and <=128kb when used in a protracker module?
|
06 June 2017, 13:55 | #42 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
Quote:
Quote:
BTW, this player is not OS-friendly, but for games which take over the whole system. Didn't try, but I'm quite sure that it would play them. The sample lengths are already stored as words in the MOD header, which is passed unchanged to the hardware. |
||
06 June 2017, 15:25 | #43 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,314
|
Of course, I plan to use it in an A500 game as well. It's going to be very simple, so I prefer the C calling convention, but I get your point I'll probably just use the SDI headers to make things portable.
I looked into what can I do with Supervisor(), and this is what I came up with: Code:
static APTR GetVBR(void) { APTR vbr = NULL; UWORD getvbr[] = {0x4e7a, 0x0801, 0x4e73}; // MOVEC.L VBR,D0 RTE if (SysBase->AttnFlags & AFF_68010) vbr = (APTR)Supervisor((void *)getvbr); return vbr; } |
08 June 2017, 00:24 | #44 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
Very good. I can recommend using SDI headers.
Quote:
|
|
25 June 2017, 20:36 | #45 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,314
|
I finally created the C header file for the player. It works nicely with the modified function above, compiled with vasm/vbcc. For some reason .h attachments are not allowed, so I renamed it to .c.
|
26 June 2017, 21:12 | #46 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
Good work! And thanks for testing.
If you permit I would include your ptplayer.h in the next ptplayer-release. |
27 June 2017, 04:38 | #47 |
Warhasneverbeensomuchfun
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
|
Man it would be awesome if someone could do a lib for Blitz Basic using this ..
|
27 June 2017, 10:53 | #48 | ||
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,314
|
Quote:
Speaking of sfx, since the functions expect hardware periods, maybe it would make sense to expose mt_timerval with an underscore, so there would be no need to calculated it again in the C program. Quote:
http://eab.abime.net/showpost.php?p=970456&postcount=32 |
||
30 June 2017, 13:00 | #49 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
Quote:
There is also nothing to calculate. Either you take the NTSC or the PAL constant. |
|
04 July 2017, 21:35 | #50 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,366
|
Unfortunately I could not get your library to work. Installing the library did work, and the keywords do tokenise, but I never get any sound out of your program.
|
05 July 2017, 16:51 | #51 |
Registered User
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
|
I don't know what to tell you. It still works for me. Remember this thing as-is was never meant to be used. It was just to test the feasibility of making a Blitz library. That is why instructions to restore Blitz are provided.
Sound effects capabilities were not included. Not even as much as volume is included. Certainly none of phx's later advancements are included. It would take someone with a good understanding of modules to make a real library and do a good job of it. Last edited by clenched; 06 July 2017 at 17:36. Reason: typo |
05 July 2017, 20:17 | #52 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,366
|
Do you still have the source code, Clenched?
|
05 July 2017, 20:59 | #53 |
Registered User
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
|
Afraid not.
|
06 July 2017, 13:32 | #54 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,366
|
Never mind, I've got my own port of PHX's routine up and running. Got sound effects working this night, too. I'll upload it once the code has been cleaned up and the API is stable enough. Does anyone have any good resources on Blitz library development or source code for Blitz libs?
|
08 July 2017, 18:23 | #55 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,366
|
There, after a few days of work I have managed to have a fairly stable, error-checked and user-friendly version of Phx's player.
What remains is optimisation, and possibly implementing the new PlayFX routine recommended by Phx instead of the old SoundFX routine (which is much easier to call!). To install, copy ptplayer.obj to Blitzlibs:Userlibs or Blitzlibs:Otherlibs and rebuild Deflibs using either Blitzlibs:Makedeflibs or using BlitzLibMan from Aminet. Last edited by idrougge; 18 July 2017 at 01:19. |
10 July 2017, 01:29 | #56 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,366
|
Question: I currently init the player with 0 as VBR, but this might not work on 68010+ machines (though it does work on my A600 with Furia EC020). How do I check if MOVEC is a valid instruction or not?
|
10 July 2017, 05:26 | #57 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,087
|
Scroll up, 3rd post on this page by BSzili.
|
18 July 2017, 01:23 | #58 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,366
|
I didn't have the luxury of using C like Bszili, and I hardly know assembly either, but by use of AttnFlags in Execbase, I've managed to identify the CPU and move the VBR if necessary. This means that the player works both on 68000 and 68040, and that MTInstall and MTRemove are no longer necessary since installation and removal of the CIA playback routine is handled automatically by the library's init/deinit routines.
New library here: http://eab.abime.net/showthread.php?...28#post1172028 Last edited by idrougge; 18 July 2017 at 01:35. |
06 July 2019, 22:22 | #59 |
Registered User
Join Date: Apr 2012
Location: Cardiff
Posts: 414
|
I need a bit of help with this...
Could anyone write some sample code on how to use this in C? I don't need the SFX stuff right now but I need to load a module from a file and play it as part of my game. |
07 July 2019, 21:19 | #60 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
Make sure you have at least ptplayer 5.1, which includes C support for BSzili. Then try something like this to load and play a MOD:
Code:
#include <exec/execbase.h> #include <exec/memory.h> #include <dos/dos.h> #include <proto/exec.h> #include <proto/dos.h> #include "ptplayer.h" #define CUSTOM ((void *)0xdff000) /* compiler-specific getvbr() - FIXME! This is for vbcc. */ static void *__movecvbr(void) = "\tmovec\tvbr,d0\n\trte"; static void *getvbr(void) { return __movecvbr(); } static void play_mod(void *ptmod) { void *vbr; UBYTE palflag; /* get VBR for 68010+, otherwise VBR is 0 */ vbr = (SysBase->AttnFlags & AFF_68010) ? (void *)Supervisor((void *)getvbr) : NULL; /* CIA clock is PAL or NTSC? */ palflag = SysBase->PowerSupplyFrequency < 59; /* initialize player and install Level-6 interrupt handler for CIA-B */ mt_install_cia(CUSTOM, vbr, palflag); /* initialize current MOD file */ mt_init(CUSTOM, ptmod, NULL, 0); /* play it for 10 seconds */ mt_Enable = 1; Delay(500); mt_end(CUSTOM); mt_remove_cia(CUSTOM); } int main(int argc, char *argv[]) { struct FileInfoBlock fib; void *ptmod = NULL; int rc = 5; BPTR fh,lck; BOOL res; if (argc == 2) { /* deterimine MOD's size and allocate Chip-RAM for it */ lck = Lock(argv[1], ACCESS_READ); if (!lck) return 1; res = Examine(lck, &fib); UnLock(lck); if (!res) return 2; if (!(ptmod = AllocMem(fib.fib_Size, MEMF_CHIP))) return 3; /* read the MOD into the buffer */ if (!(fh = Open(argv[1], MODE_OLDFILE))) goto leave; Read(fh, ptmod, fib.fib_Size); Close(fh); /* play it */ play_mod(ptmod); rc = 0; } leave: if (ptmod) FreeMem(ptmod, fib.fib_Size); return rc; } You need a piece of assembler to read the VBR register. When you don't use vbcc you have to adapt that to your compiler. Here is an example Makefile for the whole mod-test: Code:
CC = vc +aos68k COPT = -O1 -cpu=68010 -I. -c AS = vasmm68k_mot ASOPT = -Fhunk -quiet test: test.o ptplayer.o $(CC) -o $@ test.o ptplayer.o test.o: test.c $(CC) $(COPT) -o $@ $< ptplayer.o: ptplayer.asm $(AS) $(ASOPT) -o $@ $< clean: delete force quiet test test.o ptplayer.o |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
MOD-player with external sound effects | phx | Coders. Asm / Hardware | 14 | 18 June 2012 10:41 |
Amiga Forever&Protracker bad sound | moriez | support.WinUAE | 14 | 06 January 2009 01:26 |
What was the first Amiga tracker to support external midi instruments | Kola | Amiga scene | 3 | 09 December 2008 19:20 |
Sound/Protracker package | Dunny | request.Apps | 3 | 23 July 2008 19:17 |
Sampled sound player? | cdoty | Coders. General | 7 | 25 August 2007 16:21 |
|
|