English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Releases

 
 
Thread Tools
Old 14 July 2019, 12:34   #81
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,356
@roondar:
I know there exists plain xm players but I meant something like phx player (play music + play sound fx samples).

@saimon69:
I think dbm (2 commands at the same time) can do this already. Choose 4 channels and audio mode "Paula: DMA 8 bit stereo". However, with using dbm you have all the features it brings = more control.

Last edited by daxb; 14 July 2019 at 13:12.
daxb is offline  
Old 14 July 2019, 12:41   #82
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,308
@daxb:
I completely missed that bit. Not sure then, maybe the exist but something tells me a lot of Amiga games just use mods or go straight to streamed samples/mp3's.
roondar is offline  
Old 08 August 2019, 11:29   #83
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,451
After some more testing I will release V5.3 on Aminet during the following days. The beta-version, which was successfully tested by mcgeezer and me, is already availble for anybody interested:
http://sun.hasenbraten.de/~frank/TEST/ptplayer53.lha

I am announcing it here, because it has some more improvements and fixes than previous releases. From the Readme:

Code:
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 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.
V5.2 was used in Trap Runner and Celtic Heart but never officially released, because I was waiting for a patch from StingRay concerning _mt_SongEnd (since the beginning of this year ). So just forget about this feature for now.

Most important changes were that the first word of samples is no longer cleared, which improves compatibility with PC trackers and zero repeat-length. In this case I'm using $0 for idle-looping, as proposed by Don_Adan here:
http://eab.abime.net/showpost.php?p=...6&postcount=20

