Welcome, Guest. Please login or register.

Author Topic: audio streaming with AHI problem  (Read 4765 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DamageXTopic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show all replies
    • http://www.hyakushiki.net/
audio streaming with AHI problem
« on: July 16, 2019, 11:50:58 AM »
I created a message port, created two io request (set ahi parameters), and opened ahi device. Then I use sendio/checkio/waitio. However I can ONLY play 8-bit mono.
Code: [Select]
;AHIST_M8S EQU 0 ; Mono, 8 bit signed (BYTE)
;AHIST_M16S EQU 1 ; Mono, 16 bit signed (WORD)
;AHIST_S8S EQU 2 ; Stereo, 8 bit signed (2ラBYTE)
;AHIST_S16S EQU 3 ; Stereo, 16 bit signed (2ラWORD)
;AHIST_M32S EQU 8 ; Mono, 32 bit signed (LONG)
;AHIST_S32S EQU 10 ; Stereo, 32 bit signed (2ラLONG)
Type 0 is the only one that works. The other ones don't return an error but playback appears to freeze after one block, sometimes with a loop of garbage data continuing.

I did find that setting the "channels" to 2 under AHI prefs allowed playing two separate 8-bit streams, using four buffers. It's hard to believe that this is the only option for Paula??
 

Offline DamageXTopic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show all replies
    • http://www.hyakushiki.net/
Re: audio streaming with AHI problem
« Reply #1 on: July 17, 2019, 09:08:21 AM »
After calling opendevice I duplicate the first ioreq to the second by copying all 80 bytes. The address at offset $2C is then changed to point to the second buffer. After playback begins the link field at offset $4C is filled in, first for ioreq2 then ioreq1.

Is there a different way that it should be done?

With audio type other than 0 it seems to play two blocks and then stop. Then checkio always returns nonzero, and waitio returns 0.

If I set the audio type to an invalid value then I get error 3 as expected (at ioreq offset $1F).
 

Offline DamageXTopic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show all replies
    • http://www.hyakushiki.net/
Re: audio streaming with AHI problem
« Reply #2 on: July 18, 2019, 04:37:13 AM »
Thanks for posting that source. I'm not very good with C but I did notice a couple of differences compared to my original code: you only used createiorequest once and then copied that to two separate memory buffers, and you wrote parameters to those ioreq structures EVERY time you called sendio.

I implemented these changes in my program and now I can play 8-bit stereo. Cheers!