English Amiga Board


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

 
 
Thread Tools
Old 29 August 2013, 13:12   #1
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
How to test audio channel in replay

Hello everyone,

I'm new to this forum, a few days ago, I started to try to recode Amiga 500 for fun.

I lost all my knowledge on this machine, do not get old lol!

In short, a thing I never learned to do is to test the four audio channels of the amiga.

example the following link (the loader copperbarres bottom of the screen):

[ Show youtube player ]

What interests me is just how it retrieves information in their replayroutine.

If someone has a small example and a clear exeplication I'm interested.

Sorry for my English.

Thank you in advance

Powergoo
Powergoo is offline  
Old 29 August 2013, 13:15   #2
Rob 1
The Original Domainiac
 
Rob 1's Avatar
 
Join Date: Oct 2012
Location: Stafford/UK
Age: 47
Posts: 1,292
Cool

I've no idea sorry, but welcome to the EAB Powergoo
Rob 1 is offline  
Old 29 August 2013, 13:18   #3
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
Quote:
Originally Posted by Rob 1 View Post
I've no idea sorry, but welcome to the EAB Powergoo
Thanks
Powergoo is offline  
Old 29 August 2013, 13:30   #4
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by Powergoo View Post
In short, a thing I never learned to do is to test the four audio channels of the amiga.
...
What interests me is just how it retrieves information in their replayroutine.
You cannot easily read that from a hardware register. You only get an audio interrupt, when a channel has finished playing a sample.

Usually you will have the source of the replay routine as part of your project, so you can read the channel status from it. For example I released an optimized Protracker replayer here:

http://eab.abime.net/coders-releases/65430-protracker-player-support-external-sound-fx.html"]eab.abime.net/coders-releases/65430-protracker-player-support-external-sound-fx.html

There is a channel status structure for each of the four channels. The first two words of the structure (n_note and n_cmd) contain the current note and command to be played. You could just check if n_note is non-zero and set your copper bar to full length. When it is zero make the bar smaller until reaching minimal height.
phx is offline  
Old 29 August 2013, 13:34   #5
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
Quote:
Originally Posted by phx View Post
You cannot easily read that from a hardware register. You only get an audio interrupt, when a channel has finished playing a sample.

Usually you will have the source of the replay routine as part of your project, so you can read the channel status from it. For example I released an optimized Protracker replayer here:

http://eab.abime.net/coders-releases/65430-protracker-player-support-external-sound-fx.html"]eab.abime.net/coders-releases/65430-protracker-player-support-external-sound-fx.html

There is a channel status structure for each of the four channels. The first two words of the structure (n_note and n_cmd) contain the current note and command to be played. You could just check if n_note is non-zero and set your copper bar to full length. When it is zero make the bar smaller until reaching minimal height.

Ok i try this thanks
Powergoo is offline  
Old 29 August 2013, 21:12   #6
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
I wanted to test your code, but I use Devpac 2 (yes I know this is old but I know that one and seka or Asmone)

So I get errors when I want to assemble your replay code as Devpac.

; Channel Status
rsreset
n_note rs.w 1

rsreset is a label?
rs.w what is it?

xref _LinkerDB ???



near a4 ???

code ???


, ------------------------------------------------- --------------------------
xdef mt_install_cia ???
mt_install_cia:

??? is what i don't understand

Vasm looks great for use on my pc, I'll have to test it
Powergoo is offline  
Old 30 August 2013, 14:01   #7
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by Powergoo View Post
So I get errors when I want to assemble your replay code as Devpac.
Sorry for that. The source is not 100% compatible with Devpac. PhxAss and vasm should do.

Quote:
; Channel Status
rsreset
n_note rs.w 1

rsreset is a label?
rs.w what is it?
Did you lose the TABs in the source? There is definitely a TAB before rsreset, which is a directive known to Devpac, AsmOne and most other assemblers.

You can define structure offsets with RSRESET and RS. RSRESET resets the counter to 0 and RS.W <cnt> increases the counter by 2*<cnt>.

Quote:
xref _LinkerDB ???
_LinkerDB is a symbol provided by the linker, which is set to an address pointing into your small data segment. Usually you will load the small data base register A4 with it, to address up to 64K of data in this segment.

Most linkers support it: e.g. blink, slink, PhxLnk, vlink, ...

Quote:
near a4 ???
The NEAR directive should be the only directive in this source which is only supported by PhxAss and vasm. Sorry for that.

It is not even needed as an assembler should recognize a small data addressing mode when seeing "LABEL(An)" (vasm does, PhxAss perhaps not).

Just tested it and saw that Devpac cannot handle it. You may have to convert all small data accesses to absolute ones, i.e. delete the NEAR and remove the (A4) from all operands.

Or try it with AsmOne and the BASEREG directive. But then you must have a single source and cannot link anymore.