And a fix for samples with a length of one word, which appear in broken PC tracker MODs (the word doesn't appear in the samples!), suggested by Ross here:
http://eab.abime.net/showpost.php?p=1335842&postcount=2
phx is offline  
Old 08 August 2019, 12:12   #84
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,024
Quote:
Originally Posted by phx View Post
In the latter case the idle loop will point to address
$0. Make sure that the word at this address is cleared!
Yep, clearing $0 is a panacea.
In my patches is ever in the list (corrects audio, sprites, stupid code..).
It is not orthodox and Enforcer is not happy at all, but it works.
And it has no side effects and that's what counts.

Thanks phx.
ross is offline  
Old 08 August 2019, 14:51   #85
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,451
Quote:
Originally Posted by ross View Post
Yep, clearing $0 is a panacea.
At first I read "pancake", which I just had for lunch.

Quote:
In my patches is ever in the list (corrects audio, sprites, stupid code..).
It is not orthodox and Enforcer is not happy at all, but it works.
Yes, I'm also using it for empty sprites. And the Enforcer shouldn't notice any Audio- or Sprite-DMA access.

Quote:
And it has no side effects and that's what counts.
Exactly. Depending on a memory-allocation function or adding a Chip-RAM section could have caused trouble in certain situations.
phx is offline  
Old 08 August 2019, 16:28   #86
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,024
Quote:
Originally Posted by phx View Post
Yes, I'm also using it for empty sprites. And the Enforcer shouldn't notice any Audio- or Sprite-DMA access.
In my patches I never take it for granted that it is zeroed.
Sometime, for some reason or simply by mistake, bad code write to $0 (or read from it.., so many time i've noticed wrong $0 used instead of #0 for carelessness).
Can be seen in some demos/games where there are glitches with sprites expecting $0=0 but it's not.

So I always grant a simple:
Code:
suba.l a0,a0
move.l a0,(a0)
Zeroed ax register can also be used to move #0 in custom registers.
I have often seen the use of clr which is slower (on pure 68k) and potentially even dangerous.

But yes, normally it should already be like this
(I apologise for digressing)
ross is offline  
Old 09 August 2019, 10:25   #87
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,451
Quote:
Originally Posted by ross View Post
In my patches I never take it for granted that it is zeroed.
You're right, you should not expect that $0 is zeroed.

In ptplayer I decided to let the developer initialise $0 in the main program. So you may still use it for other purposes as long as you are playing a real Amiga tracker MOD, without any zero repeat-length.
phx is offline  
Old 15 October 2019, 21:15   #88
dodke
Registered User

 
Join Date: Feb 2018
Location: London / UK
Posts: 64
I had some trouble with this at first but then realised I had an old version and the latest one was easier to set up and the C header came quite handy.
Now I've got some music and a sound effect working without issues which is amazing so thank you!

Also, is there a recommended way of splitting the mod into pattern and sample data?
dodke is offline  
Old 16 October 2019, 16:15   #89
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,451
Quote:
Originally Posted by dodke View Post
Also, is there a recommended way of splitting the mod into pattern and sample data?
You have to find the start address of the first sample in your MOD file. Split the file at that offset.

For my games I wrote the following portable C source:
Code:
/*
 * Splits a standard SoundTracker/ProTracker MOD file into two parts:
 * - <name>.trk : MOD data (header, sample info, song arrangement, patterns)
 * - <name>.smp : MOD samples (to be loaded into Chip RAM)
 *
 * Usage: splitmod <name>
 *
 * Written by Frank Wille in 2013.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


static size_t filesize(FILE *fp,const char *name)
{
  long oldpos,size;

  if ((oldpos = ftell(fp)) >= 0)
    if (fseek(fp,0,SEEK_END) >= 0)
      if ((size = ftell(fp)) >= 0)
        if (fseek(fp,oldpos,SEEK_SET) >= 0)
          return (size_t)size;

  fprintf(stderr,"Cannot determine file size of \"%s\"!\n",name);
  return 0;
}


static int splitmod(char *name,unsigned char *mod,size_t len)
{
  unsigned char *p;
  unsigned char maxpat;
  char *namebuf;
  size_t smp_off;
  FILE *f;
  int werr = 1;
  int i;

  /* buffer for new name with .trk or .smp extension */
  namebuf = malloc(strlen(name) + 5);
  if (!namebuf) {
    fprintf(stderr,"No memory for name buffer!\n");
    return 1;
  }

  /* determine number of patterns */
  for (p=&mod[952],maxpat=0,i=0; i<128; p++,i++) {
    if (*p > maxpat)
      maxpat = *p;
  }

  /* samples reside behind the patterns */
  smp_off = ((size_t)(maxpat+1) << 10) + 1084;

  /* write the tracker part */
  sprintf(namebuf,"%s.trk",name);
  if (f = fopen(namebuf,"wb")) {
    if (fwrite(mod,1,smp_off,f) == smp_off) {
      fclose(f);

      /* write the sample part */
      sprintf(namebuf,"%s.smp",name);
      if (f = fopen(namebuf,"wb")) {
        if (fwrite(mod+smp_off,1,len-smp_off,f) == len-smp_off)
          werr = 0;
        fclose(f);
      }
    }
  }

  if (werr) {
    fprintf(stderr,"Cannot write \"%s\"!\n",namebuf);
    return 1;
  }
  return 0;
}


int main(int argc,char *argv[])
{
  int rc = 1;
  FILE *f;

  if (argc != 2) {
    fprintf(stderr,"Usage: %s <name>\n",argv[0]);
    return 1;
  }

  if (f = fopen(argv[1],"rb")) {
    size_t len;
    unsigned char *mod;

    len = filesize(f,argv[1]);
    if (len) {
      mod = malloc(len);
      if (mod) {
        if (fread(mod,1,len,f) == len)
          rc = splitmod(argv[1],mod,len);
        else
          fprintf(stderr,"Read error (\"%s\")!\n",argv[1]);
      }
      else
        fprintf(stderr,"Out of memory!\n");
    }
    fclose(f);
  }
  else
    fprintf(stderr,"Cannot open \"%s\"!\n",argv[1]);

  return rc;
}
phx is offline  
Old 17 October 2019, 11:33   #90
dodke
Registered User

 
Join Date: Feb 2018
Location: London / UK
Posts: 64
Works perfectly, thanks!
dodke is offline  
Old 18 October 2019, 14:32   #91
dodke
Registered User

 
Join Date: Feb 2018
Location: London / UK
Posts: 64
After a sound effect stops playing I'm left with a somewhat quiet continuous high pitched voice on the channel. This happens with and without a module playing. Any ideas what could be the cause?
I tried adjusting volume and the sample length but no change. If I set the length to half the noise afterwards is the same. Also I checked that the sample ends with zeroes.
dodke is offline  
Old 18 October 2019, 21:57   #92
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,451
Quote:
Originally Posted by dodke View Post
After a sound effect stops playing I'm left with a somewhat quiet continuous high pitched voice on the channel. This happens with and without a module playing. Any ideas what could be the cause?
Yes. And I should really add that to the Readme, for the next release. This is asked frequently.

Sound effect samples have to be in the same format as the music samples, which means: make sure the first two bytes are cleared! The player uses the first two bytes for idle-looping.
phx 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
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

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 18:28.


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