Revision 8:4c738d26de4f JackDevice

View differences:

JackDevice/ContextJack.cpp
47 47
#include "cinder/audio/linux/ContextJack.h"
48 48
#include "cinder/audio/Exception.h"
49 49

  
50
#define NUM_CHANNELS 2
51

  
50 52
namespace cinder { namespace audio { namespace linux {
51 53

  
52 54

  
......
90 92
    auto ctx = renderData->outputNode->getContext();
91 93
    if( ! ctx ) {
92 94
        // this is from some cinder library code but it should not happen in Collidoscope as the context is set
93
        for( size_t chan = 0; chan < 2; chan++)
95
        for( size_t chan = 0; chan < NUM_CHANNELS; chan++)
94 96
            zeroJackPort( outputDeviceNode->mOutputPorts[chan], nframes );
95 97

  
96 98
        return 0;
......
102 104
    ctx = renderData->outputNode->getContext();
103 105
    if( ! ctx ) {
104 106

  
105
        for( size_t chan = 0; chan < 2; chan++)
107
        for( size_t chan = 0; chan < NUM_CHANNELS; chan++)
106 108
            zeroJackPort( outputDeviceNode->mOutputPorts[chan], nframes );
107 109

  
108 110
        return 0;
......
118 120
    
119 121
    // if clip detection is enabled and buffer clipped, silence it
120 122
    //if( outputDeviceNode->checkNotClipping() ){
121
        //for( size_t chan = 0; chan < 2; chan++)
123
        //for( size_t chan = 0; chan < NUM_CHANNELS; chan++)
122 124
        //    zeroJackPort( outputDeviceNode->mOutputPorts[chan], nframes );
123 125
    //} 
124 126
    //else {
125
        for( size_t chan = 0; chan < 2; chan++)
127
        for( size_t chan = 0; chan < NUM_CHANNELS; chan++)
126 128
            copyToJackPort( outputDeviceNode->mOutputPorts[chan], internalBuffer->getChannel( chan ), nframes  );
127 129
    //}
128 130

  
......
281 283
// Takes audio interface input from the jack port and copies it in the node buffer
282 284
void InputDeviceNodeJack::process( Buffer *buffer )
283 285
{
284
    for( size_t chan = 0; chan < 2; chan++){
286
    for( size_t chan = 0; chan < NUM_CHANNELS; chan++){
285 287
       copyFromJackPort(mInputPorts[chan], buffer->getChannel( chan ), buffer->getNumFrames() ); 
286 288
    }
287 289
}
......
295 297
    if( mOutputDeviceNode  == nullptr ) {
296 298
        auto thisRef = std::static_pointer_cast<ContextJack>( shared_from_this() );
297 299

  
298
        mOutputDeviceNode = makeNode( new OutputDeviceNodeJack( device, Node::Format().channels(2), thisRef ) ) ;
300
        mOutputDeviceNode = makeNode( new OutputDeviceNodeJack( device, Node::Format().channels(NUM_CHANNELS), thisRef ) ) ;
299 301

  
300 302
        // the output device node must have a reference to input device node. In OutputDeviceNodeJack::initialize() 
301 303
        // the input node is passed the jack input ports that it will use to fetch incoming audio from the audio interface
......
314 316
    if( mInputDeviceNode  == nullptr ) {
315 317
        auto thisRef = std::static_pointer_cast<ContextJack>( shared_from_this() );
316 318

  
317
        mInputDeviceNode = makeNode( new InputDeviceNodeJack( device, Node::Format().channels(2), thisRef ) ) ;
319
        mInputDeviceNode = makeNode( new InputDeviceNodeJack( device, Node::Format().channels( NUM_CHANNELS ), thisRef ) ) ;
318 320

  
319 321
        // the output device node must have a reference to input device node. In OutputDeviceNodeJack::initialize() 
320 322
        // the input node is passed the jack input ports that it will use to fetch incoming audio from the audio interface

Also available in: Unified diff