Subject: audio.device

From: amadeus
Date: Fri Sep 2 22:51:42 2005

To: Kohina-UADE-Forum
I just looked at the sources for Multi Player 1.32 (which is GPL), and they have implemented audio.device support in about 70 lines of asm code.

Is UADE (1.5?) suited to *.device support, or will it require some rewriting in the core?

---

From: shd
Date: Sun Sep 4 11:19:03 2005

To: Kohina-UADE-Forum
[quote:cce5acb80d="amadeus"]I just looked at the sources for Multi Player 1.32 (which is GPL), and they have implemented audio.device support in about 70 lines of asm code.

Is UADE (1.5?) suited to *.device support, or will it require some rewriting in the core?[/quote:cce5acb80d]

What does the code do? Is it only used to allocate channels? We can't directly copy code from Multi Player because our sound core is LGPLed. I won't look at the source code, but if someone tells me what the purpose of that code is then maybe I can create an implementation of my own.

But where do we really need audio.device? A quick look showed that only MaxTrax could make use of that. Are there others?

---

From: amadeus
Date: Sun Sep 4 12:13:15 2005

To: Kohina-UADE-Forum
[quote:00031bce27="shd"]What does the code do? Is it only used to allocate channels? We can't directly copy code from Multi Player because our sound core is LGPLed. I won't look at the source code, but if someone tells me what the purpose of that code is then maybe I can create an implementation of my own.[/quote:00031bce27]

Okay. I see the conflict there.

But yes, it allocates and afterwards frees the audio.device channels.

[quote:00031bce27="shd"]But where do we really need audio.device? A quick look showed that only MaxTrax could make use of that. Are there others?[/quote:00031bce27]

No, MaxTrax is the only one left that requires audio.dev

---

From: shd
Date: Sun Sep 4 12:29:48 2005

To: Kohina-UADE-Forum
[quote:807fc19d60="amadeus"]
No, MaxTrax is the only one left that requires audio.dev[/quote:807fc19d60]

Could you check what kind of functionality we need for audio.device to make MaxTrax work? Audio.device can do a lot more than just allocate channels so I'd rather know how much we need to do.

The audio.device commands are:

 CMD_WRITE
 CMD RESTE
 CMD_FLUSH
 CMD_STOP
 CMD_START
 CMD_READ
 ADCMD_ALLOCATE
 ADCMD_FREE
 ADCMD_SETPREC
 ADCMD_LOCK
 ADCMD_PREVOL
 ADCMD_WAITCYCLE
 ADCMD_FINISH

---

From: shd
Date: Sun Sep 4 12:33:15 2005

To: Kohina-UADE-Forum
[quote:423878f0b7="shd"]

 CMD_WRITE
 CMD RESTE
 CMD_FLUSH
 CMD_STOP
 CMD_START
 CMD_READ
 ADCMD_ALLOCATE
 ADCMD_FREE
 ADCMD_SETPREC
 ADCMD_LOCK
 ADCMD_PREVOL
 ADCMD_WAITCYCLE
 ADCMD_FINISH[/quote:423878f0b7]

Also, OpenDevice can be used to allocate channels while opening the device. No IO commands are required to do that.

 lea chans,a0
 lea audiodeviceio,a1
 moveq #4,d0
 move.l a0,ioa_Data(a1)
 move.l d0,ioa_Length(a1)
 OpenDevice()

chans: dc.b 1,2,4,8

If we can do with just handling audio device opening stuff I'm glad. But if we need playback support too, it gets lot more complex.

---

From: amadeus
Date: Sun Sep 4 15:07:14 2005

To: Kohina-UADE-Forum
Okay, this is wired. It seams that MaxTrax only uses audio.device to start and stop the music. Can that really be true?

From MaxTrax.lha:max.asm
[code:1:ee59851685]
* init audio blocks
     move.l  _audio_ctrl,a1           ; set-up open device
     move.b  #127,LN_PRI&#40;a1&#41;    ; don't allow stealing
     move.l  _play_port,MN_REPLYPORT&#40;a1&#41; ; the reply port
     move.w  #$0f0f,-&#40;sp&#41;             ; allocation key is 0f
     move.l  sp,ioa_Data&#40;a1&#41;        ; data on stack
     moveq   #1,d0                        ; only one byte
     move.l  d0,ioa_Length&#40;a1&#41;

      lea             audio_name,a0    ; call OpenDevice
      moveq   #0,d0
      moveq   #0,d1
      move.l  _SysBase,a6
      JSRLIB  OpenDevice
      addq.w  #2,sp                        ; clean-up stack

      tst.l   d0                                  ; if not zero, an error
      bne             98$

      move.l  _audio_ctrl,a1
      move.l  IO_DEVICE&#40;a1&#41;,d0
      move.l  d0,_AudioDevice       ; get AudioDevice ptr

[/code:1:ee59851685]

---

From: shd
Date: Sun Sep 4 15:12:50 2005

To: Kohina-UADE-Forum
[quote:aed5ed14cb="amadeus"]Okay, this is wired. It seams that MaxTrax only uses audio.device to start and stop the music. Can that really be true?
[/quote:aed5ed14cb]

I guess yes, but you can verify that rather easily. If you can see writes to audio hw registers then it's probably true, because program hitting audio hw through audio.device and application code would be insane (unfortunately I've seen plenty of insane playroutines on Amiga :-).

---

From: amadeus
Date: Sun Sep 4 19:18:19 2005

To: Kohina-UADE-Forum
[quote:9ea2758d91="shd"]I guess yes, but you can verify that rather easily. If you can see writes to audio hw registers then it's probably true, because program hitting audio hw through audio.device and application code would be insane (unfortunately I've seen plenty of insane playroutines on Amiga :-).[/quote:9ea2758d91]

The music player is not initialized by audio.dev, but the channels are. audio_name points to audio.device 

What bothers me, is that I can't see writes to hardware registers, which I ought to, because the init player doesn't use audio.dev

---

From: shd
Date: Sat Oct 29 14:03:36 2005

To: Kohina-UADE-Forum
[quote:cdc81774bc="amadeus"]
What bothers me, is that I can't see writes to hardware registers, which I ought to, because the init player doesn't use audio.dev[/quote:cdc81774bc]

Look at max.asm line  2265. There it starts to prepare an audio.device write command to play a sample.

---

From: amadeus
Date: Mon Oct 31 01:51:52 2005

To: Kohina-UADE-Forum
[quote:ccc8a8cfda="shd"]Look at max.asm line  2265. There it starts to prepare an audio.device write command to play a sample.[/quote:ccc8a8cfda]

Yeah, you are right.

There even seams to be some sort of stereo multiplexing going on there...