Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Help needed please. Sound issue  (Read 3338 times)

0 Members and 1 Guest are viewing this topic.

KevG

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 87
Help needed please. Sound issue
« on: August 14, 2013, 07:40:28 PM »

Hi folks.

I've gone back to one of my unreleased games after some years (phoenix) and its nearly complete. However, the last thing I sort out when designing something is the sound - and this is where I need your help.

I can't seem to find a way of testing to see if a sample is still playing OR when the sample has stopped playing. I really need to solve this issue out. I've got the D-Sam extension and although there are 40-ish new sound commands with this extension, there is hardly any documentation with it so I don't know what the commands are.

So, if anyone has the full documentation for this extension I would be most grateful if you could post a link to it somewhere so that I can have a look at it. Failing that, maybe someone can help provide an alternative solution by posting a little code that would maybe help.

Regards, Kev G.
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Help needed please. Sound issue
« Reply #1 on: August 15, 2013, 05:00:28 PM »

So, if anyone has the full documentation for this extension I would be most grateful if you could post a link to it somewhere so that I can have a look at it. Failing that, maybe someone can help provide an alternative solution by posting a little code that would maybe help.

I have very little documentation with D-Sam too :(

You can use my Extension Examiner (available on Aminet here) to find out the commands and the syntax, but alas it doesn't work miracles and can't tell you what they do :(
(It sometimes crashes when you exit too :( I shall fix that soon, I promise)

Here's a command list found using my program mentioned above:

Code: [Select]
Andrew D Burton's Extension Examiner - Export File
**************************************************
Export Selection: Commands
Path: Amiga-HD:HD1-DEV_KIT/AMOSPro2X/D-Sam/
File: D-Sam.Lib


Commands & Functions
********************
Smp Reset
Smp Mode Minchip
Smp Mode Minproc
Smp Memory X,Y
Smp Disk Buffer X
Smp Dma Buffer X
Smp Priority X
Smp Load X,Y$
Smp Open X,Y$
Smp Close X
Smp Assign Left X To Y
Smp Assign Right X To Y
Smp Assign X To Y
Smp Assign X,Y To Z
Smp Cue X
Smp Free X
Smp Start X
Smp Stop X
X=Smp Playing(Y)
Smp Play X,Y,Z,A,B
Smp Play X,Y,Z,A
Smp Play X,Y,Z
Smp Play X,Y
Smp Range X,Y To Z
Smp Loop Range X,Y To Z
Smp Speed X,Y
X=Smp Speed(Y)
Smp Volume X,Y
X=Smp Volume(Y)
Smp Repeat On X
Smp Repeat Off X
Smp Sequence On X
Smp Sequence Off X
Smp Fade On X
Smp Fade Off X
Smp Oversample On
Smp Oversample On X
Smp Oversample Off
Smp Oversample Off X
Smp Decompress On
Smp Decompress Off
X=Smp Base
X$=Smp Name(Y)
X=Smp Size(Y)
X=Smp Length(Y)
X=Smp Loop Start(Y,Z)
X=Smp Loop End(Y,Z)
X=Smp Loops(Y)
X=Smp Data(Y)
X=Smp Left Data(Y)
X=Smp Right Data(Y)
X=Smp Stereo(Y)
X=Smp Info(Y)
X=Smp Status(Y)
X=Smp Sequence(Y)
X=Smp Fade(Y)
X=Smp Disk Error
Smp Version



*** End Of File **

You can also view the translation from AMOS raw syntax to the readable syntax above in my program ;)
« Last Edit: August 15, 2013, 05:02:56 PM by Lonewolf10 »
Logged

KevG

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 87
Re: Help needed please. Sound issue
« Reply #2 on: August 15, 2013, 09:24:11 PM »

I am extremely grateful Lonewolf10.

At least now I can muck about with the commands to find out what they do.

Many thanks. Kev G.
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Help needed please. Sound issue
« Reply #3 on: August 16, 2013, 12:40:19 AM »

I couldn't find any more info than Lonewolf10 already posted for that extension.

BUT, you can check Samples while they're playing using the standard AMOSPro_Music.Lib.  I've attached an example prog, with a sample bank embedded, as a demo of the method.  It uses the Music Library Base Address (undocumented!) to get to the sample data for each channel.  That's the sample info data, not the sample itself.

Prog listing below:

Code: [Select]
'
'  Demo prog for accessing the position within a playing sample and 
'  determining when it is finished.
'
'  Mubase is undocumented.  It returns the base address of the data area
'  for AMOSPro_Music.Lib.
'
'  These offsets are from Mubase.  The addresses contain the Sample data
'  for each Audio Channel (NOT the Sample itself!).  I haven't explored 
'  these all yet as I'm up to my neck anlysing the AMOS Pro V2.0 sources
'  and documenting them.  So refer to the +Music.s for more info and
'  data sizes, etc.
'
'  As I used a progrma to pull the definitions below out of the assembly
'  listing (to get the offsets calculated) they're a bit long-winded :-) ).
'  It would be better to just define the Channel 0 offsets and calculate
'  the other channels using ChannelZeroOffset + (ChannelNum * 58) ...
'
'  I also haven't explored all the data.
'
'  BUT for your purposes KevG, just Leek(Mubase + xxx_POS) and test the top 
'  bit (bit 31).  If it's set, the sample's finished.  Otherwise it gives the
'  current position in the sample.
'

