Page 1 of 1
Controlling the TT sound system.
Posted: 26 May 2018 18:19
by stephen_usher
I'm currently writing a game menu program to sit in the AUTO folder which will then list the available games allow a user to select and run them.
I've got the basics working but because it runs before the sound control panel has started the sound defaults to maximum volume with the internal speaker turned on.
What I would like to do is allow the program's configuration file to contain the default volume and whether the internal speaker is enabled.
I think I can probably work out how to use the Microwire interface to control the volume from C but I've found no documentation about how to control the internal speaker. The Atari TT release notes don't mention it and merely say that the DMA sound system is the same as the STe's. I'm guessing that it would be the same on the Mega STe.
Does anyone know?
Re: Controlling the TT sound system.
Posted: 27 May 2018 11:35
by stephen_usher
Someone on the Atari Forum pointed me at the XCONTROL.ACC source file 'block2.c' which uses the following to control the TT speaker:
void
Set_Speaker( void )
{
if( IsSpeaker() )
{
if( cur_value.TT_Speaker )
Offgibit( 0xBf ); /* Turn off Speaker */
else
Ongibit( 0x40 ); /* Turn on Speaker */
}
}
Now, I've put this in my code and it makes not a darned bit of difference, as you can see here with my broken for some reason volume setting code...
#include <osbind.h>
#include <string.h>
#define MICROWIRE_DATA_ADDR 0xff8922
#define MICROWIRE_MASK_ADDR 0xff8924
unsigned short *mw_mask = MICROWIRE_MASK_ADDR;
unsigned short *mw_data = MICROWIRE_DATA_ADDR;
unsigned short value;
void do_microwire();
void set_volume(int volume)
{
value = 0x0400 + volume;
Supexec(do_microwire);
return;
}
void do_microwire()
{
int i;
unsigned short mask = 0x07ff;
*mw_mask = mask;
while(*mw_mask != mask) i++;
*mw_data = value;
}
void set_speaker(int onoff)
{
if (onoff == 0)
Offgibit(0x8f);
else
Ongibit(0x40);
return;
}
What fun the STe/TT sound system is, not!
P.S. I think I've seen why my volume setting might be broken, I should use 0x04c0 rather than 0x0400 to add to the volume level (0 -> 40).
Re: Controlling the TT sound system.
Posted: 27 May 2018 12:30
by stephen_usher
Doh! I've just re-read the TT Release Notes again and found what it says is the speaker on/off:
PROGRAMMABLE SOUND GENERATOR
(also provides bi-directional parallel printer port and miscellaneous output latch)
8800 RO xxxx xxxx ---- ---- PSG Read Data
8800 WO 0000 0000 ---- ---- PSG Register Select
8802 WO xxxx xxxx ---- ---- PSG Write Data
Port A Bit Assignments
7 *LAN Select (0 routes SCC Port A to LAN connector)
6 *Speaker Disable (0 disables internal speaker)
5 Printer Port Strobe
4 *DTR (MFP-ST serial port)
3 *RTS (MFP-ST serial port)
2 *Floppy 1 Select
1 *Floppy 0 Select
0 *Floppy Side 0 Select
I'm guessing that the '*' means TT only, but that doesn't fit with the bits 0-3 definitions.
Still Ongibit(6) and Offgibit(6) still don't do anything for the speaker.
Re: Controlling the TT sound system.
Posted: 28 May 2018 16:07
by stephen_usher
Oh well, it turns out Ongibit(0x40) was working to turn off the speaker but the game I was testing all the time, "Bubble Bobble" (or the hard disk loader) seems to reset the PSG Port A for some unknown reason.
I only found this out after trying many things including upgrading mintlibs to patchlevel 46 from 44, making sure that the argument passed was an unsigned short etc.
I'd given up and moved onto the machine detection part. Then I tried "Chaos Engine" and amazingly there was no sound from the speaker!
So, the final job will be turning off the CPU caches if the machine is a TT.
Re: Controlling the TT sound system.
Posted: 28 May 2018 22:50
by stephen_usher
Just in case you're interested I've finished my game menu program and you can download it here:
http://www.lingula.org.uk/~steve/downlo ... enu.tar.gz
Re: Controlling the TT sound system.
Posted: 29 May 2018 18:35
by stephen_usher
Darn! The board won't allow the attachment of *.zoo files. So, here's a link to the binary download...
http://www.lingula.org.uk/~steve/downloads/gamemenu.zoo
Re: Controlling the TT sound system.
Posted: 29 May 2018 19:18
by stephen_usher
ZOO is one of the old standard formats for the Atari, along with LHarc.
Re: Controlling the TT sound system.
Posted: 29 May 2018 19:31
by exxos
I can't even remember last time I saw a zoo file. I never added it into the forum support list. Most users will download on PC first , so easier to use zip as easily supported on ST and PC IMO :)
Re: Controlling the TT sound system.
Posted: 29 May 2018 19:38
by stephen_usher
exxos wrote: 29 May 2018 19:31
I can't even remember last time I saw a zoo file. I never added it into the forum support list. Most users will download on PC first , so easier to use zip as easily supported on ST and PC IMO :)
I'm not sure I have something as modern as zip or unzip on any of my Ataris. :lol:
Hey! I'm still using GCC 2.5.8 and mintlib pl. 46 after all. :D
Re: Controlling the TT sound system.
Posted: 29 May 2018 19:41
by exxos
stephen_usher wrote: 29 May 2018 19:38
I'm not sure I have something as modern as zip or unzip on any of my Ataris. :lol:
Easy to do ;)
https://www.exxosforum.co.uk/forum/viewt ... ?f=25&t=58