Changeset 272

Show
Ignore:
Timestamp:
06/22/06 17:09:24 (16 years ago)
Author:
jwoithe
Message:

Silence some compiler warnings in teststreaming.c and teststreaming2.c.
Work towards getting iso receive working for the MOTU devices.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.cpp

    r269 r272  
    88 * 
    99 *   Copyright (C) 2005,2006 Pieter Palmers <pieterpalmers@users.sourceforge.net> 
    10  *   Copyright (C) 2005,2006 Pieter Palmers <pieterpalmers@users.sourceforge.net
     10 *   Copyright (C) 2006 Jonathan Woithe <jwoithe@physics.adelaide.edu.au
    1111 * 
    1212 *   This program is free software {} you can redistribute it and/or modify 
     
    4545 
    4646/* transmit */ 
    47 MotuTransmitStreamProcessor::MotuTransmitStreamProcessor(int port, int framerate) 
    48         : TransmitStreamProcessor(port, framerate),m_dimension(0) { 
    49  
     47MotuTransmitStreamProcessor::MotuTransmitStreamProcessor(int port, int framerate, 
     48               unsigned int event_size) 
     49        : TransmitStreamProcessor(port, framerate), m_event_size(event_size) { 
    5050 
    5151} 
     
    5353MotuTransmitStreamProcessor::~MotuTransmitStreamProcessor() { 
    5454        freebob_ringbuffer_free(m_event_buffer); 
    55         free(m_cluster_buffer); 
     55        free(m_tmp_event_buffer); 
    5656} 
    5757 
     
    107107*tag = 0; 
    108108*sy = 0; 
     109freebob_ringbuffer_read_advance(m_event_buffer, 6*m_event_size); 
     110incrementFrameCounter(6); 
    109111return RAW1394_ISO_OK; 
    110112         
     
    116118    // note: an 'event' is one sample from all channels + possibly other midi and control data 
    117119    int nevents=0; // TODO: determine 
    118         unsigned int read_size=nevents*m_dimension*sizeof(quadlet_t); // assumes each channel takes one quadlet 
     120        unsigned int read_size=nevents*m_event_size; 
    119121 
    120122    // we read the packet data from a ringbuffer, because of efficiency 
     
    232234        m_PacketStat.setName("XMT PACKET"); 
    233235        m_WakeupStat.setName("XMT WAKEUP"); 
     236 
     237    debugOutput( DEBUG_LEVEL_VERBOSE, "Event size: %d\n", m_event_size); 
    234238     
    235239    // allocate the event buffer 
     
    237241     
    238242    if( !(m_event_buffer=freebob_ringbuffer_create( 
    239             (m_dimension * ringbuffer_size_frames) * sizeof(quadlet_t)))) { 
    240         debugFatal("Could not allocate memory event ringbuffer"); 
     243       m_event_size * ringbuffer_size_frames))) { 
     244               debugFatal("Could not allocate memory event ringbuffer"); 
    241245        return false; 
    242246    } 
    243247 
    244     // allocate the temporary cluster buffer 
     248    // allocate the temporary event buffer 
    245249    // this is needed for the efficient transfer() routine 
    246     // it's size has to be equal to one 'event' 
    247     if( !(m_cluster_buffer=(char *)calloc(m_dimension,sizeof(quadlet_t)))) { 
    248         debugFatal("Could not allocate temporary cluster buffer"); 
     250    // its size has to be equal to one 'event' 
     251    if( !(m_tmp_event_buffer=(char *)calloc(1,m_event_size))) { 
     252        debugFatal("Could not allocate temporary event buffer"); 
    249253        freebob_ringbuffer_free(m_event_buffer); 
    250254        return false; 
     
    319323     
    320324    // this function should tranfer 'size' frames of 'silence' to the event buffer 
    321     unsigned int write_size=size*sizeof(quadlet_t)*m_dimension
    322     char *dummybuffer=(char *)calloc(sizeof(quadlet_t),size*m_dimension); 
     325    unsigned int write_size=size*m_event_size
     326    char *dummybuffer=(char *)calloc(size,m_event_size); 
    323327 
    324328    transmitSilenceBlock(dummybuffer, size, 0); 
     
    334338 
    335339bool MotuTransmitStreamProcessor::transfer() { 
    336     m_PeriodStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/(4*m_dimension)); 
     340    m_PeriodStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/m_event_size); 
    337341 
    338342    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Transferring period...\n"); 
     
    340344/* a naive implementation would look like this: 
    341345 
    342     unsigned int write_size=m_period*sizeof(quadlet_t)*m_dimension
    343     char *dummybuffer=(char *)calloc(sizeof(quadlet_t),m_period*m_dimension); 
     346    unsigned int write_size=m_period*m_event_size
     347    char *dummybuffer=(char *)calloc(m_period,m_event_size); 
    344348     
    345349    transmitBlock(dummybuffer, m_period, 0, 0); 
     
    361365    freebob_ringbuffer_data_t vec[2]; 
    362366    // we received one period of frames 
    363     // this is period_size*dimension of events 
    364     unsigned int events2write=m_period*m_dimension; 
    365     unsigned int bytes2write=events2write*sizeof(quadlet_t); 
     367    // this is period_size*m_event_size of events 
     368    unsigned int bytes2write=m_period*m_event_size; 
    366369 
    367370    /* write events2write bytes to the ringbuffer  
    368371    *  first see if it can be done in one read. 
    369372    *  if so, ok.  
    370     *  otherwise write up to a multiple of clusters directly to the buffer 
     373    *  otherwise write up to a multiple of events directly to the buffer 
    371374    *  then do the buffer wrap around using ringbuffer_write 
    372375    *  then write the remaining data directly to the buffer in a third pass  
    373376    *  Make sure that we cannot end up on a non-cluster aligned position! 
    374377    */ 
    375     unsigned int cluster_size=m_dimension*sizeof(quadlet_t); 
    376  
    377378    while(bytes2write>0) { 
    378379        int byteswritten=0; 
    379380         
    380         unsigned int frameswritten=(m_period*cluster_size-bytes2write)/cluster_size; 
     381        unsigned int frameswritten=(m_period*m_event_size-bytes2write)/m_event_size; 
    381382        offset=frameswritten; 
    382383         
     
    389390             
    390391        /* if we don't take care we will get stuck in an infinite loop 
    391         * because we align to a cluster boundary later 
     392        * because we align to a event boundary later 
    392393        * the remaining nb of bytes in one write operation can be  
    393         * smaller than one cluster 
     394        * smaller than one event 
    394395        * this can happen because the ringbuffer size is always a power of 2 
    395396        */ 
    396         if(vec[0].len<cluster_size) { 
     397        if(vec[0].len<m_event_size) { 
    397398             
    398399            // encode to the temporary buffer 
    399             xrun = transmitBlock(m_cluster_buffer, 1, offset); 
     400            xrun = transmitBlock(m_tmp_event_buffer, 1, offset); 
    400401             
    401402            if(xrun<0) { 
     
    405406            } 
    406407                 
    407             // use the ringbuffer function to write one cluster  
     408            // use the ringbuffer function to write one event  
    408409            // the write function handles the wrap around. 
    409410            freebob_ringbuffer_write(m_event_buffer, 
    410                          m_cluster_buffer, 
    411                          cluster_size); 
     411                         m_tmp_event_buffer, 
     412                         m_event_size); 
    412413                 
    413             // we advanced one cluster_size 
    414             bytes2write-=cluster_size; 
     414            // we advanced one m_event_size 
     415            bytes2write-=m_event_size; 
    415416                 
    416417        } else { //  
    417418             
    418419            if(bytes2write>vec[0].len) { 
    419                 // align to a cluster boundary 
    420                 byteswritten=vec[0].len-(vec[0].len%cluster_size); 
     420                // align to an event boundary 
     421                byteswritten=vec[0].len-(vec[0].len%m_event_size); 
    421422            } else { 
    422423                byteswritten=bytes2write; 
     
    424425                 
    425426            xrun = transmitBlock(vec[0].buf, 
    426                          byteswritten/cluster_size, 
     427                         byteswritten/m_event_size, 
    427428                         offset); 
    428429             
     
    437438        } 
    438439 
    439         // the bytes2write should always be cluster aligned 
    440         assert(bytes2write%cluster_size==0); 
     440        // the bytes2write should always be event aligned 
     441        assert(bytes2write%m_event_size==0); 
    441442 
    442443    } 
     
    656657/* --------------------- RECEIVE ----------------------- */ 
    657658 
    658 MotuReceiveStreamProcessor::MotuReceiveStreamProcessor(int port, int framerate) 
    659     : ReceiveStreamProcessor(port, framerate), m_dimension(0) { 
    660  
     659MotuReceiveStreamProcessor::MotuReceiveStreamProcessor(int port, int framerate,  
     660        unsigned int event_size) 
     661    : ReceiveStreamProcessor(port, framerate), m_event_size(event_size) { 
    661662 
    662663} 
     
    664665MotuReceiveStreamProcessor::~MotuReceiveStreamProcessor() { 
    665666    freebob_ringbuffer_free(m_event_buffer); 
    666     free(m_cluster_buffer); 
     667    free(m_tmp_event_buffer); 
    667668 
    668669} 
     
    812813    // setup any specific stuff here 
    813814 
     815        debugOutput( DEBUG_LEVEL_VERBOSE, "Event size: %d\n", m_event_size); 
     816     
    814817        // allocate the event buffer 
    815818        unsigned int ringbuffer_size_frames=m_nb_buffers * m_period; 
    816819 
    817820        if( !(m_event_buffer=freebob_ringbuffer_create( 
    818                 (m_dimension * ringbuffer_size_frames) * sizeof(quadlet_t)))) { 
     821                       m_event_size * ringbuffer_size_frames))) { 
    819822                debugFatal("Could not allocate memory event ringbuffer"); 
    820823                return false; 
    821824        } 
    822825 
    823         // allocate the temporary cluster buffer 
    824         if( !(m_cluster_buffer=(char *)calloc(m_dimension,sizeof(quadlet_t)))) { 
    825                 debugFatal("Could not allocate temporary cluster buffer"); 
     826        // allocate the temporary event buffer 
     827        if( !(m_tmp_event_buffer=(char *)calloc(1,m_event_size))) { 
     828                debugFatal("Could not allocate temporary event buffer"); 
    826829                freebob_ringbuffer_free(m_event_buffer); 
    827830                return false; 
     
    868871        } 
    869872 
    870     // the API specific settings of the ports are already set before 
    871     // this routine is called, therefore we can init&prepare the ports 
     873       // The API specific settings of the ports are already set before 
     874       // this routine is called, therefore we can init&prepare the ports 
    872875        if(!initPorts()) { 
    873876                debugFatal("Could not initialize ports!\n"); 
     
    891894         
    892895/* another naive section:        
    893         unsigned int read_size=m_period*sizeof(quadlet_t)*m_dimension
    894         char *dummybuffer=(char *)calloc(sizeof(quadlet_t),m_period*m_dimension); 
     896        unsigned int read_size=m_period*m_event_size
     897        char *dummybuffer=(char *)calloc(m_period,m_event_size); 
    895898        if (freebob_ringbuffer_read(m_event_buffer,(char *)(dummybuffer),read_size) < read_size) { 
    896899                debugWarning("Could not read from event buffer\n"); 
     
    905908         
    906909        freebob_ringbuffer_data_t vec[2]; 
    907         // we received one period of frames on each connection 
    908         // this is period_size*dimension of events 
    909  
    910         unsigned int events2read=m_period*m_dimension; 
    911         unsigned int bytes2read=events2read*sizeof(quadlet_t); 
     910        // We received one period of frames from each channel. 
     911        // This is period_size*m_event_size bytes. 
     912        unsigned int bytes2read = m_period * m_event_size; 
    912913 
    913914// FIXME: remove once the stuff below has been tweaked for the MOTU 
    914 return true; 
    915  
    916         /* read events2read bytes from the ringbuffer  
    917         *  first see if it can be done in one read.  
    918         *  if so, ok.  
    919         *  otherwise read up to a multiple of clusters directly from the buffer 
     915//return true; 
     916 
     917        /* Read events2read bytes from the ringbuffer. 
     918        *  First see if it can be done in one read.  If so, ok. 
     919        *  Otherwise read up to a multiple of events directly from the buffer 
    920920        *  then do the buffer wrap around using ringbuffer_read 
    921921        *  then read the remaining data directly from the buffer in a third pass  
    922         *  Make sure that we cannot end up on a non-cluster aligned position! 
     922        *  Make sure that we cannot end up on a non-event aligned position! 
    923923        */ 
    924         unsigned int cluster_size=m_dimension*sizeof(quadlet_t); 
    925          
    926924        while(bytes2read>0) { 
    927                 unsigned int framesread=(m_period*cluster_size-bytes2read)/cluster_size; 
     925                unsigned int framesread=(m_period*m_event_size-bytes2read)/m_event_size; 
    928926                offset=framesread; 
    929927                 
     
    938936                         
    939937                /* if we don't take care we will get stuck in an infinite loop 
    940                 * because we align to a cluster boundary later 
    941                 * the remaining nb of bytes in one read operation can be smaller than one cluster 
     938                * because we align to an event boundary later 
     939                * the remaining nb of bytes in one read operation can be smaller than one event 
    942940                * this can happen because the ringbuffer size is always a power of 2 
    943941                        */ 
    944                 if(vec[0].len<cluster_size) { 
    945                         // use the ringbuffer function to read one cluster  
     942                if(vec[0].len<m_event_size) { 
     943                        // use the ringbuffer function to read one event  
    946944                        // the read function handles wrap around 
    947                         freebob_ringbuffer_read(m_event_buffer,m_cluster_buffer,cluster_size); 
    948  
    949                         xrun = receiveBlock(m_cluster_buffer, 1, offset); 
     945                        freebob_ringbuffer_read(m_event_buffer,m_tmp_event_buffer,m_event_size); 
     946 
     947                        xrun = receiveBlock(m_tmp_event_buffer, 1, offset); 
    950948                                 
    951949                        if(xrun<0) { 
     
    955953                        } 
    956954                                 
    957                                // we advanced one cluster_size 
    958                         bytes2read-=cluster_size; 
     955                        // We advanced one m_event_size 
     956                        bytes2read-=m_event_size; 
    959957                                 
    960958                } else { //  
    961959                         
    962960                        if(bytes2read>vec[0].len) { 
    963                                         // align to a cluster boundary 
    964                                 bytesread=vec[0].len-(vec[0].len%cluster_size); 
     961                                        // align to an event boundary 
     962                                bytesread=vec[0].len-(vec[0].len%m_event_size); 
    965963                        } else { 
    966964                                bytesread=bytes2read; 
    967965                        } 
    968966                                 
    969                         xrun = receiveBlock(vec[0].buf, bytesread/cluster_size, offset); 
     967                        xrun = receiveBlock(vec[0].buf, bytesread/m_event_size, offset); 
    970968                                 
    971969                        if(xrun<0) { 
     
    979977                } 
    980978                         
    981                 // the bytes2read should always be cluster aligned 
    982                 assert(bytes2read%cluster_size==0); 
     979                // the bytes2read should always be event aligned 
     980                assert(bytes2read%m_event_size==0); 
    983981        } 
    984982 
     
    11261124} 
    11271125*/ 
     1126 
     1127signed int MotuReceiveStreamProcessor::setEventSize(unsigned int size) { 
     1128        m_event_size = size; 
     1129        return 0; 
     1130} 
     1131 
     1132unsigned int MotuReceiveStreamProcessor::getEventSize(void) { 
     1133// 
     1134// Return the size of a single event sent by the MOTU as part of an iso 
     1135// data packet in bytes. 
     1136// 
     1137        return m_event_size; 
     1138} 
     1139                 
    11281140} // end of namespace FreebobStreaming 
  • branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.h

    r269 r272  
    4444public: 
    4545         
    46         MotuTransmitStreamProcessor(int port, int framerate); 
     46        MotuTransmitStreamProcessor(int port, int framerate,  
     47                unsigned int event_size); 
    4748 
    4849        virtual ~MotuTransmitStreamProcessor(); 
     
    7071 
    7172        freebob_ringbuffer_t * m_event_buffer; 
    72         char* m_cluster_buffer; 
     73        char* m_tmp_event_buffer; 
    7374         
    74         /** 
    75          * AMDTP specific: 
    76          * the dimension of a stream is the number of substreams it contains 
    77          * i.e. one 'event' is 'dimension' quadlets big.  
    78          * 
    79          * a packet mostly consists of multiple events. the frames of one substream 
    80          * are located in *(buffer), *(buffer+dimension), *(buffer+(dimension*2)), ... 
    81          * 
    82          * adapt this to your needs 
     75        /* 
     76         * An iso packet mostly consists of multiple events.  m_event_size 
     77         * is the size of a single 'event' in bytes. 
    8378         */ 
    84         int m_dimension
     79        unsigned int m_event_size
    8580         
    8681    bool prefill(); 
     
    112107public: 
    113108 
    114         MotuReceiveStreamProcessor(int port, int framerate); 
     109        MotuReceiveStreamProcessor(int port, int framerate, unsigned int event_size); 
    115110        virtual ~MotuReceiveStreamProcessor(); 
    116111         
     
    129124    // ISO DMA buffers size 
    130125    // an estimate will do 
    131         unsigned int getPacketsPerPeriod() {return 1;}; 
    132         unsigned int getMaxPacketSize() {return 2048;};  
     126        unsigned int getPacketsPerPeriod() {return (m_period*8000) / m_framerate;}; 
     127        unsigned int getMaxPacketSize() {return m_framerate<=48000?616:(m_framerate<=96000?1032:1160);};  
    133128 
    134129        virtual void setVerboseLevel(int l); 
    135130         
     131        signed int setEventSize(unsigned int size); 
     132        unsigned int getEventSize(void); 
    136133 
    137134protected: 
     
    142139 
    143140        freebob_ringbuffer_t * m_event_buffer; 
    144         char* m_cluster_buffer; 
     141        char* m_tmp_event_buffer; 
    145142         
    146         /** 
    147          * AMDTP specific: 
    148          * the dimension of a stream is the number of substreams it contains 
    149          * i.e. one 'event' is 'dimension' quadlets big.  
    150          * 
    151          * a packet mostly consists of multiple events. the frames of one substream 
    152          * are located in *(buffer), *(buffer+dimension), *(buffer+(dimension*2)), ... 
    153          * 
    154          * adapt this to your needs 
     143        /* 
     144         * An iso packet mostly consists of multiple events.  m_event_size 
     145         * is the size of a single 'event' in bytes. 
    155146         */ 
    156         int m_dimension; 
    157  
     147        unsigned int m_event_size; 
    158148 
    159149    DECLARE_DEBUG_MODULE; 
  • branches/libfreebob-2.0/src/motu/motu_avdevice.cpp

    r269 r272  
    11/* motu_avdevice.cpp 
    22 * Copyright (C) 2006 by Pieter Palmers 
     3 * Copyright (C) 2006 by Jonathan Woithe 
    34 * 
    45 * This file is part of FreeBob. 
     
    250251        int samp_freq = getSamplingFrequency(); 
    251252        unsigned int optical_mode = getOpticalMode(); 
     253        unsigned int event_size = getEventSize(); 
    252254 
    253255        debugOutput(DEBUG_LEVEL_NORMAL, "Preparing MotuDevice...\n" ); 
    254256 
    255257        m_receiveProcessor=new FreebobStreaming::MotuReceiveStreamProcessor( 
    256                                  m_1394Service->getPort(), samp_freq); 
     258               m_1394Service->getPort(), samp_freq, event_size); 
    257259                                  
    258260        // the first thing is to initialize the processor 
     
    322324        // do the same for the transmit processor 
    323325        m_transmitProcessor=new FreebobStreaming::MotuTransmitStreamProcessor( 
    324                 m_1394Service->getPort(), 
    325                 getSamplingFrequency()); 
     326                m_1394Service->getPort(), getSamplingFrequency(), event_size); 
    326327 
    327328        m_transmitProcessor->setVerboseLevel(getDebugLevel()); 
     
    508509} 
    509510 
     511signed int MotuDevice::getEventSize(void) { 
     512// 
     513// Return the size of a single event sent by the MOTU as part of an iso 
     514// data packet in bytes. 
     515// 
     516// FIXME: for performance it may turn out best to calculate the event 
     517// size in setOpticalMode and cache the result in a data field.  However, 
     518// as it stands this will not adapt to dynamic changes in sample rate - we'd 
     519// need a setFrameRate() for that. 
     520// 
     521// At the very least an event consists of the SPH (4 bytes), the control/MIDI 
     522// bytes (6 bytes) and 8 analog audio channels (each 3 bytes long).  Note that 
     523// all audio channels are sent using 3 bytes. 
     524signed int sample_rate = getSamplingFrequency(); 
     525signed int optical_mode = getOpticalMode(); 
     526signed int size = 4+6+8*3; 
     527 
     528        // 2 channels of AES/EBU is present if a 1x or 2x sample rate is in  
     529        // use 
     530        if (sample_rate <= 96000) 
     531                size += 2*3; 
     532 
     533        // 2 channels of (coax) SPDIF is present for 1x or 2x sample rates so 
     534        // long as the optical mode is not TOSLINK.  If the optical mode is   
     535        // TOSLINK the coax SPDIF channels are replaced by optical TOSLINK    
     536        // channels.  Thus between these options we always have an addition   
     537        // 2 channels here for 1x or 2x sample rates regardless of the optical 
     538        // mode. 
     539        if (sample_rate <= 96000) 
     540                size += 2*3; 
     541 
     542        // ADAT channels 1-4 are present for 1x or 2x sample rates so long 
     543        // as the optical mode is ADAT. 
     544        if (sample_rate<=96000 && optical_mode==MOTUFW_OPTICAL_MODE_ADAT) 
     545                size += 4*3; 
     546 
     547        // ADAT channels 5-8 are present for 1x sample rates so long as the 
     548        // optical mode is ADAT. 
     549        if (sample_rate<=48000 && optical_mode==MOTUFW_OPTICAL_MODE_ADAT) 
     550                size += 4*3; 
     551 
     552        // When 1x or 2x sample rate is active there are an additional 
     553        // 2 channels sent in an event.  For capture it is a Mix1 return, 
     554        // while for playback it is a separate headphone mix. 
     555        if (sample_rate<=96000) 
     556                size += 2*3; 
     557 
     558        // Finally round size up to the next quadlet boundary 
     559        return ((size+3)/4)*4; 
     560} 
    510561/* ======================================================================= */ 
    511562 
     
    589640        } 
    590641 
     642        // TOSLINK ports are present for 1x and 2x sampling rates so long 
     643        // as the optical mode is set to TOSLINK. 
     644        if (sample_rate<=96000 && optical_mode==MOTUFW_OPTICAL_MODE_TOSLINK) { 
     645                for (i=0; i<2; i++) { 
     646                        asprintf(&buff,"dev%d_%s_TOSLINK%d", m_id, mode_str, i+1); 
     647                        if (!addPort(s_processor, buff, direction, 0, 0)) 
     648                                return false; 
     649                } 
     650        } 
     651 
    591652        // ADAT ports 1-4 are present for 1x and 2x sampling rates so long 
    592653        // as the optical mode is set to ADAT. 
  • branches/libfreebob-2.0/src/motu/motu_avdevice.h

    r269 r272  
    9292    unsigned int getOpticalMode(void); 
    9393    signed int setOpticalMode(unsigned int mode); 
     94 
     95    signed int getEventSize(void); 
    9496   
    9597protected: 
  • branches/libfreebob-2.0/tests/streaming/teststreaming.c

    r267 r272  
    178178                                samplesread=freebob_streaming_read(dev, i, audiobuffer[i], PERIOD_SIZE); 
    179179                                break; 
     180                        default: 
     181                                ; 
    180182                        } 
    181183//                      fprintf(fid_in[i], "---- Period read  (%d samples) ----\n",samplesread); 
     
    198200                                sampleswritten=freebob_streaming_write(dev, i, buff, PERIOD_SIZE); 
    199201                                break; 
     202                        default: 
     203                                ; 
    200204                        } 
    201205//                      fprintf(fid_out[i], "---- Period write (%d samples) ----\n",sampleswritten); 
  • branches/libfreebob-2.0/tests/streaming/teststreaming2.c

    r269 r272  
    218218                                samplesread=freebob_streaming_read(dev, i, audiobuffer[i], PERIOD_SIZE); 
    219219                                break; 
     220                        default: 
     221                                ; 
    220222                        } 
    221223         
     
    240242                                sampleswritten=freebob_streaming_write(dev, i, buff, PERIOD_SIZE); 
    241243                                break; 
     244                        default: 
     245                                ; 
    242246                        } 
    243247//                      fprintf(fid_out[i], "---- Period write (%d samples) ----\n",sampleswritten);