annotate src/audio/mint/SDL_mintaudio_xbios.c @ 3846:66fb40445587 SDL-ryan-multiple-audio-device

Removed distinction between "available" and "init" in audio backends, since both had to be checked for success as a pair at the higher level and several of the Available methods were just always-succeed placeholders anyhow. Now the availability check is done in the init code, and the higher level tries all possible drivers until one manages to initialize successfully.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 17 Oct 2006 09:09:21 +0000
parents 1f156fd874fa
children
rev   line source
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
1 /*
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
769
b8d311d90021 Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents: 704
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
4
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
9
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
13 Library General Public License for more details.
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
14
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
18
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
19 Sam Lantinga
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
23
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
24 /*
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
25 MiNT audio driver
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
26 using XBIOS functions (Falcon)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
27
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
28 Patrice Mandin, Didier Méquignon
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
29 */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
30
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
31 #include <unistd.h>
1111
12c49532be00 Use MiNT thread to update DMA pointers instead of unusable MFP interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1107
diff changeset
32 #include <support.h>
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
33
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
34 /* Mint includes */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
35 #include <mint/osbind.h>
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
36 #include <mint/falcon.h>
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
37 #include <mint/cookie.h>
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
38
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
39 #include "SDL_audio.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
40 #include "../SDL_audio_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
41 #include "../SDL_sysaudio.h"
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
42
1412
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
43 #include "../../video/ataricommon/SDL_atarimxalloc_c.h"
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
44
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
45 #include "SDL_mintaudio.h"
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
46 #include "SDL_mintaudio_dma8.h"
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
47
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
48 /*--- Defines ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
49
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
50 #define MINT_AUDIO_DRIVER_NAME "mint_xbios"
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
51
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
52 /* Debug print info */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
53 #define DEBUG_NAME "audio:xbios: "
962
176240cf4405 Forgot to disable debug messages
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
54 #if 0
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
55 #define DEBUG_PRINT(what) \
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
56 { \
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
57 printf what; \
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
58 }
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
59 #else
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
60 #define DEBUG_PRINT(what)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
61 #endif
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
62
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
63 static unsigned long cookie_snd = 0;
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
64
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
65 static void
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
66 MINTXBIOS_LockDevice(_THIS)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
67 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
68 /* Stop replay */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
69 Buffoper(0);
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
70 }
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
71
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
72 static void
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
73 MINTXBIOS_UnlockDevice(_THIS)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
74 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
75 /* Restart replay */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
76 Buffoper(SB_PLA_ENA | SB_PLA_RPT);
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
77 }
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
78
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
79 static void
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
80 MINTXBIOS_CloseDevice(_THIS)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
81 {
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
82 if (this->hidden != NULL) {
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
83 /* Stop replay */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
84 SDL_MintAudio_WaitThread();
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
85 Buffoper(0);
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
86
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
87 if (!SDL_MintAudio_mint_present) {
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
88 /* Uninstall interrupt */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
89 Jdisint(MFP_DMASOUND);
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
90 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
91
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
92 /* Wait if currently playing sound */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
93 while (SDL_MintAudio_mutex != 0) {}
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
94
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
95 /* Clear buffers */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
96 if (SDL_MintAudio_audiobuf[0]) {
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
97 Mfree(SDL_MintAudio_audiobuf[0]);
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
98 SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
99 }
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
100
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
101 /* Unlock sound system */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
102 Unlocksnd();
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
103
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
104 SDL_free(this->hidden);
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
105 this->hidden = NULL;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
106 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
107 }
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
108
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
109 /* Falcon XBIOS implementation of Devconnect() is buggy with external clock */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
110 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
111 Devconnect2(int src, int dst, int sclk, int pre)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
112 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
113 static const unsigned short MASK1[3] = { 0, 0x6000, 0 };
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
114 static const unsigned short MASK2[4] = { 0xFFF0, 0xFF8F, 0xF0FF, 0x0FFF };
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
115 static const unsigned short INDEX1[4] = { 1, 3, 5, 7 };
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
116 static const unsigned short INDEX2[4] = { 0, 2, 4, 6 };
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
117 unsigned short sync_div, dev_ctrl, dest_ctrl;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
118 void *oldstack;
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
119
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
120 if (dst == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
121 return;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
122 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
123
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
124 oldstack = (void *) Super(0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
125
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
126 dev_ctrl = DMAAUDIO_IO.dev_ctrl;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
127 dest_ctrl = DMAAUDIO_IO.dest_ctrl;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
128 dev_ctrl &= MASK2[src];
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
129
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
130 if (src == ADC) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
131 dev_ctrl |= MASK1[sclk];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
132 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
133 dev_ctrl |= (INDEX1[sclk] << (src << 4));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
134 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
135
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
136 if (dst & DMAREC) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
137 dest_ctrl &= 0xFFF0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
138 dest_ctrl |= INDEX1[src];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
139 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
140
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
141 if (dst & DSPRECV) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
142 dest_ctrl &= 0xFF8F;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
143 dest_ctrl |= (INDEX1[src] << 4);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
144 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
145
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
146 if (dst & EXTOUT) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
147 dest_ctrl &= 0xF0FF;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
148 dest_ctrl |= (INDEX1[src] << 8);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
149 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
150
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
151 if (dst & DAC) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
152 dev_ctrl &= 0x0FFF;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
153 dev_ctrl |= MASK1[sclk];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
154 dest_ctrl &= 0x0FFF;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
155 dest_ctrl |= (INDEX2[src] << 12);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
156 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
157
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
158 sync_div = DMAAUDIO_IO.sync_div;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
159 if (sclk == CLKEXT) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
160 pre <<= 8;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
161 sync_div &= 0xF0FF;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
162 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
163 sync_div &= 0xFFF0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
164 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
165 sync_div |= pre;
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
166
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
167 DMAAUDIO_IO.dev_ctrl = dev_ctrl;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
168 DMAAUDIO_IO.dest_ctrl = dest_ctrl;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
169 DMAAUDIO_IO.sync_div = sync_div;
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
170
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
171 Super(oldstack);
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
172 }
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
173
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
174 static void
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
175 MINTXBIOS_CheckExternalClock(_THIS)
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
176 {
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
177 #define SIZE_BUF_CLOCK_MEASURE (44100/10)
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
178
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
179 unsigned long cookie_snd;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
180 char *buffer;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
181 int i, j;
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
182
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
183 /* DSP present with its GPIO port ? */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
184 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
185 return;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
186 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
187 if ((cookie_snd & SND_DSP) == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
188 return;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
189 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
190
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
191 buffer = Atari_SysMalloc(SIZE_BUF_CLOCK_MEASURE, MX_STRAM);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
192 if (buffer == NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
193 DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n"));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
194 return;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
195 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
196 SDL_memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE);
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
197
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
198 Buffoper(0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
199 Settracks(0, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
200 Setmontracks(0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
201 Setmode(MONO8);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
202 Jdisint(MFP_TIMERA);
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
203
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
204 for (i = 0; i < 2; i++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
205 Gpio(GPIO_SET, 7); /* DSP port gpio outputs */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
206 Gpio(GPIO_WRITE, 2 + i); /* 22.5792/24.576 MHz for 44.1/48KHz */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
207 Devconnect2(DMAPLAY, DAC, CLKEXT, CLK50K); /* Matrix and clock source */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
208 Setbuffer(0, buffer, buffer + SIZE_BUF_CLOCK_MEASURE); /* Set buffer */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
209 Xbtimer(XB_TIMERA, 5, 38, SDL_MintAudio_XbiosInterruptMeasureClock); /* delay mode timer A, prediv /64, 1KHz */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
210 Jenabint(MFP_TIMERA);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
211 SDL_MintAudio_clocktics = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
212 Buffoper(SB_PLA_ENA);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
213 usleep(110000);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
214
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
215 if ((Buffoper(-1) & 1) == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
216 if (SDL_MintAudio_clocktics) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
217 unsigned long khz;
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
218
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
219 khz =
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
220 ((SIZE_BUF_CLOCK_MEASURE /
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
221 SDL_MintAudio_clocktics) + 1) & 0xFFFFFFFE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
222 DEBUG_PRINT((DEBUG_NAME "measure %d: freq=%lu KHz\n",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
223 i + 1, khz));
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
224
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
225 if (khz == 44) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
226 for (j = 1; j < 4; j++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
227 SDL_MintAudio_AddFrequency(this,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
228 MASTERCLOCK_44K
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
229 /
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
230 (MASTERPREDIV_FALCON
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
231 * (1 << j)),
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
232 MASTERCLOCK_44K,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
233 (1 << j) - 1, 2 + i);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
234 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
235 } else if (khz == 48) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
236 for (j = 1; j < 4; j++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
237 SDL_MintAudio_AddFrequency(this,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
238 MASTERCLOCK_48K
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
239 /
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
240 (MASTERPREDIV_FALCON
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
241 * (1 << j)),
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
242 MASTERCLOCK_48K,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
243 (1 << j) - 1, 2 + i);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
244 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
245 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
246 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
247 DEBUG_PRINT((DEBUG_NAME "No measure\n"));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
248 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
249 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
250 DEBUG_PRINT((DEBUG_NAME "No SDMA clock\n"));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
251 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
252
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
253 Buffoper(0); /* stop */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
254 Jdisint(MFP_TIMERA); /* Uninstall interrupt */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
255 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
256
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
257 Mfree(buffer);
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
258 }
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
259
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
260 static int
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
261 MINTXBIOS_CheckAudio(_THIS)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
262 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
263 int i;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
264 Uint32 extclock;
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
265
2043
adf732f1f016 Formatting update
Sam Lantinga <slouken@libsdl.org>
parents: 2027
diff changeset
266 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
267 SDL_AUDIO_BITSIZE(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
268 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
269 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
270 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
271 DEBUG_PRINT(("channels=%d, ", this->spec.channels));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
272 DEBUG_PRINT(("freq=%d\n", this->spec.freq));
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
273
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
274 this->spec.format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
2005
45af7d69f8eb MiNT audio driver cleanups for clamping types and channels to supported
Ryan C. Gordon <icculus@icculus.org>
parents: 1895
diff changeset
275
45af7d69f8eb MiNT audio driver cleanups for clamping types and channels to supported
Ryan C. Gordon <icculus@icculus.org>
parents: 1895
diff changeset
276 /* clamp out int32/float32 */
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
277 if (SDL_AUDIO_BITSIZE(this->spec.format) >= 16) {
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
278 this->spec.format = AUDIO_S16MSB; /* Audio is always big endian */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
279 this->spec.channels = 2; /* 16 bits always stereo */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
280 } else if (this->spec.channels > 2) {
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
281 this->spec.channels = 2; /* no more than stereo! */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
282 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
283
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
284 MINTAUDIO_freqcount = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
285
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
286 /* Add external clocks if present */
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
287 MINTXBIOS_CheckExternalClock(this);
1107
856f76a099c7 Can use both clocks of FDI interface on Falcon, plus digital output
Patrice Mandin <patmandin@gmail.com>
parents: 1106
diff changeset
288
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
289 /* Standard clocks */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
290 for (i = 1; i < 12; i++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
291 /* Remove unusable Falcon codec predivisors */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
292 if ((i == 6) || (i == 8) || (i == 10)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
293 continue;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
294 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
295 SDL_MintAudio_AddFrequency(this,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
296 MASTERCLOCK_FALCON1 /
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
297 (MASTERPREDIV_FALCON * (i + 1)),
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
298 MASTERCLOCK_FALCON1, i, -1);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
299 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
300
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
301 #if 1
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
302 for (i = 0; i < MINTAUDIO_freqcount; i++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
303 DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
304 i, MINTAUDIO_frequencies[i].frequency,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
305 MINTAUDIO_frequencies[i].masterclock,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
306 MINTAUDIO_frequencies[i].predivisor));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
307 }
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
308 #endif
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
309
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
310 MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, this->spec.freq);
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
311 this->spec.freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
312
2043
adf732f1f016 Formatting update
Sam Lantinga <slouken@libsdl.org>
parents: 2027
diff changeset
313 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
314 SDL_AUDIO_BITSIZE(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
315 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
316 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
317 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
318 DEBUG_PRINT(("channels=%d, ", this->spec.channels));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
319 DEBUG_PRINT(("freq=%d\n", this->spec.freq));
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
320
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
321 return 0;
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
322 }
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
323
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
324 static void
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
325 MINTXBIOS_InitAudio(_THIS)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
326 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
327 int channels_mode, dmaclock, prediv;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
328 void *buffer;
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
329
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
330 /* Stop currently playing sound */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
331 SDL_MintAudio_quit_thread = SDL_FALSE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
332 SDL_MintAudio_thread_finished = SDL_TRUE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
333 SDL_MintAudio_WaitThread();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
334 Buffoper(0);
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
335
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
336 /* Set replay tracks */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
337 Settracks(0, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
338 Setmontracks(0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
339
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
340 /* Select replay format */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
341 channels_mode = STEREO16;
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
342 switch (SDL_AUDIO_BITSIZE(this->spec.format)) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
343 case 8:
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
344 if (this->spec.channels == 2) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
345 channels_mode = STEREO8;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
346 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
347 channels_mode = MONO8;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
348 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
349 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
350 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
351 if (Setmode(channels_mode) < 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
352 DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
353 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
354
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
355 dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
356 prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
357 if (MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits != -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
358 Gpio(GPIO_SET, 7); /* DSP port gpio outputs */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
359 Gpio(GPIO_WRITE, MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
360 Devconnect2(DMAPLAY, DAC | EXTOUT, CLKEXT, prediv);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
361 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
362 Devconnect2(DMAPLAY, DAC, CLK25M, prediv);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
363 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
364
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
365 /* Set buffer */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
366 buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
367 if (Setbuffer(0, buffer, buffer + this->spec.size) < 0) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
368 DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
369 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
370
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
371 if (SDL_MintAudio_mint_present) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
372 SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
373 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
374 /* Install interrupt */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
375 Jdisint(MFP_DMASOUND);
2043
adf732f1f016 Formatting update
Sam Lantinga <slouken@libsdl.org>
parents: 2027
diff changeset
376 /*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt); */
2022
649e9ac39f74 Disable MiNT thread usage and use hw access for updating DMA audio pointers
Patrice Mandin <patmandin@gmail.com>
parents: 2005
diff changeset
377 Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
378 Jenabint(MFP_DMASOUND);
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
379
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
380 if (Setinterrupt(SI_TIMERA, SI_PLAY) < 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
381 DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
382 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
383 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
384
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
385 /* Go */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
386 Buffoper(SB_PLA_ENA | SB_PLA_RPT);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
387 DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
388 }
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
389
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
390 static int
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
391 MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
392 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
393 /* Lock sound system */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
394 if (Locksnd() != 1) {
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
395 SDL_SetError("MINTXBIOS_OpenAudio: Audio system already in use");
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
396 return 0;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
397 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
398
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
399 SDL_MintAudio_device = this;
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
400
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
401 /* Check audio capabilities */
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
402 if (MINTXBIOS_CheckAudio(this) == -1) {
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
403 return 0;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
404 }
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
405
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
406 /* Initialize all variables that we clean on shutdown */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
407 this->hidden = (struct SDL_PrivateAudioData *)
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
408 SDL_malloc((sizeof *this->hidden));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
409 if (this->hidden == NULL) {
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
410 SDL_OutOfMemory();
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
411 return 0;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
412 }
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
413 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
414
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
415 SDL_CalculateAudioSpec(&this->spec);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
416
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
417 /* Allocate memory for audio buffers in DMA-able RAM */
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
418 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
419
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
420 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
421 if (SDL_MintAudio_audiobuf[0] == NULL) {
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
422 SDL_free(this->hidden);
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
423 this->hidden = NULL;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
424 SDL_OutOfMemory();
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
425 return 0;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
426 }
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
427 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
428 SDL_MintAudio_numbuf = 0;
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
429 SDL_memset(SDL_MintAudio_audiobuf[0],this->spec.silence,this->spec.size*2);
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
430 SDL_MintAudio_audiosize = this->spec.size;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
431 SDL_MintAudio_mutex = 0;
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
432
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
433 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
434 SDL_MintAudio_audiobuf[0]));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
435 DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
436 SDL_MintAudio_audiobuf[1]));
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
437
2027
d48ead2d2ba5 Save/restore FPU registers in interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 2022
diff changeset
438 SDL_MintAudio_CheckFpu();
d48ead2d2ba5 Save/restore FPU registers in interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 2022
diff changeset
439
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
440 /* Setup audio hardware */
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
441 MINTXBIOS_InitAudio(this);
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
442
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
443 return 1; /* good to go. */
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
444 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
445
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
446 static int
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
447 MINTXBIOS_Init(SDL_AudioDriverImpl *impl)
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
448 {
3846
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
449 unsigned long dummy = 0;
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
450 /*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); */
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
451 SDL_MintAudio_mint_present = SDL_FALSE;
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
452
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
453 /* We can't use XBIOS in interrupt with Magic, don't know about thread */
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
454 if (Getcookie(C_MagX, &dummy) == C_FOUND) {
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
455 return (0);
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
456 }
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
457
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
458 /* Cookie _SND present ? if not, assume ST machine */
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
459 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
460 cookie_snd = SND_PSG;
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
461 }
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
462
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
463 /* Check if we have 16 bits audio */
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
464 if ((cookie_snd & SND_16BIT) == 0) {
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
465 SDL_SetError(DEBUG_NAME "no 16-bit sound");
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
466 return (0);
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
467 }
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
468
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
469 /* Check if audio is lockable */
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
470 if (Locksnd() != 1) {
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
471 SDL_SetError(DEBUG_NAME "audio locked by other application");
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
472 return (0);
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
473 }
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
474
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
475 Unlocksnd();
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
476
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
477 DEBUG_PRINT((DEBUG_NAME "XBIOS audio available!\n"));
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
478
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
479 /* Set the function pointers */
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
480 impl->OpenDevice = MINTXBIOS_OpenDevice;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
481 impl->CloseDevice = MINTXBIOS_CloseDevice;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
482 impl->LockAudio = MINTXBIOS_LockAudio;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
483 impl->UnlockAudio = MINTXBIOS_UnlockAudio;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
484 impl->OnlyHasDefaultOutputDevice = 1;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
485 impl->ProvidesOwnCallbackThread = 1;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
486 impl->SkipMixerLock = 1;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
487
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
488 return 1;
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
489 }
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
490
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
491 AudioBootStrap MINTAUDIO_XBIOS_bootstrap = {
3846
66fb40445587 Removed distinction between "available" and "init" in audio backends, since
Ryan C. Gordon <icculus@icculus.org>
parents: 3820
diff changeset
492 MINT_AUDIO_DRIVER_NAME, "MiNT XBIOS audio driver", MINTXBIOS_Init, 0
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
493 };
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
494
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1412
diff changeset
495 /* vi: set ts=4 sw=4 expandtab: */