GC_SAMI_0_BIT=$458
GC_SAMI_0_DMA=$45A
GC_SAMI_0_REG=$45C
GC_SAMI_0_ADR=$45E
GC_SAMI_0_LONG=$462
GC_SAMI_0_POS=$466
GC_SAMI_0_RPOS=$46A
GC_SAMI_0_RADR=$46E
GC_SAMI_0_RLONG=$472
GC_SAMI_0_DVOL=$476
GC_SAMI_0_OLD=$478

GC_SAMI_1_BIT=$492
GC_SAMI_1_DMA=$494
GC_SAMI_1_REG=$496
GC_SAMI_1_ADR=$498
GC_SAMI_1_LONG=$49C
GC_SAMI_1_POS=$4A0
GC_SAMI_1_RPOS=$4A4
GC_SAMI_1_RADR=$4A8
GC_SAMI_1_RLONG=$4AC
GC_SAMI_1_DVOL=$4B0
GC_SAMI_1_OLD=$4B2

GC_SAMI_2_BIT=$4CC
GC_SAMI_2_DMA=$4CE
GC_SAMI_2_REG=$4D0
GC_SAMI_2_ADR=$4D2
GC_SAMI_2_LONG=$4D6
GC_SAMI_2_POS=$4DA
GC_SAMI_2_RPOS=$4DE
GC_SAMI_2_RADR=$4E2
GC_SAMI_2_RLONG=$4E6
GC_SAMI_2_DVOL=$4EA
GC_SAMI_2_OLD=$4EC

GC_SAMI_3_BIT=$506
GC_SAMI_3_DMA=$508
GC_SAMI_3_REG=$50A
GC_SAMI_3_ADR=$50C
GC_SAMI_3_LONG=$510
GC_SAMI_3_POS=$514
GC_SAMI_3_RPOS=$518
GC_SAMI_3_RADR=$51C
GC_SAMI_3_RLONG=$520
GC_SAMI_3_DVOL=$524
GC_SAMI_3_OLD=$526

'
'  Example test prog:

Proc _SCREEN_INIT

'
'   Addresses for Channel 0 Sample Length and Position:
'
G_CH0_LEN_ADDR=Mubase+GC_SAMI_0_LONG
G_CH0_POS_ADDR=Mubase+GC_SAMI_0_POS
'
'   I embedded the bank to save loading and saving:
'
Sam Bank 5
Sam Play %1,1
'
'   Print Sample Length:
'
Locate 0,1
Print Str$(Leek(G_CH0_LEN_ADDR))
'
'   Loop until Sample has finished, print current position as it plays:
'   Crude, but it shows the method...
'
Do
   Multi Wait
   
   '    Get current position:
   
   G_POS=Leek(G_CH0_POS_ADDR)
   
   If Btst(31,G_POS)
     
      '   If the top bit's set, it's finished:
     
      Locate 0,3
      Print "Finished!";
      Exit
   Else
     
      '  Otherwise, it's the position in the Sample:
     
      Locate 0,2
      Print Str$(G_POS)+Chr$(7);
   End If
Loop

Direct

'   ALL DONE!

Procedure _SCREEN_INIT
   '
   '   Hastily borrowed from another prog ;-)
   '
   '   Adjust for NTSC v PAL display.  Assign the Resource Bank
   '   and open Screen 0.
   '   NOTE!  Screen will have max height of Default Screen
   '          no matter what is specified in "Resource Screen Open"
   '          or "Screen Display".  So if you're PAL and only getting
   '          an NTSC height, check your Default Screen settings.
   '          Same applies to limiting the mouse!
   
   Auto View Off
   
   '  Grab the display offsets from the default screen;
   
   Default
   If Ntsc
      G_YSIZE=200
   Else
      G_YSIZE=256
   End If
   A=Screen Base
   G_XPOS=Deek(A+82)
   G_YPOS=Deek(A+84) and $FF
   For S=0 To 7
      Trap Screen Close S
   Next S
   Screen Open 0,640,G_YSIZE,4,Hires
   Screen Display 0,G_XPOS,G_YPOS,640,G_YSIZE
   Flash Off
   Auto View On
   Wait Vbl
   Cls 2
   Curs Off
   Pen 3
   Paper 2
End Proc

Hope it helps  ;)
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

KevG

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 87
Re: Help needed please. Sound issue
« Reply #4 on: August 17, 2013, 12:20:18 PM »

Hi bruceuncle. Thanks for your input in this matter. I'll try this out later if I don't have any luck with the D-Sam extension.

Cheers, Kev G
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022