78 #define RVIEW_SND_LATENCY 100
80 #define RVIEW_SND_RELPERIOD 0.5
83 #define RVIEW_SND_BUFFERS 3
108 soundPlayer(
int frq,
int ch, FILE *fp, rviewSoundFormat fmt,
int lat=RVIEW_SND_LATENCY);
110 soundPlayer(
int frq,
int ch,
const signed char *data,
int len, rviewSoundFormat fmt=rsf_lin8,
int lat=RVIEW_SND_LATENCY);
112 soundPlayer(
int frq,
int ch,
const unsigned char *data,
int len, rviewSoundFormat fmt=rsf_ulaw8,
int lat=RVIEW_SND_LATENCY);
114 soundPlayer(
int frq,
int ch,
const short *data,
int len, rviewSoundFormat fmt=rsf_lin16,
int lat=RVIEW_SND_LATENCY);
119 int newSample(
int frq,
int ch, FILE *fp, rviewSoundFormat fmt,
int lat=RVIEW_SND_LATENCY);
120 int newSample(
int frq,
int ch,
const signed char *data,
int len, rviewSoundFormat=rsf_lin8,
int lat=RVIEW_SND_LATENCY);
121 int newSample(
int frq,
int ch,
const unsigned char *data,
int len, rviewSoundFormat=rsf_ulaw8,
int lat=RVIEW_SND_LATENCY);
122 int newSample(
int frq,
int ch,
const short *data,
int len, rviewSoundFormat=rsf_lin16,
int lat=RVIEW_SND_LATENCY);
124 int playbackGetOffset(
void);
125 int playbackActive(
void);
126 void playbackSuspend(
void);
127 void playbackResume(
void);
128 void playbackStop(
void);
129 int playbackSetPosition(
int position);
130 int playbackLoopMode(
int lpMode);
133 void writeSamples(DWORD systime);
135 void writeSamples(
void);
141 void setupVariables(
void);
142 const char *ensureSamplesForDevice(
const char *source,
int len);
143 const char *ensureSamples(
int &num);
144 int configureDevice(
int frq,
int ch,
int len, rviewSoundFormat fmt,
int lat);
145 void ensureUlawTable(
int ulawsize);
146 void ensureLinearTable(
void);
147 char *ensureConvBuff(
int size);
148 char *ensureSampleBuff(
int size);
150 int setTimerInterval(
unsigned int ti);
151 int startTimer(
int ap=1);
152 int stopTimer(
int ap=1);
153 int handleOutOfData(
int dataSize);
155 rviewSoundFormat format;
156 rviewSoundFormat devFormat;
157 int sampleSize, devSampSize;
159 int dataOffset, inLength;
160 int frequency, channels, latency, samplesWriteahead;
161 int buffSize, cbuffSize;
162 char *buffer, *convBuff;
164 unsigned char *LinToUlaw;
168 soundPlayer *suspendedPlayer;
174 void freeWaveHeaders(
void);
177 WAVEFORMATEX waveFmt;
178 WAVEHDR waveHdrs[RVIEW_SND_BUFFERS];
185 struct timeval lastSyncTime;
186 struct sigaction oact;
187 struct itimerval ovalue;
199 class rviewSoundPlayer:
public rviewDisplay
203 rviewSoundPlayer(mdd_frame *mf,
unsigned int flags=0);
204 ~rviewSoundPlayer(
void);
207 int process(wxObject &obj, wxEvent &evt);
208 virtual int openViewer(
void);
210 virtual const char *getFrameName(
void)
const;
211 virtual rviewFrameType getFrameType(
void)
const;
212 virtual int getViewerType(
void)
const;
214 void OnSize(
int w,
int h);
216 int newProjection(
void);
217 void prepareToDie(
void);
219 typedef struct format_desc
221 const char *labelName;
222 rviewSoundFormat fmt;
228 static const int sound_bwidth;
229 static const int sound_bheight;
231 static const int sound_sheight;
233 static const int sound_twidth;
234 static const int sound_theight;
236 static const int sound_cwidth;
237 static const int sound_cheight;
239 static const int sound_ctrly;
241 static const int sound_width;
242 static const int sound_height;
244 static const int sound_latencies;
249 int buildSample(
void);
251 int startPlayback(
void);
252 int stopPlayback(
void);
253 void setSlider(
int offset);
254 bool setLoopMode(
bool lm);
257 rviewButton *toStart, *toEnd;
258 rviewButton *pbPause, *pbStart, *pbStop, *pbLoop;
260 rviewText *frqWidget;
261 rviewChoice *fmtWidget, *latWidget;
262 int frequency, channels, latency;
273 unsigned int freeDims;
275 static const format_desc soundFormatDesc[];