Changeset 948
- Timestamp:
- 03/16/08 15:13:45 (13 years ago)
- Files:
-
- trunk/libffado/config.h.in (modified) (1 diff)
- trunk/libffado/SConstruct (modified) (2 diffs)
- trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.cpp (modified) (7 diffs)
- trunk/libffado/src/libutil/float_cast.h (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config.h.in
r939 r948 32 32 #define LIBDIR "$LIBDIR" 33 33 #define SHAREDIR "$SHAREDIR" 34 35 /* Define indicating availability of lrint() */ 36 #define HAVE_LRINT $HAVE_LRINT 37 38 /* Define indicatin availability of lrintf() */ 39 #define HAVE_LRINTF $HAVE_LRINTF 34 40 35 41 #define DEBUG_IMPLEMENT_BACKLOG 0 trunk/libffado/SConstruct
r947 r948 3 3 # Copyright (C) 2007 Arnold Krille 4 4 # Copyright (C) 2007 Pieter Palmers 5 # Copyright (C) 2008 Jonathan Woithe 5 6 # 6 7 # This file is part of FFADO … … 208 209 Exit( 1 ) 209 210 211 # Check for C99 lrint() and lrintf() functions used to convert from 212 # float to integer more efficiently via float_cast.h. If not 213 # present the standard slower methods will be used instead. This 214 # might not be the best way of testing for these but it's the only 215 # way which seems to work properly. CheckFunc() fails due to 216 # argument count problems. 217 oldcf = env['CFLAGS'] 218 oldcf = env.Append(CFLAGS = '-std=c99') 219 if conf.CheckLibWithHeader( "m", "math.h", "c", "lrint(3.2);" ): 220 HAVE_LRINT = 1 221 else: 222 HAVE_LRINT = 0 223 if conf.CheckLibWithHeader( "m", "math.h", "c", "lrintf(3.2);" ): 224 HAVE_LRINTF = 1 225 else: 226 HAVE_LRINTF = 0 227 env['HAVE_LRINT'] = HAVE_LRINT; 228 env['HAVE_LRINTF'] = HAVE_LRINTF; 229 env.Replace(CFLAGS=oldcf) 230 210 231 # 211 232 # Optional checks follow: trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.cpp
r928 r948 25 25 #include "config.h" 26 26 27 #include "libutil/float_cast.h" 28 27 29 #include "MotuTransmitStreamProcessor.h" 28 30 #include "MotuPort.h" … … 37 39 #include <assert.h> 38 40 39 // Set to 1 to enable the generation of a 1 kHz test tone in analog output 1 41 // Set to 1 to enable the generation of a 1 kHz test tone in analog output 1. Even with 42 // this defined to 1 the test tone will now only be produced if run with a non-zero 43 // debug level. 40 44 #define TESTTONE 1 41 45 … … 268 272 269 273 #if TESTTONE 274 /* Now things are beginning to stabilise, make things easier for others by only playing 275 * the test tone when run with a non-zero debug level. 276 */ 277 if (getDebugLevel() > 0) { 270 278 // FIXME: remove this hacked in 1 kHz test signal to 271 279 // analog-1 when testing is complete. 272 signed int i, int_tpf = (int)ticks_per_frame;280 signed int i, int_tpf = lrintf(ticks_per_frame); 273 281 unsigned char *sample = data+8+16; 274 282 for (i=0; i<n_events; i++, sample+=m_event_size) { … … 277 285 // network byte order). After byte order swap, the 24-bit 278 286 // MSB is in the second byte of val. 279 signed int val = htonl( (int)(0x7fffff*sin((1000.0*2.0*M_PI/24576000.0)*a_cx)));287 signed int val = htonl(lrintf(0x7fffff*sin((1000.0*2.0*M_PI/24576000.0)*a_cx))); 280 288 memcpy(sample,((char *)&val)+1,3); 281 289 if ((a_cx+=int_tpf) >= 24576000) { … … 283 291 } 284 292 } 293 } 285 294 #endif 286 295 287 296 // Set up each frames's SPH. 288 297 for (int i=0; i < n_events; i++, quadlet += dbs) { 289 //FIXME: not sure which is best for the MOTU. Should be consistent with generateSilentPacketData(). 290 // int64_t ts_frame = addTicks(ts, (unsigned int)(i * ticks_per_frame)); 291 int64_t ts_frame = addTicks(m_last_timestamp, (unsigned int)(i * ticks_per_frame)); 298 int64_t ts_frame = addTicks(m_last_timestamp, (unsigned int)lrintf(i * ticks_per_frame)); 292 299 *quadlet = htonl(fullTicksToSph(ts_frame)); 293 300 } … … 385 392 // Set up each frames's SPH. 386 393 for (int i=0; i < n_events; i++, quadlet += dbs) { 387 //FIXME: not sure which is best for the MOTU. Should be consistent with generatePacketData(). 388 // int64_t ts_frame = addTicks(ts, (unsigned int)(i * ticks_per_frame)); 389 int64_t ts_frame = addTicks(m_last_timestamp, (unsigned int)(i * ticks_per_frame)); 394 int64_t ts_frame = addTicks(m_last_timestamp, (unsigned int)lrintf(i * ticks_per_frame)); 390 395 *quadlet = htonl(fullTicksToSph(ts_frame)); 391 396 } … … 577 582 578 583 for(j = 0; j < nevents; j += 1) { // decode max nsamples 579 unsigned int v = (int)(*buffer * multiplier);584 unsigned int v = lrintf(*buffer * multiplier); 580 585 *target = (v >> 16) & 0xff; 581 586 *(target+1) = (v >> 8) & 0xff;