Changeset 811

Show
Ignore:
Timestamp:
01/05/08 11:38:26 (13 years ago)
Author:
ppalmers
Message:

fixes for introduced bugs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/api-cleanup/src/ffado.cpp

    r809 r811  
    184184    if(!dev->m_deviceManager->prepareStreaming()) { 
    185185        debugFatal("Could not prepare the streaming system\n"); 
    186         return 0
     186        return -1
    187187    } 
    188188    return 0; 
     
    405405 
    406406int ffado_streaming_set_capture_stream_buffer(ffado_device_t *dev, int i, char *buff) { 
    407         Streaming::Port *p = dev->m_deviceManager->getStreamProcessorManager().getPortByIndex(i, Streaming::Port::E_Capture); 
    408         // use an assert here performancewise, 
    409         // it should already have failed before, if not correct 
    410         assert(p); 
    411         p->setBufferAddress((void *)buff); 
    412         return 0; 
     407    Streaming::Port *p = dev->m_deviceManager->getStreamProcessorManager().getPortByIndex(i, Streaming::Port::E_Capture); 
     408    // use an assert here performancewise, 
     409    // it should already have failed before, if not correct 
     410    assert(p); 
     411    p->setBufferAddress((void *)buff); 
     412    return 0; 
    413413} 
    414414 
    415415int ffado_streaming_set_playback_stream_buffer(ffado_device_t *dev, int i, char *buff) { 
    416         Streaming::Port *p = dev->m_deviceManager->getStreamProcessorManager().getPortByIndex(i, Streaming::Port::E_Playback); 
    417         // use an assert here performancewise, 
    418         // it should already have failed before, if not correct 
    419         assert(p); 
    420         p->setBufferAddress((void *)buff); 
    421         return 0; 
    422 } 
     416    Streaming::Port *p = dev->m_deviceManager->getStreamProcessorManager().getPortByIndex(i, Streaming::Port::E_Playback); 
     417    // use an assert here performancewise, 
     418    // it should already have failed before, if not correct 
     419    assert(p); 
     420    p->setBufferAddress((void *)buff); 
     421    return 0; 
     422} 
  • branches/api-cleanup/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp

    r809 r811  
    421421                        sample_int=(sample_int >> 16) & 0x000000FF; 
    422422                        sample_int |= 0x01000000; // flag that there is a midi event present 
     423                        *buffer = sample_int; 
    423424                    } 
    424                     *buffer = sample_int; 
    425425                    buffer += 8; // skip 8 frames 
    426426                } 
  • branches/api-cleanup/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp

    r809 r811  
    656656            debugError("bad type: %d\n", p->getDataType()); 
    657657            return -1; 
    658         case Port::E_Midi
     658        case Port::E_MidiEvent
    659659        { 
    660660            quadlet_t *buffer = (quadlet_t *)(p->getBufferAddress()); 
     
    734734            debugError("bad type: %d\n", p->getDataType()); 
    735735            return -1; 
    736         case Port::E_Midi: 
    737         { 
    738             assert(nevents + offset <= p->getBufferSize()); 
     736        case Port::E_MidiEvent: 
     737        { 
    739738            for ( j = location; j < nevents; j += 8 ) 
    740739            { 
  • branches/api-cleanup/src/libstreaming/generic/Port.cpp

    r809 r811  
    4949 
    5050Port::~Port() { 
     51    debugOutput( DEBUG_LEVEL_VERBOSE, "deleting port %s\n", getName().c_str()); 
    5152    m_manager.unregisterPort(this); 
    5253} 
     
    6667    } 
    6768 
    68     if (m_buffersize==0) { 
     69    if (m_buffersize == 0) { 
    6970        debugFatal("Cannot initialize a port with buffersize=0\n"); 
     71        return false; 
     72    } 
     73 
     74    if (m_buffer == NULL) { 
     75        debugFatal("Cannot initialize a port with no attached buffer\n"); 
    7076        return false; 
    7177    } 
  • branches/api-cleanup/src/libstreaming/generic/PortManager.cpp

    r809 r811  
    4040 
    4141PortManager::~PortManager() { 
     42    flushDebugOutput(); 
    4243    // delete all ports that are still registered to the manager 
    4344    for ( PortVectorIterator it = m_Ports.begin(); 
     
    4546    ++it ) 
    4647    { 
    47         delete *it; 
     48        debugOutput( DEBUG_LEVEL_VERBOSE, "deleting port %s at %p\n", (*it)->getName().c_str(), *it); 
     49        flushDebugOutput(); 
     50        delete *it; //FIXME 
    4851    } 
    4952} 
     
    104107{ 
    105108    assert(port); 
    106     debugOutput( DEBUG_LEVEL_VERBOSE, "deleting port %s\n",port->getName().c_str()); 
     109    debugOutput( DEBUG_LEVEL_VERBOSE, "unregistering port %s\n",port->getName().c_str()); 
    107110 
    108111    for ( PortVectorIterator it = m_Ports.begin(); 
  • branches/api-cleanup/src/libstreaming/generic/StreamProcessor.cpp

    r809 r811  
    8888        debugOutput(DEBUG_LEVEL_VERBOSE,"Could not unregister stream processor with the Iso manager\n"); 
    8989    } 
     90    sem_destroy(&m_signal_semaphore); 
     91 
     92    // FIXME: how do we ensure that nobody is using us? 
    9093 
    9194    if (m_data_buffer) delete m_data_buffer; 
    9295    if (m_scratch_buffer) delete[] m_scratch_buffer; 
    93     sem_destroy(&m_signal_semaphore); 
    9496} 
    9597 
  • branches/api-cleanup/tests/streaming/teststreaming3.cpp

    r809 r811  
    354354            case ffado_stream_type_midi: 
    355355                ffado_streaming_set_playback_buffer_type(dev, i, ffado_buffer_type_midi); 
     356                ffado_streaming_set_playback_stream_buffer(dev, i, (char *)(audiobuffers_out[i])); 
    356357                ffado_streaming_playback_stream_onoff(dev, i, 0); 
    357358            default: 
     
    391392 
    392393    // start the streaming layer 
    393     ffado_streaming_prepare(dev); 
     394    if (ffado_streaming_prepare(dev)) { 
     395        debugFatal("Could not prepare streaming system\n"); 
     396        ffado_streaming_finish(dev); 
     397        return -1; 
     398    } 
    394399    start_flag = ffado_streaming_start(dev); 
    395400     
     
    435440                            uint32_t midievent = *(midibuffer + idx); 
    436441                            if(midievent & 0xFF000000) { 
    437                                 debugOutput(DEBUG_LEVEL_NORMAL, " Received midi event %08X on idx %d of period %d\n",  
    438                                             midievent, idx, nb_periods); 
     442                                debugOutput(DEBUG_LEVEL_NORMAL, " Received midi event %08X at idx %d of period %d on port %d\n",  
     443                                            midievent, idx, nb_periods, i); 
    439444                            } 
    440445                        }