예제 #1
0
void	SMACsdec::StopSource(SInt16 inNumberSources, SoundSource*	inSources)
{
	//	get rid of the input data
	mSourceData = NULL;
	mOutputData.sampleCount = 0;
	
	//	reset the decoder
	if(mDecoder != NULL)
	{
		AudioCodecReset(mDecoder);
	}
	
	ComponentResult theError = SoundComponentStopSource(mSourceComponent, inNumberSources, inSources);
	ThrowIfError(theError, (CAException)theError, "SMACsdec::StopSource: got an error from SoundComponentStopSource");
}
예제 #2
0
void	SMACscom::StopSource(SInt16 inNumberSources, SoundSource*	inSources)
{
	//	get rid of the input data
	mSourceData = NULL;
	mOutputData.desc.sampleCount = 0;
	mOutputData.bufferSize = 0;
	mOutputData.frameCount = 0;
	mOutputData.commonFrameSize = 0;
	
	//	reset the encoder
	if(mEncoder != NULL)
	{
		AudioCodecReset(mEncoder);
	}
	
	ComponentResult theError = SoundComponentStopSource(mSourceComponent, inNumberSources, inSources);
	ThrowIfError(theError, (CAException)theError, "SMACscom::StopSource: got an error from SoundComponentStopSource");
}
예제 #3
0
파일: main.c 프로젝트: bigcat26/cc3200-sdk
//******************************************************************************
//                            MAIN FUNCTION
//******************************************************************************
int main()
{
    long lRetVal = -1;
    unsigned char	RecordPlay;

    BoardInit();

    //
    // Pinmux Configuration
    //
    PinMuxConfig();

    //
    // Initialising the UART terminal
    //
    InitTerm();


    //
    // Initialising the I2C Interface
    //
    lRetVal = I2C_IF_Open(1);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    RecordPlay = I2S_MODE_RX_TX;
    g_loopback = 1;


    //
    // Create RX and TX Buffer
    //
    if(RecordPlay == I2S_MODE_RX_TX)
    {
        pRecordBuffer = CreateCircularBuffer(RECORD_BUFFER_SIZE);
        if(pRecordBuffer == NULL)
        {
            UART_PRINT("Unable to Allocate Memory for Tx Buffer\n\r");
            LOOP_FOREVER();
        }
    }

    /* Play */
    if(RecordPlay & I2S_MODE_TX)
    {
        pPlayBuffer = CreateCircularBuffer(PLAY_BUFFER_SIZE);
        if(pPlayBuffer == NULL)
        {
            UART_PRINT("Unable to Allocate Memory for Rx Buffer\n\r");
            LOOP_FOREVER();
        }
    }


    //
    // Configure Audio Codec
    //
    AudioCodecReset(AUDIO_CODEC_TI_3254, NULL);
    AudioCodecConfig(AUDIO_CODEC_TI_3254, AUDIO_CODEC_16_BIT, 16000,
                     AUDIO_CODEC_STEREO, AUDIO_CODEC_SPEAKER_ALL,
                     AUDIO_CODEC_MIC_ALL);

    AudioCodecSpeakerVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_ALL, 50);
    AudioCodecMicVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_ALL, 50);


    GPIO_IF_LedConfigure(LED2|LED3);

    GPIO_IF_LedOff(MCU_RED_LED_GPIO);
    GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);

    //
    // Configure PIN_01 for GPIOOutput
    //
    //MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false);
    // MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT);

    //
    // Configure PIN_02 for GPIOOutput
    //
    //MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false);
    // MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT);


    //Turning off Green,Orange LED after i2c writes completed - First Time
    GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
    GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO);

    //
    // Initialize the Audio(I2S) Module
    //

    AudioInit();

    //
    // Initialize the DMA Module
    //
    UDMAInit();
    if(RecordPlay & I2S_MODE_TX)
    {
        UDMAChannelSelect(UDMA_CH5_I2S_TX, NULL);
        SetupPingPongDMATransferRx(pPlayBuffer);
    }
    if(RecordPlay == I2S_MODE_RX_TX)
    {
        UDMAChannelSelect(UDMA_CH4_I2S_RX, NULL);
        SetupPingPongDMATransferTx(pRecordBuffer);
    }

    //
    // Setup the Audio In/Out
    //
    lRetVal = AudioSetupDMAMode(DMAPingPongCompleteAppCB_opt, \
                                CB_EVENT_CONFIG_SZ, RecordPlay);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }
    AudioCaptureRendererConfigure(AUDIO_CODEC_16_BIT, 16000, AUDIO_CODEC_STEREO, RecordPlay, 1);

    //
    // Start Audio Tx/Rx
    //
    Audio_Start(RecordPlay);

    //
    // Start the simplelink thread
    //
    lRetVal = VStartSimpleLinkSpawnTask(9);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }


    //
    // Start the Network Task
    //
    lRetVal = osi_TaskCreate( Network, (signed char*)"NetworkTask",\
                              OSI_STACK_SIZE, NULL,
                              1, &g_NetworkTask );
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the Control Task
    //
    lRetVal = ControlTaskCreate();
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the Microphone Task
    //
    lRetVal = osi_TaskCreate( Microphone,(signed char*)"MicroPhone", \
                              OSI_STACK_SIZE, NULL,
                              1, &g_MicTask );
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the Speaker Task
    //
    lRetVal = osi_TaskCreate( Speaker, (signed char*)"Speaker",OSI_STACK_SIZE, \
                              NULL, 1, &g_SpeakerTask );
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the task scheduler
    //
    osi_start();
}