cygwin: Remove comparisons of 'this' to 'NULL' in fhandler_dsp.cc
Fix all callers.
This commit is contained in:
parent
3a79700c2d
commit
47bbe23105
@ -63,7 +63,7 @@ class fhandler_dev_dsp::Audio
|
|||||||
void convert_S16LE_S16BE (unsigned char *buffer, int size_bytes);
|
void convert_S16LE_S16BE (unsigned char *buffer, int size_bytes);
|
||||||
void fillFormat (WAVEFORMATEX * format,
|
void fillFormat (WAVEFORMATEX * format,
|
||||||
int rate, int bits, int channels);
|
int rate, int bits, int channels);
|
||||||
unsigned blockSize (int rate, int bits, int channels);
|
static unsigned blockSize (int rate, int bits, int channels);
|
||||||
void (fhandler_dev_dsp::Audio::*convert_)
|
void (fhandler_dev_dsp::Audio::*convert_)
|
||||||
(unsigned char *buffer, int size_bytes);
|
(unsigned char *buffer, int size_bytes);
|
||||||
|
|
||||||
@ -115,6 +115,7 @@ class fhandler_dev_dsp::Audio_out: public Audio
|
|||||||
void stop (bool immediately = false);
|
void stop (bool immediately = false);
|
||||||
int write (const char *pSampleData, int nBytes);
|
int write (const char *pSampleData, int nBytes);
|
||||||
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
|
static void default_buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
void callback_sampledone (WAVEHDR *pHdr);
|
void callback_sampledone (WAVEHDR *pHdr);
|
||||||
bool parsewav (const char *&pData, int &nBytes,
|
bool parsewav (const char *&pData, int &nBytes,
|
||||||
int rate, int bits, int channels);
|
int rate, int bits, int channels);
|
||||||
@ -149,6 +150,7 @@ public:
|
|||||||
void stop ();
|
void stop ();
|
||||||
bool read (char *pSampleData, int &nBytes);
|
bool read (char *pSampleData, int &nBytes);
|
||||||
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
|
static void default_buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
void callback_blockfull (WAVEHDR *pHdr);
|
void callback_blockfull (WAVEHDR *pHdr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -499,11 +501,11 @@ void
|
|||||||
fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
|
fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
|
||||||
int rate, int bits, int channels)
|
int rate, int bits, int channels)
|
||||||
{
|
{
|
||||||
p->fragstotal = MAX_BLOCKS;
|
if (dev_)
|
||||||
if (this && dev_)
|
|
||||||
{
|
{
|
||||||
/* If the device is running we use the internal values,
|
/* If the device is running we use the internal values,
|
||||||
possibly set from the wave file. */
|
possibly set from the wave file. */
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
p->fragsize = blockSize (freq_, bits_, channels_);
|
p->fragsize = blockSize (freq_, bits_, channels_);
|
||||||
p->fragments = Qisr2app_->query ();
|
p->fragments = Qisr2app_->query ();
|
||||||
if (pHdr_ != NULL)
|
if (pHdr_ != NULL)
|
||||||
@ -514,10 +516,17 @@ fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
default_buf_info(p, rate, bits, channels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fhandler_dev_dsp::Audio_out::default_buf_info (audio_buf_info *p,
|
||||||
|
int rate, int bits, int channels)
|
||||||
|
{
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
p->fragsize = blockSize (rate, bits, channels);
|
p->fragsize = blockSize (rate, bits, channels);
|
||||||
p->fragments = MAX_BLOCKS;
|
p->fragments = MAX_BLOCKS;
|
||||||
p->bytes = p->fragsize * p->fragments;
|
p->bytes = p->fragsize * p->fragments;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is called on an interupt so use locking.. Note Qisr2app_
|
/* This is called on an interupt so use locking.. Note Qisr2app_
|
||||||
@ -951,14 +960,23 @@ fhandler_dev_dsp::Audio_in::waitfordata ()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fhandler_dev_dsp::Audio_in::default_buf_info (audio_buf_info *p,
|
||||||
|
int rate, int bits, int channels)
|
||||||
|
{
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
|
p->fragsize = blockSize (rate, bits, channels);
|
||||||
|
p->fragments = 0;
|
||||||
|
p->bytes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
|
fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
|
||||||
int rate, int bits, int channels)
|
int rate, int bits, int channels)
|
||||||
{
|
{
|
||||||
p->fragstotal = MAX_BLOCKS;
|
if (dev_)
|
||||||
p->fragsize = blockSize (rate, bits, channels);
|
|
||||||
if (this && dev_)
|
|
||||||
{
|
{
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
|
p->fragsize = blockSize (rate, bits, channels);
|
||||||
p->fragments = Qisr2app_->query ();
|
p->fragments = Qisr2app_->query ();
|
||||||
if (pHdr_ != NULL)
|
if (pHdr_ != NULL)
|
||||||
p->bytes = pHdr_->dwBytesRecorded - bufferIndex_
|
p->bytes = pHdr_->dwBytesRecorded - bufferIndex_
|
||||||
@ -968,8 +986,7 @@ fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->fragments = 0;
|
default_buf_info(p, rate, bits, channels);
|
||||||
p->bytes = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1343,9 +1360,13 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
audio_buf_info *p = (audio_buf_info *) buf;
|
audio_buf_info *p = (audio_buf_info *) buf;
|
||||||
audio_out_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
if (audio_out_) {
|
||||||
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
audio_out_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
||||||
buf, p->fragments, p->fragsize, p->bytes);
|
} else {
|
||||||
|
Audio_out::default_buf_info(p, audiofreq_, audiobits_, audiochannels_);
|
||||||
|
}
|
||||||
|
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
||||||
|
buf, p->fragments, p->fragsize, p->bytes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1357,9 +1378,13 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
audio_buf_info *p = (audio_buf_info *) buf;
|
audio_buf_info *p = (audio_buf_info *) buf;
|
||||||
audio_in_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
if (audio_in_) {
|
||||||
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
audio_in_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
||||||
buf, p->fragments, p->fragsize, p->bytes);
|
} else {
|
||||||
|
Audio_in::default_buf_info(p, audiofreq_, audiobits_, audiochannels_);
|
||||||
|
}
|
||||||
|
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
||||||
|
buf, p->fragments, p->fragsize, p->bytes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user