7 Copyright (c) 1997 by Be Incorporated. All Rights Reserved.
11 #ifndef _AUDIO_MODULE_H
12 #define _AUDIO_MODULE_H
16 #include "OldMediaModule.h"
17 #include "OldMediaDefs.h"
23 class BAudioEvent
: public BMediaEvent
{
25 BAudioEvent(int32 frames
, bool stereo
, float* samples
= NULL
);
28 virtual mk_time
Start();
29 virtual void SetStart(mk_time
);
30 virtual mk_time
Duration();
31 virtual int32
Frames();
32 virtual float* Samples();
33 virtual int32
ChannelCount();
35 virtual void SetGain(float);
36 virtual int32
Destination();
37 virtual void SetDestination(int32
);
38 virtual bool MixIn (float* dst
, int32 frames
, mk_time time
);
39 virtual BMediaEvent
* Clone();
40 virtual bigtime_t
CaptureTime();
41 virtual void SetCaptureTime(bigtime_t
);
49 bigtime_t fCaptureTime
;
55 class BDACRenderer
: public BMediaRenderer
{
57 BDACRenderer(const char* name
= NULL
);
64 BTimeBase
* TimeBase();
68 void TransportChanged(mk_time time
, mk_rate rate
,
69 transport_status status
);
72 virtual BMediaChannel
* Channel();
75 static bool _WriteDAC(void* arg
, char* buf
, uint32 bytes
, void* header
);
76 bool WriteDAC(short* buf
, int32 frames
, audio_buffer_header
* header
);
77 bool MixActiveSegments(mk_time start
);
78 void MixOutput(short* dst
);
80 BMediaChannel
* fChannel
;
81 BDACStream
* fDACStream
;
82 BSubscriber
* fSubscriber
;
85 BList fActiveSegments
;
89 BTimeBase fDACTimeBase
;
93 class BAudioFileStream
: public BEventStream
{
95 BAudioFileStream(BMediaChannel
* channel
, BFile
* file
,
96 mk_time start
= B_UNDEFINED_MK_TIME
);
99 BMediaEvent
* GetEvent(BMediaChannel
* channel
);
100 BMediaEvent
* PeekEvent(BMediaChannel
* channel
, mk_time asap
= 0);
101 status_t
SeekToTime(BMediaChannel
* channel
, mk_time time
);
102 void SetStart(mk_time start
);
104 virtual bigtime_t
CaptureTime();
105 virtual BMediaChannel
* Channel();
108 BMediaChannel
* fChannel
;
111 BAudioEvent
* fCurrentEvent
;
116 class BADCSource
: public BEventStream
{
118 BADCSource(BMediaChannel
* channel
, mk_time start
= 0);
121 BMediaEvent
* GetEvent(BMediaChannel
* channel
);
122 BMediaEvent
* PeekEvent(BMediaChannel
* channel
, mk_time asap
= 0);
123 status_t
SeekToTime(BMediaChannel
* channel
, mk_time time
);
124 void SetStart(mk_time start
);
126 virtual BMediaChannel
* Channel();
129 static bool _ReadADC(void* arg
, char* buf
, uint32 bytes
, void* header
);
130 void ReadADC(short* buf
, int32 frames
, audio_buffer_header
* header
);
132 BMediaChannel
* fChannel
;
135 BAudioEvent
* fCurrentEvent
;
136 BAudioEvent
* fNextEvent
;
138 BADCStream
* fADCStream
;
139 BSubscriber
* fSubscriber
;