Controlling the TT sound system.
Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team
Controlling the TT sound system.
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?
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?
- lp
- Fuji Shaped Bastard
- Posts: 2542
- Joined: Wed Nov 12, 2003 11:09 pm
- Location: GFA Headquarters
- Contact:
Re: Controlling the TT sound system.
For the speaker have a look at the source code of XCONTROL.ACC. Specifically file BLOCK2.C.
You do not have the required permissions to view the files attached to this post.
-
- Hardware Guru
- Posts: 2310
- Joined: Sat Sep 10, 2005 11:11 am
- Location: Kosice, Slovakia
- Contact:
Re: Controlling the TT sound system.
Btw, there's a similar tool for given task: http://paradize.final-memory.org/tools.shtml (Atari ST Harddisk Menu)
Re: Controlling the TT sound system.
Excellent! Thank-you.
Where can I find the complete source of XCONTROL.ACC?
There's a lot of routines and information in the headers etc.
Where can I find the complete source of XCONTROL.ACC?
There's a lot of routines and information in the headers etc.
Re: Controlling the TT sound system.
Source code of XCONTROL itself and the CPXes: https://www.dev-docs.org/docs/htm/searc ... ri_src.zipsusher wrote:Excellent! Thank-you.
Where can I find the complete source of XCONTROL.ACC?
There's a lot of routines and information in the headers etc.
Re: Controlling the TT sound system.
Thanks.
The relevant code in BLOCK2.C seems to be:
However, if I use this in my program it doesn't seems to do anything at all.
The relevant code in BLOCK2.C seems to be:
Code: Select all
void
Set_Speaker( void )
{
if( IsSpeaker() )
{
if( cur_value.TT_Speaker )
Offgibit( 0xBf ); /* Turn off Speaker */
else
Ongibit( 0x40 ); /* Turn on Speaker */
}
}
Re: Controlling the TT sound system.
Doh! I've just re-read the TT Release Notes again and found what it says is the speaker on/off:
Still Ongibit(6) and Offgibit(6) still don't do anything for the speaker.
I'm guessing that the '*' means TT only, but that doesn't fit with the bits 0-3 definitions.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
Still Ongibit(6) and Offgibit(6) still don't do anything for the speaker.
Re: Controlling the TT sound system.
Of course not, because the original syntax was right. You don't give the bit number to Ongibit and Offgibit, but a bit mask, like Atari did in the GENERAL.CPX source code.susher wrote:Still Ongibit(6) and Offgibit(6) still don't do anything for the speaker.
As for why the correct code doesn't work for you: The speaker isn't broken, is it? Also of course if you have muted the sound via the LMC1992, the speaker won't be able to output anything.
Re: Controlling the TT sound system.
Well, the original didn't work to turn off the speaker (it continues to operate).
I changed the value to 6 after reading the definition of the function calls in "Atari ST Internals" which says give the bit number and gives examples in assembler.
I changed the value to 6 after reading the definition of the function calls in "Atari ST Internals" which says give the bit number and gives examples in assembler.
Re: Controlling the TT sound system.
Atari ST Internals is wrong here, I recommend using other documentation.
But back to the original question: Can you turn the speaker on and off using Atari's control panel?
But back to the original question: Can you turn the speaker on and off using Atari's control panel?
Re: Controlling the TT sound system.
Yes, the control panel operates correctly.
Re: Controlling the TT sound system.
I can confirm that on my TT Ongibit( 0x40 ) turns the speaker off while Offgibit( 0xBF ) turns it on. So the commands are correct, just the comments in the source code are wrong.
Re: Controlling the TT sound system.
Well, I'm blowed if I can get it to work either way.
Here's my code:
I wonder if I need to cast the values passed to Ongibit() and Offgibit() to unsigned char?
Here's my code:
Code: Select all
void set_speaker(int onoff)
{
#ifdef DEBUG2
printf("set_speaker: onoff = %d\n", onoff);
#endif
if (onoff == 0)
{
#ifdef DEBUG2
printf("set_speaker: Offgibit(0xbf)\n");
#endif
Offgibit(0xbf);
}
else
{
#ifdef DEBUG2
printf("set_speaker: Ongibit(0x40)\n");
#endif
Ongibit(0x40);
}
#ifdef DEBUG2
sleep(5);
#endif
return;
}
Re: Controlling the TT sound system.
Which compiler? Does this code work?
Code: Select all
#include <tos.h>
void main(void)
{
Cconws("Speaker off\n\rPress a key\n\r");
Ongibit(0x40);
Cconin();
}
You do not have the required permissions to view the files attached to this post.
Jo Even
VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
Re: Controlling the TT sound system.
Which compiler/libraries are you using?
I'm using an ancient GCC and mintlibs44 at the moment.
I'm using an ancient GCC and mintlibs44 at the moment.
Re: Controlling the TT sound system.
I'm using PureC.
Jo Even
VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
Re: Controlling the TT sound system.
Upgraded to mintlibs Pl.46 (still gcc 2.5.8 PL 1). Tried passing an unsigned short as the mask and no difference. I even tried setting the high byte rather than the low one in case that was the issue, but no.
Re: Controlling the TT sound system.
Did my program (binary) work?
Jo Even
VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
-
- Atari God
- Posts: 1327
- Joined: Sun Aug 03, 2014 5:54 pm
Re: Controlling the TT sound system.
Is there a specific reason for using such an old compiler? Might as well be that he is just generating wrong code.susher wrote:Upgraded to mintlibs Pl.46 (still gcc 2.5.8 PL 1)
Re: Controlling the TT sound system.
Yes, it did.joska wrote:Did my program (binary) work?
Re: Controlling the TT sound system.
2.5.8p1 was one of the good versions. 2.7.2 was the classic high-point for GCC and probably the last you'd want to run natively on an Atari.ThorstenOtto wrote:Is there a specific reason for using such an old compiler? Might as well be that he is just generating wrong code.susher wrote:Upgraded to mintlibs Pl.46 (still gcc 2.5.8 PL 1)
The reason? Well, I'm running under MiNT 1.12 and looking at updating my old MiNTOS distribution incrementally.
Re: Controlling the TT sound system.
As it happens, once I made sure that the mask being passed to Ongibit was an unsigned short it did work. However, I didn't realise that it did as it seems the game I was testing this with seems to reset the PSG Port A for some unknown reason, which meant that my work was undone by it.
It was only after working on another part of the code and decided to try a different game that I found that it was in fact working!
It was only after working on another part of the code and decided to try a different game that I found that it was in fact working!
Re: Controlling the TT sound system.
In case anyone's interested, I've finished the game launcher menu program, at least for this iteration.
You can find it here:

You can find it here: