842 DS_Info* info;
843 void* buffer;
844
845 TRACE0("> DAUDIO_Open\n");
846
847 /* some sanity checks */
848 if (deviceID >= g_cacheCount) {
849 ERROR1("DAUDIO_Open: ERROR: cannot open the device with deviceID=%d!\n", deviceID);
850 return NULL;
851 }
852 if ((g_audioDeviceCache[deviceID].isSource && !isSource)
853 || (!g_audioDeviceCache[deviceID].isSource && isSource)) {
854 /* only support Playback or Capture */
855 ERROR0("DAUDIO_Open: ERROR: Cache is corrupt: cannot open the device in specified isSource mode!\n");
856 return NULL;
857 }
858 if (encoding != DAUDIO_PCM) {
859 ERROR1("DAUDIO_Open: ERROR: cannot open the device with encoding=%d!\n", encoding);
860 return NULL;
861 }
862 if (sampleSizeInBits > 8 &&
863 #ifdef _LITTLE_ENDIAN
864 isBigEndian
865 #else
866 !isBigEndian
867 #endif
868 ) {
869 ERROR1("DAUDIO_Open: ERROR: wrong endianness: isBigEndian==%d!\n", isBigEndian);
870 return NULL;
871 }
872 if (sampleSizeInBits == 8 && isSigned) {
873 ERROR0("DAUDIO_Open: ERROR: wrong signed'ness: with 8 bits, data must be unsigned!\n");
874 return NULL;
875 }
876 if (!DS_StartBufferHelper::isInitialized()) {
877 ERROR0("DAUDIO_Open: ERROR: StartBufferHelper initialization was failed!\n");
878 return NULL;
879 }
880
881 info = (DS_Info*) malloc(sizeof(DS_Info));
|
842 DS_Info* info;
843 void* buffer;
844
845 TRACE0("> DAUDIO_Open\n");
846
847 /* some sanity checks */
848 if (deviceID >= g_cacheCount) {
849 ERROR1("DAUDIO_Open: ERROR: cannot open the device with deviceID=%d!\n", deviceID);
850 return NULL;
851 }
852 if ((g_audioDeviceCache[deviceID].isSource && !isSource)
853 || (!g_audioDeviceCache[deviceID].isSource && isSource)) {
854 /* only support Playback or Capture */
855 ERROR0("DAUDIO_Open: ERROR: Cache is corrupt: cannot open the device in specified isSource mode!\n");
856 return NULL;
857 }
858 if (encoding != DAUDIO_PCM) {
859 ERROR1("DAUDIO_Open: ERROR: cannot open the device with encoding=%d!\n", encoding);
860 return NULL;
861 }
862 if (channels <= 0) {
863 ERROR1("DAUDIO_Open: ERROR: Invalid number of channels=%d!\n", channels);
864 return NULL;
865 }
866 if (sampleSizeInBits > 8 &&
867 #ifdef _LITTLE_ENDIAN
868 isBigEndian
869 #else
870 !isBigEndian
871 #endif
872 ) {
873 ERROR1("DAUDIO_Open: ERROR: wrong endianness: isBigEndian==%d!\n", isBigEndian);
874 return NULL;
875 }
876 if (sampleSizeInBits == 8 && isSigned) {
877 ERROR0("DAUDIO_Open: ERROR: wrong signed'ness: with 8 bits, data must be unsigned!\n");
878 return NULL;
879 }
880 if (!DS_StartBufferHelper::isInitialized()) {
881 ERROR0("DAUDIO_Open: ERROR: StartBufferHelper initialization was failed!\n");
882 return NULL;
883 }
884
885 info = (DS_Info*) malloc(sizeof(DS_Info));
|