[Sumover-dev] [svn commit] r3983 - rat/trunk

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Mon Apr 16 00:10:56 BST 2007


Author: piers
Date: Mon Apr 16 00:11:22 2007
New Revision: 3983

Modified:
   rat/trunk/auddev_macosx.c

Log:
Minor updates 
- Fixed for use on Intel Macs - there was a BigEdian(PPC) assumption....
- Limit displayed range of available capabilities Audio device - for now - to its current restrictions of 8KHz Mono - it needs fixing for higher sample rates and Stereo.
- Added "OSX" to Sound Device name


Modified: rat/trunk/auddev_macosx.c
==============================================================================
--- rat/trunk/auddev_macosx.c	(original)
+++ rat/trunk/auddev_macosx.c	Mon Apr 16 00:11:22 2007
@@ -378,8 +378,13 @@
 	// so that's 160 bytes. Mash uses 8-bit mu-law internally, so we need to convert
 	// to 16-bit linear before using the audio data.
 	devices[ad].mashStreamBasicDescription_.mSampleRate = 8000.0;
+	//devices[ad].mashStreamBasicDescription_.mSampleRate = ifmt->sample_rate;
 	devices[ad].mashStreamBasicDescription_.mFormatID = kAudioFormatLinearPCM;
+#ifdef WORDS_BIGENDIAN
 	devices[ad].mashStreamBasicDescription_.mFormatFlags =kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsBigEndian |kLinearPCMFormatFlagIsPacked;
+#else
+	devices[ad].mashStreamBasicDescription_.mFormatFlags =kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
+#endif
 	devices[ad].mashStreamBasicDescription_.mBytesPerPacket = 2;
 	devices[ad].mashStreamBasicDescription_.mFramesPerPacket = 1;
 	devices[ad].mashStreamBasicDescription_.mBytesPerFrame = 2;
@@ -711,7 +716,7 @@
 int  macosx_audio_supports(audio_desc_t ad, audio_format *fmt)
 {
 	UNUSED(ad);
-	if (fmt->encoding != DEV_S16) {
+	if (fmt->encoding != DEV_S16 || fmt->channels != 1 || fmt->sample_rate != 8000 ) {
 		return 0;
 	}
 	return 1;
@@ -748,7 +753,7 @@
     UInt32 s = sizeof(char)*128;
     AudioDeviceGetProperty( theDevice, 0, 0, kAudioDevicePropertyDeviceName, &s, name);
     */
-    name = "Default Sound Device";
+    name = "Default OSX Sound Device";
     return name;
 };
 



More information about the Sumover-dev mailing list