Esempio n. 1
0
/* All general stored data will be assigned to this "head" channel */
static GOOD_OR_BAD HeadChannel(struct connection_in *head)
{
    /* Intentionally put the wrong index */
    head->master.i2c.index = 1;

    if ( BAD(DS2482_channel_select(head)) ) {	/* Couldn't switch */
        head->master.i2c.index = 0;	/* restore correct value */
        LEVEL_CONNECT("DS2482-100 (Single channel)");
        if ( GOOD(DS2483_test(head->pown->file_descriptor)) ) {
            head->master.i2c.type = ds2483 ;
        } else {
            head->master.i2c.type = ds2482_100 ;
        }

        return gbGOOD;				/* happy as DS2482-100 */
    }

    // It's a DS2482-800 (8 channels) to set up other 7 with this one as "head"
    LEVEL_CONNECT("DS2482-800 (Eight channels)");
    /* Must be a DS2482-800 */
    head->master.i2c.channels = 8;
    head->master.i2c.type = ds2482_800 ;
    head->Adapter = adapter_DS2482_800;

    return CreateChannels(head);
}
// Channel is processing a request.
void CChannelManager::ChannelInUse() 
{
    InterlockedIncrement(&activeChannels); 

    assert(idleChannels > 0);
    InterlockedDecrement(&idleChannels);    

    // See if we fell below the threshold for available channels.
    // Ignore return value as the failure to create a new channel should not impact the existing channel.
    (void) CreateChannels();
}
Esempio n. 3
0
CSoundGen::CSoundGen() :
    m_pAPU(NULL),
    m_pSampleMem(NULL),
    m_pDSound(NULL),
    m_pDSoundChannel(NULL),
    m_pAccumBuffer(NULL),
    m_iGraphBuffer(NULL),
    m_pDocument(NULL),
    m_pTrackerView(NULL),
    m_bRendering(false),
    m_bPlaying(false),
    m_pPreviewSample(NULL),
    m_pSampleWnd(NULL),
    m_iSpeed(0),
    m_iTempo(0),
    m_bPlayerHalted(false),
    m_bWaveChanged(false),
    m_iMachineType(NTSC)
{
    pThread = new QThread();

    QObject::connect(this,SIGNAL(postThreadMessage(unsigned int,unsigned int,unsigned int)),this,SLOT(recvThreadMessage(unsigned int,unsigned int,unsigned int)));

    QTimer* timer = new QTimer();
    connect(timer, SIGNAL(timeout()), this, SLOT(onIdleSlot()));
    timer->start();

    pThread->start(/*QThread::TimeCriticalPriority*/);

    // DPCM sample interface
    m_pSampleMem = new CSampleMem();

    // Create APU
    m_pAPU = new CAPU(this, m_pSampleMem);

    m_pAPU->moveToThread(pThread);

//	m_pSoundSemaphore = new CSemaphore(0, 1);

    // Create all kinds of channels
    CreateChannels();

    m_pAPU->SetNamcoMixing(theApp.GetSettings()->m_bNamcoMixing);
}