2 AHI - Hardware independent audio subsystem
3 Copyright (C) 2017 The AROS Dev Team
4 Copyright (C) 1996-2005 Martin Blom <martin@blom.org>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with this library; if not, write to the
18 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
25 #include <exec/types.h>
31 /*** New Style Device definitions ***/
33 #define NSCMD_DEVICEQUERY 0x4000
35 #define NSDEVTYPE_UNKNOWN 0 /* No suitable category, anything */
36 #define NSDEVTYPE_GAMEPORT 1 /* like gameport.device */
37 #define NSDEVTYPE_TIMER 2 /* like timer.device */
38 #define NSDEVTYPE_KEYBOARD 3 /* like keyboard.device */
39 #define NSDEVTYPE_INPUT 4 /* like input.device */
40 #define NSDEVTYPE_TRACKDISK 5 /* like trackdisk.device */
41 #define NSDEVTYPE_CONSOLE 6 /* like console.device */
42 #define NSDEVTYPE_SANA2 7 /* A >=SANA2R2 networking device */
43 #define NSDEVTYPE_AUDIOARD 8 /* like audio.device */
44 #define NSDEVTYPE_CLIPBOARD 9 /* like clipboard.device */
45 #define NSDEVTYPE_PRINTER 10 /* like printer.device */
46 #define NSDEVTYPE_SERIAL 11 /* like serial.device */
47 #define NSDEVTYPE_PARALLEL 12 /* like parallel.device */
49 struct NSDeviceQueryResult
52 ** Standard information
54 ULONG DevQueryFormat
; /* this is type 0 */
55 ULONG SizeAvailable
; /* bytes available */
58 ** Common information (READ ONLY!)
60 UWORD DeviceType
; /* what the device does */
61 UWORD DeviceSubType
; /* depends on the main type */
62 UWORD
*SupportedCommands
; /* 0 terminated list of cmd's */
64 /* May be extended in the future! Check SizeAvailable! */
67 #define DRIVE_NEWSTYLE (0x4E535459L) /* 'NSTY' */
68 #define NSCMD_TD_READ64 0xc000
69 #define NSCMD_TD_WRITE64 0xc001
70 #define NSCMD_TD_SEEK64 0xc002
71 #define NSCMD_TD_FORMAT64 0xc003
74 /*** My own stuff ***/
76 #define AHI_PRI 50 /* Priority for the device process */
78 #define PLAYERFREQ 100 /* How often the PlayerFunc is called */
80 #define AHICMD_END CMD_NONSTD
82 #define AHICMD_WRITTEN (0x8000 | CMD_WRITE)
84 #define ahir_Extras ahir_Private[0]
85 #define GetExtras(req) ((struct Extras *) req->ahir_Private[0])
86 #define NOCHANNEL 65535
95 /* Voice->Flags definitions */
97 /* Set by the interrupt when a new sound has been started */
99 #define VF_STARTED (1<<0)
111 struct AHIRequest
*NextRequest
;
113 struct AHIRequest
*QueuedRequest
;
114 struct AHIRequest
*PlayingRequest
;
117 /* Special Offset values */
119 #define FREE -1 /* Channel is not playing anything */
120 #define MUTE -2 /* Channel will be muted when current sound is finished */
121 #define PLAY -3 /* Channel will play more when current sound is finished */
123 #define MAXSOUNDS 128
125 #define SOUND_IN_USE 1
134 struct Process
*Process
;
136 struct Process
*Master
;
137 struct Hook PlayerHook
;
138 struct Hook RecordHook
;
139 struct Hook SoundHook
;
140 struct Hook ChannelInfoHook
;
142 struct AHIEffChannelInfo
*ChannelInfoStruct
;
148 BOOL IsPlaying
; // Currently playing (or want to)
149 BOOL IsRecording
; // Currently recording
150 BOOL ValidRecord
; // The record buffer contains valid data
151 BOOL FullDuplex
; // Mode is full duplex
152 BOOL PseudoStereo
; // Mode is Paula-like stereo
153 UWORD StopCnt
; // CMD_STOP count
155 /* Lock is used to serialize access to StopCnt, ReadList, PlayingList,
156 SilentList, WaitingList and RequestQueue */
158 struct SignalSemaphore Lock
;
160 struct MinList ReadList
;
161 struct MinList PlayingList
;
162 struct MinList SilentList
;
163 struct MinList WaitingList
;
165 struct MinList RequestQueue
;
167 struct Voice
*Voices
;
169 struct AHIAudioCtrl
*AudioCtrl
;
180 UBYTE Sounds
[MAXSOUNDS
];
184 _DevOpen ( struct AHIRequest
* ioreq
,
187 struct AHIBase
* AHIBase
);
190 _DevClose ( struct AHIRequest
* ioreq
,
191 struct AHIBase
* AHIBase
);
194 ReadConfig ( struct AHIDevUnit
*iounit
,
195 struct AHIBase
*AHIBase
);
198 AllocHardware ( struct AHIDevUnit
*iounit
,
199 struct AHIBase
*AHIBase
);
202 FreeHardware ( struct AHIDevUnit
*iounit
,
203 struct AHIBase
*AHIBase
);
208 #endif /* ahi_device_h */