Skip to content

Commit fafbbf5

Browse files
authored
Add 32-bit support to the Amiga AHI driver. (#86)
Both toolchains tested (bebbo GCC 6.5, adtools GCC 2.95) compile support with no issue. Audio initializes in the 32-bit modes with Paula (FS-UAE), but output is silent. There may be different results with different audio devices, but I don't have an emulated sound card set up currently.
1 parent 38b6ce7 commit fafbbf5

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

Changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Stable versions
44
4.3.0 (?):
55
Changes by Alice Rowan
66
- Support 24-bit and 32-bit output (requires libxmp 4.7.0+):
7-
ALSA, BeOS/Haiku, CoreAudio, NetBSD, OSS, PulseAudio,
7+
AHI, ALSA, BeOS/Haiku, CoreAudio, NetBSD, OSS, PulseAudio,
88
sndio, WinMM, AIFF, file, WAV.
99
- Use XMP_MAX_SRATE as the limit for -f instead of 48000
1010
(requires libxmp 4.7.0+).

src/sound_ahi.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ static void close_libs(void)
7474
static int init(struct options *options)
7575
{
7676
unsigned long fmt;
77+
int channels;
78+
int bits;
7779

7880
AHImp = CreateMsgPort();
7981
if (AHImp == NULL) {
@@ -97,10 +99,26 @@ static int init(struct options *options)
9799
goto err;
98100
}
99101

100-
if (options->format & XMP_FORMAT_8BIT) {
101-
fmt = options->format & XMP_FORMAT_MONO ? AHIST_M8S : AHIST_S8S;
102-
} else {
103-
fmt = options->format & XMP_FORMAT_MONO ? AHIST_M16S : AHIST_S16S;
102+
bits = get_bits_from_format(options);
103+
channels = get_channels_from_format(options);
104+
105+
switch (bits) {
106+
case 8:
107+
fmt = (channels == 1) ? AHIST_M8S : AHIST_S8S;
108+
bits = 8;
109+
break;
110+
case 16:
111+
default:
112+
fmt = (channels == 1) ? AHIST_M16S : AHIST_S16S;
113+
bits = 16;
114+
break;
115+
#if defined(AHIST_M32S) && defined(AHIST_S32S)
116+
case 24:
117+
case 32:
118+
fmt = (channels == 1) ? AHIST_M32S : AHIST_S32S;
119+
bits = 32;
120+
break;
121+
#endif
104122
}
105123

106124
AHIReq[0]->ahir_Std.io_Command = CMD_WRITE;
@@ -119,8 +137,9 @@ static int init(struct options *options)
119137
goto err;
120138
}
121139

122-
options->format &= ~XMP_FORMAT_UNSIGNED;
123-
options->format &= ~XMP_FORMAT_32BIT;
140+
update_format_bits(options, bits);
141+
update_format_signed(options, 1);
142+
124143
active = 0;
125144
return 0;
126145

0 commit comments

Comments
 (0)