Changeset 8804

Show
Ignore:
Timestamp:
02/26/09 10:58:57 (4 years ago)
Author:
jgaeddert
Message:

adding separate threads for playback, capture

Location:
ossiedev/branches/0.7.x/platform/AudioDevice/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/0.7.x/platform/AudioDevice/src/AudioDevice.cpp

    r8803 r8804  
    4141 
    4242    // Start the capture_sound thread 
    43     processing_thread = new omni_thread(run, (void *) this); 
    44     processing_thread->start(); 
     43    capture_thread = new omni_thread(run_capture, (void *) this); 
     44    capture_thread->start(); 
    4545 
    46     // TODO: start sound_playback thread 
     46    // Start playback_sound thread 
     47    playback_thread = new omni_thread(run_playback, (void *) this); 
     48    playback_thread->start(); 
    4749} 
    4850 
     
    5052AudioDevice_i::~AudioDevice_i() 
    5153{ 
    52  
    5354} 
    5455 
    5556// static function for omni thread 
    56 void AudioDevice_i::run( void * data ) 
     57void AudioDevice_i::run_capture( void * data ) 
    5758{ 
    5859    ((AudioDevice_i*) data)->capture_sound(); 
     60} 
     61 
     62 
     63// static function for omni thread 
     64void AudioDevice_i::run_playback( void * data ) 
     65{ 
     66    ((AudioDevice_i*) data)->playback_sound(); 
    5967} 
    6068 
     
    166174} 
    167175 
     176void AudioDevice_i::playback_sound() 
     177{ 
     178    DEBUG(3, AudioDevice, "playback_sound() invoked") 
     179    PortTypes::ShortSequence L_out, R_out; 
     180 
     181    L_out.length(1); 
     182    R_out.length(1); 
     183    
     184    while(1) 
     185    { 
     186        //dataOut->pushPacket(L_out, R_out); 
     187    } 
     188} 
     189 
  • ossiedev/branches/0.7.x/platform/AudioDevice/src/AudioDevice.h

    r8803 r8804  
    6767        throw (CF::Resource::StartError, CORBA::SystemException); 
    6868 
    69     /// static function for omni thread 
    70     static void run( void * data ); 
     69    /// static function for omni thread: capture_sound() 
     70    static void run_capture( void * data ); 
     71 
     72    /// static function for omni thread: playback_sound() 
     73    static void run_playback( void * data ); 
    7174 
    7275    /// Sets isRunning to False (pause) 
     
    109112    void capture_sound(); 
    110113 
     114    /// main processing loop for playing sound 
     115    void playback_sound(); 
     116 
    111117    omni_condition *component_running; ///< for component shutdown 
    112     omni_thread *processing_thread;    ///< for component writer function 
     118    omni_thread *capture_thread;    ///< for component writer function 
     119    omni_thread *playback_thread;    ///< for component writer function 
    113120 
    114121    CORBA::UShort *simple_ptr;