Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Device / device.h
blob5f952a8cf5d768848bf3a1b0e85c5e8b74dee6ca
1 /*
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,
18 MA 02139, USA.
21 #ifndef ahi_device_h
22 #define ahi_device_h
24 #include <exec/types.h>
25 #include <dos/dos.h>
27 struct AHIRequest;
28 struct AHIBase;
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
87 struct Extras
89 UWORD Channel;
90 UWORD Sound;
91 Fixed VolumeScale;
94 /* Voice->Flags definitions */
96 /* Set by the interrupt when a new sound has been started */
97 #define VB_STARTED 0
98 #define VF_STARTED (1<<0)
100 struct Voice
102 UWORD NextSound;
103 UBYTE Flags;
104 UBYTE Pad;
105 Fixed NextVolume;
106 Fixed NextPan;
107 ULONG NextFrequency;
108 ULONG NextOffset;
109 ULONG NextLength;
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
123 #define SOUND_FREE 0
124 #define SOUND_IN_USE 1
126 struct AHIDevUnit
128 struct Unit Unit;
129 UBYTE UnitNum;
130 BYTE PlaySignal;
131 BYTE RecordSignal;
132 BYTE SampleSignal;
133 struct Process *Process;
134 BYTE SyncSignal;
135 struct Process *Master;
136 struct Hook PlayerHook;
137 struct Hook RecordHook;
138 struct Hook SoundHook;
139 struct Hook ChannelInfoHook;
141 struct AHIEffChannelInfo *ChannelInfoStruct;
143 WORD RecordOffDelay;
144 WORD *RecordBuffer;
145 ULONG RecordSize;
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;
169 ULONG AudioMode;
170 ULONG Frequency;
171 UWORD Channels;
172 UWORD Pad;
173 Fixed MonitorVolume;
174 Fixed InputGain;
175 Fixed OutputVolume;
176 ULONG Input;
177 ULONG Output;
179 UBYTE Sounds[MAXSOUNDS];
182 ULONG
183 _DevOpen ( struct AHIRequest* ioreq,
184 ULONG unit,
185 ULONG flags,
186 struct AHIBase* AHIBase );
188 BPTR
189 _DevClose ( struct AHIRequest* ioreq,
190 struct AHIBase* AHIBase );
192 BOOL
193 ReadConfig ( struct AHIDevUnit *iounit,
194 struct AHIBase *AHIBase );
196 BOOL
197 AllocHardware ( struct AHIDevUnit *iounit,
198 struct AHIBase *AHIBase );
200 void
201 FreeHardware ( struct AHIDevUnit *iounit,
202 struct AHIBase *AHIBase );
204 void
205 DevProc( void );
207 #endif /* ahi_device_h */