2 AHI - Hardware independent audio subsystem
3 Copyright (C) 1996-2005 Martin Blom <martin@blom.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
24 #include <exec/types.h>
30 /*** New Style Device definitions ***/
32 #define NSCMD_DEVICEQUERY 0x4000
34 #define NSDEVTYPE_UNKNOWN 0 /* No suitable category, anything */
35 #define NSDEVTYPE_GAMEPORT 1 /* like gameport.device */
36 #define NSDEVTYPE_TIMER 2 /* like timer.device */
37 #define NSDEVTYPE_KEYBOARD 3 /* like keyboard.device */
38 #define NSDEVTYPE_INPUT 4 /* like input.device */
39 #define NSDEVTYPE_TRACKDISK 5 /* like trackdisk.device */
40 #define NSDEVTYPE_CONSOLE 6 /* like console.device */
41 #define NSDEVTYPE_SANA2 7 /* A >=SANA2R2 networking device */
42 #define NSDEVTYPE_AUDIOARD 8 /* like audio.device */
43 #define NSDEVTYPE_CLIPBOARD 9 /* like clipboard.device */
44 #define NSDEVTYPE_PRINTER 10 /* like printer.device */
45 #define NSDEVTYPE_SERIAL 11 /* like serial.device */
46 #define NSDEVTYPE_PARALLEL 12 /* like parallel.device */
48 struct NSDeviceQueryResult
51 ** Standard information
53 ULONG DevQueryFormat
; /* this is type 0 */
54 ULONG SizeAvailable
; /* bytes available */
57 ** Common information (READ ONLY!)
59 UWORD DeviceType
; /* what the device does */
60 UWORD DeviceSubType
; /* depends on the main type */
61 UWORD
*SupportedCommands
; /* 0 terminated list of cmd's */
63 /* May be extended in the future! Check SizeAvailable! */
66 #define DRIVE_NEWSTYLE (0x4E535459L) /* 'NSTY' */
67 #define NSCMD_TD_READ64 0xc000
68 #define NSCMD_TD_WRITE64 0xc001
69 #define NSCMD_TD_SEEK64 0xc002
70 #define NSCMD_TD_FORMAT64 0xc003
73 /*** My own stuff ***/
75 #define AHI_PRI 50 /* Priority for the device process */
77 #define PLAYERFREQ 100 /* How often the PlayerFunc is called */
79 #define AHICMD_END CMD_NONSTD
81 #define AHICMD_WRITTEN (0x8000 | CMD_WRITE)
83 #define ahir_Extras ahir_Private[0]
84 #define GetExtras(req) ((struct Extras *) req->ahir_Private[0])
85 #define NOCHANNEL 65535
94 /* Voice->Flags definitions */
96 /* Set by the interrupt when a new sound has been started */
98 #define VF_STARTED (1<<0)
110 struct AHIRequest
*NextRequest
;
112 struct AHIRequest
*QueuedRequest
;
113 struct AHIRequest
*PlayingRequest
;
116 /* Special Offset values */
118 #define FREE -1 /* Channel is not playing anything */
119 #define MUTE -2 /* Channel will be muted when current sound is finished */
120 #define PLAY -3 /* Channel will play more when current sound is finished */
122 #define MAXSOUNDS 128
124 #define SOUND_IN_USE 1
133 struct Process
*Process
;
135 struct Process
*Master
;
136 struct Hook PlayerHook
;
137 struct Hook RecordHook
;
138 struct Hook SoundHook
;
139 struct Hook ChannelInfoHook
;
141 struct AHIEffChannelInfo
*ChannelInfoStruct
;
147 BOOL IsPlaying
; // Currently playing (or want to)
148 BOOL IsRecording
; // Currently recording
149 BOOL ValidRecord
; // The record buffer contains valid data
150 BOOL FullDuplex
; // Mode is full duplex
151 BOOL PseudoStereo
; // Mode is Paula-like stereo
152 UWORD StopCnt
; // CMD_STOP count
154 /* Lock is used to serialize access to StopCnt, ReadList, PlayingList,
155 SilentList, WaitingList and RequestQueue */
157 struct SignalSemaphore Lock
;
159 struct MinList ReadList
;
160 struct MinList PlayingList
;
161 struct MinList SilentList
;
162 struct MinList WaitingList
;
164 struct MinList RequestQueue
;
166 struct Voice
*Voices
;
168 struct AHIAudioCtrl
*AudioCtrl
;
179 UBYTE Sounds
[MAXSOUNDS
];
183 _DevOpen ( struct AHIRequest
* ioreq
,
186 struct AHIBase
* AHIBase
);
189 _DevClose ( struct AHIRequest
* ioreq
,
190 struct AHIBase
* AHIBase
);
193 ReadConfig ( struct AHIDevUnit
*iounit
,
194 struct AHIBase
*AHIBase
);
197 AllocHardware ( struct AHIDevUnit
*iounit
,
198 struct AHIBase
*AHIBase
);
201 FreeHardware ( struct AHIDevUnit
*iounit
,
202 struct AHIBase
*AHIBase
);
207 #endif /* ahi_device_h */