Quote:
code ???
I thought that most assemblers know that as an alias for "section code,code". TAB missing?


Quote:
xdef mt_install_cia ???
mt_install_cia:

??? is what i don't understand
XDEF makes the symbol globally visible for the linking process.
All assemblers support it. Definitely. Is there a TAB missing again?

Last edited by phx; 30 August 2013 at 14:11.
phx is offline  
Old 01 September 2013, 01:03   #8
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
first I change the beginning of the code
Code:
;    near    a4

;    code
    section code,code_c
then for each call (a4)

Code:
mt_install_cia:
; Install a CIA-B interrupt for calling mt_music.
; a6 = CUSTOM
; a4 = small data base
; a0 = AutoVecBase
; d0 = PALflag.b (0 is NTSC)

;    clr.b    mt_Enable(a4)    
    clr.b    mt_Enable
I remove the two lea _linkerDB, a4

Code:
mt_TimerAInt:
; TimerA interrupt calls mt_music at a selectable tempo (Fxx command),
; which defaults to 50 times per second.

    movem.l    d0-d7/a0-a6,-(sp)
;    lea    _LinkerDB,a4
    lea    CUSTOM,a6


    ; it was a TB interrupt, set repeat sample pointers and lengths
;    lea    _LinkerDB,a4
    move.l    mt_chan1+n_loopstart,AUD0LC(a6)
I change this line because I got an error with the cnop 0,4
("bss section or an offset can not contain data") :

Code:
;    section    __MERGED,bss
    section    __MERGED,data_c
At this moment, I get no error in Devpac 3.5 (yes I changed version;-))

I add a test routine
Code:
   
;    code
    section code,code_c


    
    
Start:
    lea        module,a0
    lea        CUSTOM,a6
    jsr        mt_init
    move.b    #1,mt_Enable

Wait:
    MOVE.L    $DFF004,D0
    LSR.L    #8,D0
    AND.W    #%111111111,D0
    CMP.W    #$0019,D0
    BNE.S    Wait
    
    move.b    #1,mt_Enable
    lea        CUSTOM,a6
    jsr        mt_music
    
    BTST    #6,$BFE001          
    BNE.S    Wait

    lea        CUSTOM,a6
    jsr        mt_end
End:
    rts
at the end :
Code:
sfx_vol:
    ds.w    1
module:    incbin    mod.mymodule
But i haven't no sound :-(

where i'm wrong ???
Powergoo is offline  
Old 01 September 2013, 10:22   #9
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Sounds like the interrupt code might not be called. Add some "move.w $dff006,$dff180" debug flashing in the interrupt routine, if you see the flashing colors it at least means the interrupt code is called correctly.

Edit: Seeing that you included the module right after the variables I have to ask if the module is in chip ram?

Last edited by StingRay; 01 September 2013 at 10:53.
StingRay is offline  
Old 01 September 2013, 14:57   #10
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
Quote:
Originally Posted by StingRay View Post
Sounds like the interrupt code might not be called. Add some "move.w $dff006,$dff180" debug flashing in the interrupt routine, if you see the flashing colors it at least means the interrupt code is called correctly.

Edit: Seeing that you included the module right after the variables I have to ask if the module is in chip ram?

I do not use the Interupt, but since I call my music in my main loop I should normally have the music?

the module is in chip i use :
Code:
;    section    __MERGED,bss     
section    __MERGED,data_c
Powergoo is offline  
Old 01 September 2013, 15:01   #11
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Can you upload your modified code? So we can have a look.
StingRay is offline  
Old 01 September 2013, 15:20   #12
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
Quote:
Originally Posted by StingRay View Post
Can you upload your modified code? So we can have a look.
yes !!!
Attached Files
File Type: s replay.s (61.0 KB, 275 views)
Powergoo is offline  
Old 01 September 2013, 15:37   #13
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
You need to call "mt_init_cia" to install the cia interrupt as the replayer relies on that as far as I can see. Try that and see if it changes anything.
StingRay is offline  
Old 01 September 2013, 16:42   #14
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
Quote:
Originally Posted by StingRay View Post
You need to call "mt_init_cia" to install the cia interrupt as the replayer relies on that as far as I can see. Try that and see if it changes anything.
Yes i have now the music thanks StingRay

Code:
Start:
    ;(a6=CUSTOM, a4=SmallDataBase, a0=AutoVecBase, d0=PALflag.b)
    lea    CUSTOM,a6    
    move.l    #0,a0
    move.b    #1,d0
    jsr mt_install_cia
    
    lea    module,a0
    lea    CUSTOM,a6
    jsr    mt_init
    move.b    #1,mt_Enable
