author | llornkcor <llornkcor> | 2004-04-25 20:37:28 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-25 20:37:28 (UTC) |
commit | ae76c412a340a0808ed6ece5e4a8fbc04baa4ff3 (patch) (side-by-side diff) | |
tree | a086457c05142e1ac2749844ffcb458d96550c6f | |
parent | 22d51bcaa58b90a3ffd4d429c43e6c24e1694ab3 (diff) | |
download | opie-ae76c412a340a0808ed6ece5e4a8fbc04baa4ff3.zip opie-ae76c412a340a0808ed6ece5e4a8fbc04baa4ff3.tar.gz opie-ae76c412a340a0808ed6ece5e4a8fbc04baa4ff3.tar.bz2 |
soundcard descriptor mucking about
-rw-r--r-- | noncore/multimedia/opierec/device.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp index 5319d97..db2d63f 100644 --- a/noncore/multimedia/opierec/device.cpp +++ b/noncore/multimedia/opierec/device.cpp @@ -220,139 +220,139 @@ bool Device::closeDevice( bool) { // if(b) {//close now // if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) { // perror("ioctl(\"SNDCTL_DSP_RESET\")"); // } // } else { //let play // if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) { // perror("ioctl(\"SNDCTL_DSP_SYNC\")"); // } // } ::close( sd); //close sound device // sdfd=0; // sd=0; // odebug << "closed dsp" << oendl; return true; } bool Device::setDeviceFormat( int form) { odebug << "set device res " << form << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); return false; } devRes=form; return true; } bool Device::setDeviceChannels( int ch) { odebug << "set channels " << ch << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); return false; } devCh=ch; return true; } bool Device::setDeviceRate( int rate) { odebug << "set rate " << rate << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { perror("ioctl(\"SNDCTL_DSP_SPEED\")"); return false; } devRate=rate; return true; } int Device::getRes() { return devRes; } int Device::getFormat() { return devForm; } int Device::getRate() { return devRate; } int Device::getChannels() { return devCh; } int Device::getDeviceFormat() { return 0; } int Device::getDeviceRate() { int dRate=0; if (ioctl( sd, SOUND_PCM_READ_RATE, &dRate) == -1) { perror("ioctl(\"SNDCTL_PCM_READ_RATE\")"); } return dRate; } int Device::getDeviceBits() { int dBits=0; #ifndef QT_QWS_EBX // zaurus doesnt have this if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) { perror("ioctl(\"SNDCTL_PCM_READ_BITS\")"); } #endif return dBits; } int Device::getDeviceChannels() { int dCh=0; if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) { perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")"); } return dCh; } int Device::getDeviceFragSize() { int frag_size; if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { odebug << "no fragsize" << oendl; } else { odebug << "driver says frag size is " << frag_size << "" << oendl; } return frag_size; } bool Device::setFragSize(int frag) { if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) { perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); return false; } return true; } bool Device::reset() { closeDevice(true); openDsp(); if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) { perror("ioctl(\"SNDCTL_DSP_RESET\")"); return false; } return true; } int Device::devRead(int soundDescriptor, short *buf, int size) { int number = 0; - number = ::read( soundDescriptor, (char *)buf, size); + number = ::read( sd /*soundDescriptor*/, (char *)buf, size); return number; } int Device::devWrite(int soundDescriptor, short * buf, int size) { int bytesWritten = 0; - bytesWritten = ::write( soundDescriptor, buf, size); + bytesWritten = ::write( sd /*soundDescriptor*/, buf, size); return bytesWritten; } |