Amiga-Development

Please login or register.

Login with username, password and session length
Advanced search  

News:

Created for developers of all Amiga camps

Author Topic: Playing mod and samples  (Read 2873 times)

0 Members and 1 Guest are viewing this topic.

tolkien

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Playing mod and samples
« on: January 13, 2015, 12:10:02 AM »

I'm doing a little game in C (really little one) and It's time to add music and soundfx. My idea is to play a three channel mod and 1 channel for soundFx.
Which is the best way to do it? Audio.device? AhI? ptplay.library? I have no idea what to do.
« Last Edit: January 13, 2015, 06:50:35 AM by tolkien »
Logged

SamuraiCrow

  • Administrator
  • Sr. Member
  • *****
  • Gender: Male
  • Posts: 376
  • Coolness is compiled
    • View Profile
Re: Playing mod and samples
« Reply #1 on: January 13, 2015, 03:06:12 PM »

Most .MOD players will hog all 4 voices for music.  Audio.Device doesn't support music playback directly by itself.  AHI and the latest versions of PTReplay.Library use mixing if a sound card is not available so they hog processor time.  If you're not targeting a 68k Amiga though, AHI and PTReplay.Library would be the way to go.  (Those configurations almost always have adequate sound cards.)  If you are targeting 68k also, it would need something written in Assembly, most likely, and therefore will not be cross-platform.
Logged

tolkien

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Playing mod and samples
« Reply #2 on: January 13, 2015, 07:36:39 PM »

My idea is to do It for 68k. The first draft is based in SDL cos I started It on PC and think that I can run it with SDL-AGA.
Then I thought that would be much better to try doing it more Amiga-like so Ill replace SDL with Amiga API but I dont know how to resolve the audio problem.
Logged

SamuraiCrow

  • Administrator
  • Sr. Member
  • *****
  • Gender: Male
  • Posts: 376
  • Coolness is compiled
    • View Profile
Re: Playing mod and samples
« Reply #3 on: January 13, 2015, 09:10:06 PM »

http://aminet.net/package/mus/play/ptplayer was created for and used in the Amiga version of Sqrxz and Solid Gold by Frank Wille, the author of VAsm and VLink.  You'll probably have to assemble it with VAsm and then link it to the rest of your program's object files with VLink.  As for creating the proper header to generate the prototypes for C, you'll have to look at the docs and figure it out.  Looking at the docs myself, it will involve using register passing to the exported subroutines and global variables.  Since this is not a cross-platform technique, I'd imagine questions about how to implement this should be posted in a different forum, such as something AmigaOS 3 related.
Logged

tolkien

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Playing mod and samples
« Reply #4 on: January 13, 2015, 09:20:11 PM »

Thanks Samurai.
I was thinking in that solution. That will be an interesting exercise.
Logged

SamuraiCrow

  • Administrator
  • Sr. Member
  • *****
  • Gender: Male
  • Posts: 376
  • Coolness is compiled
    • View Profile
Re: Playing mod and samples
« Reply #5 on: January 15, 2015, 08:04:59 AM »

If that still gives you problems, you might consider switching to a 3 track MED MMD1 file for the music.
Logged

tolkien

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Playing mod and samples
« Reply #6 on: January 15, 2015, 11:59:10 PM »

Im waiting to the weekend to study all of this. The MED option sounds good cos I used OctaMED a lot in my young years!
Thanks mate!
Logged