Wait:
    MOVE.L    $DFF004,D0
    LSR.L    #8,D0
    AND.W    #%111111111,D0
    CMP.W    #$0019,D0
    BNE.S    Wait
    
    BTST    #6,$BFE001          
    BNE.S    Wait

    lea        CUSTOM,a6
    jsr        mt_remove_cia
    lea        CUSTOM,a6
    jsr        mt_end
End:
    rts
As you can see i've use 0 for a0, but normally i must get the vbr no ?

Right now I must make VU meter like ProTracker
Powergoo is offline  
Old 01 September 2013, 18:24   #15
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Yes, in a "real world example" you would need to get the location of the VBR as it can be relocated to fast memory. Just check the CPU type (on 68000 you don't have to do anything, no VBR there) and use movec VBR,dx/ax to get the VBR location.
StingRay is offline  
Old 07 September 2013, 12:00   #16
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
Hello,

I've coded my routine of Vu-meter

I do not know what I'm doing wrong, but I do not otient the same result as the VU meter of ProTracker.

if someone can take a look
Attached Files
File Type: s VuMeters.s (66.9 KB, 267 views)
Powergoo is offline  
Old 07 September 2013, 12:34   #17
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Had a quick look at your code, Protracker (at least 3.xx series) uses "real" VU-meters, i.e. the volume is taken into account too. You only check if a new note has been played which is why you get a different looking VU-meter.
StingRay is offline  
Old 07 September 2013, 13:42   #18
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
Quote:
Originally Posted by StingRay View Post
Had a quick look at your code, Protracker (at least 3.xx series) uses "real" VU-meters, i.e. the volume is taken into account too. You only check if a new note has been played which is why you get a different looking VU-meter.

ok and how to test volume in each channel ?
I hope volume ha a range of 0-64 no ?
Powergoo is offline  
Old 07 September 2013, 17:17   #19
Powergoo
Registered User
 
Powergoo's Avatar
 
Join Date: Aug 2013
Location: france
Posts: 20
ok i found volume for each channel and modify my code with :
Code:
TestZic:
    
    lea        joue,a5                    ; height of the vu-Meters    
    lea        mt_chan1,a0                ; position of the first channel
    move.l    planeadr,d6                    
    add.l    #40*(256-HEIGHT)+10,d6    ; first position of the first vu-Meter in the bitplan
    jsr        TestChannel                ; display the Vumeter for this channel    
    
    add.l    #6,d6                    ; next position 
    lea        mt_chan2,a0                ; position of the second channel
    jsr        TestChannel                ; display the Vumeter for this channel    
    
    add.l    #6,d6                    ; next position 
    lea        mt_chan3,a0                ; position of the thrid channel
    jsr        TestChannel                ; display the Vumeter for this channel    
    
    add.l    #6,d6                    ; next position 
    lea        mt_chan4,a0                ; position of the fourth channel
    jsr        TestChannel                ; display the Vumeter for this channel    
    
    rts

TestChannel:
    move.l    (a5),d3                    ;    height of vu meter
    move.w    0(a0),d0                
    clr.l    d1
    move.w    n_volume(a0),d1            ; volume of the note
    
    cmp.w    #0,d0                    ; a note is played ?    
    beq.s    .suite                    ; no then we continue
    move.l    #HEIGHT-1,d3            ; vu meter height maximum
    bra.s    .fin
.suite:                                ; no note is played
    cmp.l    #0,d3                    ; is you are already at the bottom    
    beq.s    .fin                    ; yes then we continue
    sub.l    #1,d3                    ; no we descend the vumeter
.fin:    
    move.l    d3,(a5)
    mulu.w    d1,d3                    ; multiply the height of vu-meter with volume of the note
    lsr.l    #6,d3                    ; and divide by 64 (range volume is between 0 - 64)
    move.l    d6,a6                    
    move.l    #HEIGHT-2,d4            ; -2 because we wanted alway 1 pixel minimum show
    sub.l    d3,d4
    ble.s    .pas0
.boucle:    
    move.w    #$0000,(a6)                ; erases the difference    
    add.l    #NCOL,a6
    dbra    d4,.boucle
.pas0:    
    
.boucle2:
        move.w    #$ffff,(a6)            ; displays the meter relative to its height
        add.l    #NCOL,a6
        dbra    d3,.boucle2
    addq.l    #4,a5                ; next height for the next vu-meter
    rts
joue:    dc.l    0,0,0,0
Powergoo 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
A4000 Rev B Audio Low One Channel Loedown support.Hardware 4 20 March 2013 14:47
Amiga audio channel split by hardware? Amiga1992 Hardware mods 58 20 January 2013 11:12
CD32 Frog Feast test available. Test out the final! cdoty News 42 01 April 2008 16:20
Virtual "Fifth" audio channel wanderer request.UAE Wishlist 3 03 September 2007 20:31
Picasso IV 4 Audio Channel Mixer setup Tony Landais support.Hardware 0 25 December 2003 15:45

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 00:13.

Top

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