1 //------------------------------------------------------------------------------
2 // EchoGals/Echo24 BeOS Driver for Echo audio cards
4 // Copyright (c) 2003, Jérôme Duval
6 // Permission is hereby granted, free of charge, to any person obtaining a
7 // copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following conditions:
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 // DEALINGS IN THE SOFTWARE.
28 #include <pcmcia/cb_enabler.h>
32 #include "OsSupportBeOS.h"
33 #include "CEchoGals.h"
34 #include "hmulti_audio.h"
38 #define AUTHOR "Jérôme Duval"
46 typedef struct _midi_dev
{
49 sem_id midi_ready_sem
;
50 ECHOGALS_MIDI_IN_CONTEXT context
;
53 #define ECHO_USE_PLAY (1 << 0)
54 #define ECHO_USE_RECORD (1 << 1)
55 #define ECHO_STATE_STARTED (1 << 0)
61 typedef struct _echo_stream
{
62 struct _echo_dev
*card
;
74 LIST_ENTRY(_echo_stream
) next
;
76 void (*inth
) (void *);
80 uint16 blksize
; /* in samples */
81 uint16 trigblk
; /* blk on which to trigger inth */
82 uint16 blkmod
; /* Modulo value to wrap trigblk */
85 volatile int64 frames_count
; // for play or record
86 volatile bigtime_t real_time
; // for play or record
87 volatile int32 buffer_cycle
; // for play or record
93 typedef struct _echo_dev
{
94 char name
[DEVNAME
]; /* used for resources */
109 phys_addr_t ptb_phy_base
;
112 sem_id buffer_ready_sem
;
114 LIST_HEAD(, _echo_stream
) streams
;
115 LIST_HEAD(, _echo_mem
) mems
;
117 echo_stream
*pstream
;
118 echo_stream
*rstream
;
126 bool plugged
; // Device plugged
127 bool opened
; // Device opened
129 LIST_ENTRY(_echo_dev
) next
;
133 extern int32 num_cards
;
135 LIST_HEAD(_echodevs
, _echo_dev
);
136 extern struct _echodevs devices
;
138 extern echo_dev cards
[NUM_CARDS
];
145 status_t
echo_stream_set_audioparms(echo_stream
*stream
, uint8 channels
,
146 uint8 bitsPerSample
, uint32 sample_ratei
, uint8 index
);
147 status_t
echo_stream_get_nth_buffer(echo_stream
*stream
, uint8 chan
, uint8 buf
,
148 char** buffer
, size_t *stride
);
149 void echo_stream_start(echo_stream
*stream
, void (*inth
) (void *), void *inthparam
);
150 void echo_stream_halt(echo_stream
*stream
);
151 echo_stream
*echo_stream_new(echo_dev
*card
, uint8 use
, uint32 bufframes
, uint8 bufcount
);
152 void echo_stream_delete(echo_stream
*stream
);
159 #endif /* _ECHO_H_ */