Exemple #1
0
float LadspaManager::getUpperBound( const ladspa_key_t & _plugin,									uint32_t _port )
{
	if( m_ladspaManagerMap.contains( _plugin ) 
		   && _port < getPortCount( _plugin ) )
	{
		LADSPA_Descriptor_Function descriptorFunction =
			m_ladspaManagerMap[_plugin]->descriptorFunction;
		const LADSPA_Descriptor * descriptor =
				descriptorFunction(
					m_ladspaManagerMap[_plugin]->index );
		LADSPA_PortRangeHintDescriptor hintDescriptor =
			descriptor->PortRangeHints[_port].HintDescriptor;
		if( LADSPA_IS_HINT_BOUNDED_ABOVE( hintDescriptor ) )
		{
			return( descriptor->PortRangeHints[_port].UpperBound );
		}
		else
		{
			return( NOHINT );
		}
	}
	else
	{
		return( NOHINT );
	}
}
OMX_ERRORTYPE BinarySplitter::getConfig(
    OMX_INDEXTYPE nConfigIndex,
    OMX_PTR pComponentConfigStructure) const
{
    switch (nConfigIndex) {

    case OMX_IndexConfigAudioChannelSwitchBoard:
    {
        CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE);
        OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE * pConfig =
            (OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE *) pComponentConfigStructure;

        if ( pConfig->nPortIndex == 0 ||
                pConfig->nPortIndex > getPortCount() ) {
            return OMX_ErrorBadPortIndex;
        }

        *pConfig = mAudioSwitchboardConfig[pConfig->nPortIndex-1];

        return OMX_ErrorNone;
    }

    default:
        return AFM_Component::getConfig(
                   nConfigIndex, pComponentConfigStructure);
    }
}
OMX_ERRORTYPE AMRDecoder::createResourcesDB() {
    mRMP = new AMRDecoder_RDB(getPortCount());
    if (mRMP == 0) {
        return OMX_ErrorInsufficientResources;
    } 
    else {
        return OMX_ErrorNone;
    }
}
void PcmSplitter::setDefaultSettings()
{
    int portIndex;

    for (portIndex=0;portIndex< (int) getPortCount();portIndex++)
    {
        // Mute configuration
        mConfigMute[portIndex].nSize = sizeof(OMX_AUDIO_CONFIG_MUTETYPE);
        getOmxIlSpecVersion(&mConfigMute[portIndex].nVersion);
        mConfigMute[portIndex].nPortIndex = portIndex;
        mConfigMute[portIndex].bMute = OMX_FALSE;

        // Balance Configuration
        mConfigBalance[portIndex].nSize = sizeof(OMX_AUDIO_CONFIG_BALANCETYPE);
        getOmxIlSpecVersion(&mConfigBalance[portIndex].nVersion);
        mConfigBalance[portIndex].nPortIndex = portIndex;
        mConfigBalance[portIndex].nBalance = VOLCTRL_BALANCE_CENTER;


        // Volume Configuration
        mConfigVolume[portIndex].nSize = sizeof(OMX_AUDIO_CONFIG_VOLUMETYPE);
        getOmxIlSpecVersion(&mConfigVolume[portIndex].nVersion);
        mConfigVolume[portIndex].nPortIndex = portIndex;
        mConfigVolume[portIndex].bLinear  = OMX_FALSE;
        mConfigVolume[portIndex].sVolume.nValue = VOLCTRL_VOLUME_MAX;
        mConfigVolume[portIndex].sVolume.nMin   = VOLCTRL_VOLUME_MIN;
        mConfigVolume[portIndex].sVolume.nMax   = VOLCTRL_VOLUME_MAX;

        // VolumeRamp Configuration
        mConfigVolumeRamp[portIndex].nSize = sizeof(OMX_SYMBIAN_AUDIO_CONFIG_VOLUMERAMPTYPE);
        getOmxIlSpecVersion(&mConfigVolumeRamp[portIndex].nVersion);
        mConfigVolumeRamp[portIndex].nPortIndex             = portIndex;
        mConfigVolumeRamp[portIndex].nChannel               = 2; //Default is stereo
        mConfigVolumeRamp[portIndex].bLinear                = OMX_FALSE;
        mConfigVolumeRamp[portIndex].sStartVolume.nValue    = VOLCTRL_VOLUME_MAX;
        mConfigVolumeRamp[portIndex].sStartVolume.nMin      = VOLCTRL_VOLUME_MIN;
        mConfigVolumeRamp[portIndex].sStartVolume.nMax      = VOLCTRL_VOLUME_MAX;
        mConfigVolumeRamp[portIndex].sEndVolume.nValue      = VOLCTRL_VOLUME_MAX;
        mConfigVolumeRamp[portIndex].sEndVolume.nMin        = VOLCTRL_VOLUME_MIN;
        mConfigVolumeRamp[portIndex].sEndVolume.nMax        = VOLCTRL_VOLUME_MAX;
        mConfigVolumeRamp[portIndex].nRampDuration          = 0;
        mConfigVolumeRamp[portIndex].nRampMinDuration       = 1000;
        mConfigVolumeRamp[portIndex].nRampMaxDuration       = 1000000;
        mConfigVolumeRamp[portIndex].bRampTerminate         = OMX_FALSE;
        mConfigVolumeRamp[portIndex].sCurrentVolume.nValue  = VOLCTRL_VOLUME_MAX;
        mConfigVolumeRamp[portIndex].sCurrentVolume.nMin    = VOLCTRL_VOLUME_MIN;
        mConfigVolumeRamp[portIndex].sCurrentVolume.nMax    = VOLCTRL_VOLUME_MAX;
        mConfigVolumeRamp[portIndex].nRampCurrentTime       = 0;

    }
}
Exemple #5
0
QString LadspaManager::getPortName( const ladspa_key_t & _plugin,
								uint32_t _port )
{
	if( m_ladspaManagerMap.contains( _plugin ) &&
					_port < getPortCount( _plugin ) )
	{
		LADSPA_Descriptor_Function descriptorFunction =
			m_ladspaManagerMap[_plugin]->descriptorFunction;
		const LADSPA_Descriptor * descriptor =
				descriptorFunction(
					m_ladspaManagerMap[_plugin]->index );

		return( QString( descriptor->PortNames[_port] ) );
	}
	else
	{
		return( QString( "" ) );
	}
}
Exemple #6
0
bool LadspaManager::isInteger( const ladspa_key_t & _plugin,
								uint32_t _port )
{
	if( m_ladspaManagerMap.contains( _plugin ) 
		   && _port < getPortCount( _plugin ) )
	{
		LADSPA_Descriptor_Function descriptorFunction =
			m_ladspaManagerMap[_plugin]->descriptorFunction;
		const LADSPA_Descriptor * descriptor =
				descriptorFunction(
					m_ladspaManagerMap[_plugin]->index );
		LADSPA_PortRangeHintDescriptor hintDescriptor =
			descriptor->PortRangeHints[_port].HintDescriptor;
		return( LADSPA_IS_HINT_INTEGER( hintDescriptor ) );
	}
	else
	{
		return( false );
	}
}
Exemple #7
0
bool LadspaManager::isPortControl( const ladspa_key_t & _plugin,
								uint32_t _port )
{
	if( m_ladspaManagerMap.contains( _plugin ) 
		   && _port < getPortCount( _plugin ) )
	{
		LADSPA_Descriptor_Function descriptorFunction =
			m_ladspaManagerMap[_plugin]->descriptorFunction;
		const LADSPA_Descriptor * descriptor =
				descriptorFunction(
					m_ladspaManagerMap[_plugin]->index );
		
		return( LADSPA_IS_PORT_CONTROL
				( descriptor->PortDescriptors[_port] ) );
	}
	else
	{
		return( false );
	}
}
Exemple #8
0
bool LadspaManager::connectPort( const ladspa_key_t & _plugin,
						LADSPA_Handle _instance, 
						uint32_t _port,
						LADSPA_Data * _data_location )
{
	if( m_ladspaManagerMap.contains( _plugin ) 
		&& _port < getPortCount( _plugin ) )
	{
		LADSPA_Descriptor_Function descriptorFunction =
			m_ladspaManagerMap[_plugin]->descriptorFunction;
		const LADSPA_Descriptor * descriptor =
				descriptorFunction(
					m_ladspaManagerMap[_plugin]->index );
		if( descriptor->connect_port != NULL )
		{
			( descriptor->connect_port )
					( _instance, _port, _data_location );
			return( true );
		}
	}
	return( false );
}
OMX_ERRORTYPE PcmSplitter::construct(void)
{
    OMX_ERRORTYPE error;
    OMX_U32 idx, nRoleCount=1;
    OMX_AUDIO_PARAM_PCMMODETYPE defaultPcmSettings;
    PcmSplitter_PcmPort *pcmsplitterPort;

    error = AFM_Component::construct(NB_OUTPUT_PORTS + NB_INPUT_PORTS, nRoleCount,mIsHost);
    if (error != OMX_ErrorNone) return error;

    ENS_String<25> role;
    // Same roles for ARM and DSP
    role = "audio_splitter.pcm";
    role.put((OMX_STRING)mRoles[0]);

    setActiveRole(mRoles[0]);

    mBlockSize = DEFAULT_PCM_BLOCKSIZE;
    defaultPcmSettings.nSize          = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
    defaultPcmSettings.eNumData       = OMX_NumericalDataSigned;
    defaultPcmSettings.eEndian        = OMX_EndianLittle;
    defaultPcmSettings.bInterleaved   = OMX_TRUE;
    defaultPcmSettings.ePCMMode       = OMX_AUDIO_PCMModeLinear;
    defaultPcmSettings.nBitPerSample  = 16;

    defaultPcmSettings.nChannels      = 2;
    defaultPcmSettings.nSamplingRate  = 48000;
    defaultPcmSettings.nPortIndex     = 0;

    defaultPcmSettings.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
    defaultPcmSettings.eChannelMapping[1] = OMX_AUDIO_ChannelRF;

    //Create PcmSplitter Input Port
    pcmsplitterPort =
        new PcmSplitter_PcmPort(0,
                OMX_DirInput,
                mBlockSize * defaultPcmSettings.nChannels * defaultPcmSettings.nBitPerSample/8,
                defaultPcmSettings,
                *this);

    if (pcmsplitterPort == 0) {
        return OMX_ErrorInsufficientResources;
    }

    addPort(pcmsplitterPort);
    if (mIsHost == OMX_TRUE) {
        pcmsplitterPort->setSupportedProprietaryComm(AFM_HOST_PROPRIETARY_COMMUNICATION);
    } else {
        pcmsplitterPort->setSupportedProprietaryComm(AFM_MPC_PROPRIETARY_COMMUNICATION);;
    }

    //Create PcmSplitter Output Ports
    for (idx=1; idx<getPortCount(); idx++) {
        defaultPcmSettings.nPortIndex = idx;
        pcmsplitterPort = new PcmSplitter_PcmPort(
                idx,
                OMX_DirOutput,
                mBlockSize * defaultPcmSettings.nChannels * defaultPcmSettings.nBitPerSample/8,
                defaultPcmSettings,
                *this);

        if (pcmsplitterPort == 0) {
            return OMX_ErrorInsufficientResources;
        }

        addPort(pcmsplitterPort);
        if (mIsHost == OMX_TRUE) {
            pcmsplitterPort->setSupportedProprietaryComm(AFM_HOST_PROPRIETARY_COMMUNICATION);
        } else {
            pcmsplitterPort->setSupportedProprietaryComm(AFM_MPC_PROPRIETARY_COMMUNICATION);;
        }
    }

    setDefaultSettings();

    return OMX_ErrorNone;
}
OMX_ERRORTYPE PcmSplitter::getConfig(
        OMX_INDEXTYPE nConfigIndex,
        OMX_PTR pComponentConfigStructure) const
{
    switch (nConfigIndex) {

        case OMX_IndexConfigAudioChannelSwitchBoard:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE);
                OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE * pConfig =
                    (OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE *) pComponentConfigStructure;

                if ( pConfig->nPortIndex == 0 || pConfig->nPortIndex > getPortCount() ) {
                    return OMX_ErrorBadPortIndex;
                }

                const PcmSplitter_PcmPort * port = static_cast<const PcmSplitter_PcmPort *>(getPort(pConfig->nPortIndex));

                port->getChannelSwitchBoard(pConfig->nOutputChannel);

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioPortpause:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_SYMBIAN_AUDIO_CONFIG_PORTPAUSETYPE);
                OMX_SYMBIAN_AUDIO_CONFIG_PORTPAUSETYPE* pConfig =
                    (OMX_SYMBIAN_AUDIO_CONFIG_PORTPAUSETYPE*) pComponentConfigStructure;

                if ( pConfig->nPortIndex == 0 || pConfig->nPortIndex > getPortCount() ) {
                    return OMX_ErrorBadPortIndex;
                }

                pConfig->bIsPaused = ((PcmSplitter_PcmPort *)getPort(pConfig->nPortIndex))->isPaused();

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioVolume:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_AUDIO_CONFIG_VOLUMETYPE);
                OMX_AUDIO_CONFIG_VOLUMETYPE * pVolume =
                    (OMX_AUDIO_CONFIG_VOLUMETYPE *) pComponentConfigStructure;

                if (pVolume->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }

                *pVolume = mConfigVolume[pVolume->nPortIndex];

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioMute:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_AUDIO_CONFIG_MUTETYPE);
                OMX_AUDIO_CONFIG_MUTETYPE * pMute =
                    (OMX_AUDIO_CONFIG_MUTETYPE *) pComponentConfigStructure;

                if (pMute->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }

                *pMute = mConfigMute[pMute->nPortIndex];

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioBalance:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_AUDIO_CONFIG_BALANCETYPE);
                OMX_AUDIO_CONFIG_BALANCETYPE * pBalance =
                    (OMX_AUDIO_CONFIG_BALANCETYPE *) pComponentConfigStructure;

                if (pBalance->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }

                *pBalance = mConfigBalance[pBalance->nPortIndex];

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioVolumeRamp:
            {

                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_SYMBIAN_AUDIO_CONFIG_VOLUMERAMPTYPE);

                OMX_SYMBIAN_AUDIO_CONFIG_VOLUMERAMPTYPE *pRampVolume =
                    (OMX_SYMBIAN_AUDIO_CONFIG_VOLUMERAMPTYPE*)pComponentConfigStructure;

                if (pRampVolume->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }

                return OMX_ErrorUnsupportedIndex;
            }
        default:
            return AFM_Component::getConfig(
                    nConfigIndex, pComponentConfigStructure);
    }
}
OMX_ERRORTYPE PcmSplitter::setConfig(
        OMX_INDEXTYPE nConfigIndex,
        OMX_PTR pComponentConfigStructure)
{
    switch (nConfigIndex) {

        case OMX_IndexConfigAudioChannelSwitchBoard:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE);
                OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE * pConfig =
                    (OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE *) pComponentConfigStructure;

                if ( pConfig->nPortIndex == 0 || pConfig->nPortIndex > getPortCount() ) {
                    return OMX_ErrorBadPortIndex;
                }

                PcmSplitter_PcmPort * port = static_cast<PcmSplitter_PcmPort *>(getPort(pConfig->nPortIndex));

                return port->setChannelSwitchBoard(pConfig->nOutputChannel);
            }

        case OMX_IndexConfigAudioPortpause:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_SYMBIAN_AUDIO_CONFIG_PORTPAUSETYPE);
                OMX_SYMBIAN_AUDIO_CONFIG_PORTPAUSETYPE* pConfig =
                    (OMX_SYMBIAN_AUDIO_CONFIG_PORTPAUSETYPE*) pComponentConfigStructure;

                if ( pConfig->nPortIndex == 0 || pConfig->nPortIndex > getPortCount() ) {
                    return OMX_ErrorBadPortIndex;
                }

                ((PcmSplitter_PcmPort *)getPort(pConfig->nPortIndex-1))->setPause(pConfig->bIsPaused);

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioVolume:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_AUDIO_CONFIG_VOLUMETYPE);
                OMX_AUDIO_CONFIG_VOLUMETYPE * pVolume =
                    (OMX_AUDIO_CONFIG_VOLUMETYPE *) pComponentConfigStructure;

                if (pVolume->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }

                if (pVolume->bLinear != OMX_FALSE) {
                    return OMX_ErrorBadParameter;
                }

                if (pVolume->sVolume.nValue < pVolume->sVolume.nMin ||
                        pVolume->sVolume.nValue > pVolume->sVolume.nMax) {
                    return OMX_ErrorBadParameter;
                }

                mConfigVolume[pVolume->nPortIndex] = *pVolume;

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioMute:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_AUDIO_CONFIG_MUTETYPE);
                OMX_AUDIO_CONFIG_MUTETYPE * pMute =
                    (OMX_AUDIO_CONFIG_MUTETYPE *) pComponentConfigStructure;

                if (pMute->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }

                mConfigMute[pMute->nPortIndex] = *pMute;

                return OMX_ErrorNone;
            }

        case OMX_IndexConfigAudioBalance:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_AUDIO_CONFIG_BALANCETYPE);
                OMX_AUDIO_CONFIG_BALANCETYPE * pBalance =
                    (OMX_AUDIO_CONFIG_BALANCETYPE *) pComponentConfigStructure;

                if (pBalance->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }

                if (pBalance->nBalance < VOLCTRL_BALANCE_ALLLEFT || pBalance->nBalance > VOLCTRL_BALANCE_ALLRIGHT) {
                    return OMX_ErrorBadParameter;
                }


                mConfigBalance[pBalance->nPortIndex] = *pBalance;
                return OMX_ErrorNone;
            }
        case OMX_IndexConfigAudioVolumeRamp:
            {
                CHECK_STRUCT_SIZE_AND_VERSION(pComponentConfigStructure,OMX_SYMBIAN_AUDIO_CONFIG_VOLUMERAMPTYPE);

                OMX_SYMBIAN_AUDIO_CONFIG_VOLUMERAMPTYPE *pRampVolume =
                    (OMX_SYMBIAN_AUDIO_CONFIG_VOLUMERAMPTYPE*)pComponentConfigStructure;

                if (pRampVolume->nPortIndex > getPortCount()) {
                    return OMX_ErrorBadPortIndex;
                }


                if (pRampVolume->sStartVolume.nValue> pRampVolume->sStartVolume.nMax){
                    return OMX_ErrorBadParameter;
                }
                if (pRampVolume->sStartVolume.nValue< pRampVolume->sStartVolume.nMin){
                    return OMX_ErrorBadParameter;
                }

                if (pRampVolume->sEndVolume.nValue> pRampVolume->sEndVolume.nMax){
                    return OMX_ErrorBadParameter;
                }
                if (pRampVolume->sEndVolume.nValue< pRampVolume->sEndVolume.nMin){
                    return OMX_ErrorBadParameter;
                }

                if (pRampVolume->nRampDuration> pRampVolume->nRampMaxDuration){
                    return OMX_ErrorBadParameter;
                }
                if (pRampVolume->nRampDuration< pRampVolume->nRampMinDuration){
                    return OMX_ErrorBadParameter;
                }


                mConfigVolumeRamp[pRampVolume->nPortIndex].nChannel = pRampVolume->nChannel;
                mConfigVolumeRamp[pRampVolume->nPortIndex].bLinear  = pRampVolume->bLinear;
                mConfigVolumeRamp[pRampVolume->nPortIndex].sStartVolume.nValue = pRampVolume->sStartVolume.nValue;
                mConfigVolumeRamp[pRampVolume->nPortIndex].sEndVolume.nValue   = pRampVolume->sEndVolume.nValue;
                mConfigVolumeRamp[pRampVolume->nPortIndex].nRampDuration       = pRampVolume->nRampDuration;
                mConfigVolumeRamp[pRampVolume->nPortIndex].bRampTerminate      = pRampVolume->bRampTerminate;

                return OMX_ErrorUnsupportedIndex;
            }

        default:
            return AFM_Component::setConfig(
                    nConfigIndex, pComponentConfigStructure);
    }
}
Exemple #12
0
// Calculate the max time the rest of the scan could take
int PortScanner::getRemainingScanTime() {
	if (debug > 2) printf("PortScanner::getRemainingScanTime: Called\n");
	int bytes_per_packet = int(total_bytes_sent / packets_sent);
	return int(1 + getRTT().tv_sec + getRTT().tv_usec / 1000000 + (getPortCount() * getHostCount() * tries - packets_sent) * bytes_per_packet * 8 / getBandwidthMax());
}
Exemple #13
0
// Calculate most conservative esitmate of scan progress
int PortScanner::getPercentComplete() {
	if (debug > 2) printf("PortScanner::getPercentComplete: Called\n");
	return int(100 * packets_sent / (getPortCount() * getHostCount() * tries));
}
Exemple #14
0
float LadspaManager::getDefaultSetting( const ladspa_key_t & _plugin,
							uint32_t _port )
{
	if( m_ladspaManagerMap.contains( _plugin ) 
		   && _port < getPortCount( _plugin ) )
	{
		LADSPA_Descriptor_Function descriptorFunction =
			m_ladspaManagerMap[_plugin]->descriptorFunction;
		const LADSPA_Descriptor * descriptor =
				descriptorFunction(
					m_ladspaManagerMap[_plugin]->index );
		LADSPA_PortRangeHintDescriptor hintDescriptor =
			descriptor->PortRangeHints[_port].HintDescriptor;
		switch( hintDescriptor & LADSPA_HINT_DEFAULT_MASK ) 
		{
			case LADSPA_HINT_DEFAULT_NONE:
				return( NOHINT );
			case LADSPA_HINT_DEFAULT_MINIMUM:
				return( descriptor->PortRangeHints[_port].
								LowerBound );
			case LADSPA_HINT_DEFAULT_LOW:
				if( LADSPA_IS_HINT_LOGARITHMIC
							( hintDescriptor ) )
				{
					return( exp( log( descriptor->PortRangeHints[_port].LowerBound ) 
						* 0.75
						+ log( descriptor->PortRangeHints[_port].UpperBound ) 
						* 0.25 ) );
				}
				else 
				{
					return( descriptor->PortRangeHints[_port].LowerBound
						* 0.75
						+ descriptor->PortRangeHints[_port].UpperBound
						* 0.25 );
				}
			case LADSPA_HINT_DEFAULT_MIDDLE:
				if( LADSPA_IS_HINT_LOGARITHMIC
						( hintDescriptor ) ) 
				{
					return( sqrt( descriptor->PortRangeHints[_port].LowerBound
						* descriptor->PortRangeHints[_port].UpperBound ) );
				}
				else 
				{
					return( 0.5 * ( descriptor->PortRangeHints[_port].LowerBound
							+ descriptor->PortRangeHints[_port].UpperBound ) );
				}
			case LADSPA_HINT_DEFAULT_HIGH:
				if( LADSPA_IS_HINT_LOGARITHMIC
						( hintDescriptor ) ) 
				{
					return( exp( log( descriptor->PortRangeHints[_port].LowerBound ) 
						* 0.25
						+ log( descriptor->PortRangeHints[_port].UpperBound ) 
						* 0.75 ) );
				}
				else 
				{
					return( descriptor->PortRangeHints[_port].LowerBound
						* 0.25
						+ descriptor->PortRangeHints[_port].UpperBound
						* 0.75 );
				}
			case LADSPA_HINT_DEFAULT_MAXIMUM:
				return( descriptor->PortRangeHints[_port].UpperBound );
			case LADSPA_HINT_DEFAULT_0:
				return( 0.0 );
			case LADSPA_HINT_DEFAULT_1:
				return( 1.0 );
			case LADSPA_HINT_DEFAULT_100:
				return( 100.0 );
			case LADSPA_HINT_DEFAULT_440:
				return( 440.0 );
			default:
				return( NOHINT );
		}
	}
	else
	{
		return( NOHINT );
	}
}
OMX_ERRORTYPE BinarySplitter::construct()
{
    OMX_ERRORTYPE error;
    OMX_U32 idx;
    OMX_AUDIO_PARAM_PCMMODETYPE defaultPcmSettings;
    BinarySplitter_PcmPort *binarysplitterPort;

    error = AFM_Component::construct(NB_OUTPUT_PORTS + NB_INPUT_PORTS, 2, mIsHost);
    if (error != OMX_ErrorNone) return error;

    ENS_String<35> role = "audio_splitter.binary";
    role.put((OMX_STRING)mRoles[0]);

    ENS_String<35> role1 = "audio_splitter.channelswitchboard";
    role1.put((OMX_STRING)mRoles[1]);

    setActiveRole(mRoles[0]);


    mBlockSize = DEFAULT_PCM_BLOCKSIZE;

    defaultPcmSettings.nSize          = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
    defaultPcmSettings.eNumData       = OMX_NumericalDataSigned;
    defaultPcmSettings.eEndian        = OMX_EndianLittle;
    defaultPcmSettings.bInterleaved   = OMX_TRUE;
    defaultPcmSettings.ePCMMode       = OMX_AUDIO_PCMModeLinear;
    defaultPcmSettings.nBitPerSample  = 16;

    defaultPcmSettings.nChannels      = 2;
    defaultPcmSettings.nSamplingRate  = 48000;
    defaultPcmSettings.nPortIndex     = 0;

    defaultPcmSettings.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
    defaultPcmSettings.eChannelMapping[1] = OMX_AUDIO_ChannelRF;

    for (idx=1; idx<getPortCount(); idx++) {
        mAudioSwitchboardConfig[idx-1].nSize = sizeof(OMX_SYMBIAN_AUDIO_CONFIG_CHANNELSWITCHBOARDTYPE);
        getOmxIlSpecVersion(&mAudioSwitchboardConfig[idx-1].nVersion);
    }

    //Create BinarySplitter Input Port
    binarysplitterPort =
        new BinarySplitter_PcmPort(0,
                                   OMX_DirInput,
                                   mBlockSize * defaultPcmSettings.nChannels * defaultPcmSettings.nBitPerSample/8,
                                   defaultPcmSettings,
                                   *this);

    if (binarysplitterPort == 0) {
        return OMX_ErrorInsufficientResources;
    }

    addPort(binarysplitterPort);

    //Create BinarySplitter Output Ports
    for (idx=1; idx<getPortCount(); idx++) {
        defaultPcmSettings.nPortIndex = idx;
        binarysplitterPort =
            new BinarySplitter_PcmPort(idx,
                                       OMX_DirOutput,
                                       mBlockSize * defaultPcmSettings.nChannels * defaultPcmSettings.nBitPerSample/8,
                                       defaultPcmSettings,
                                       *this);

        if (binarysplitterPort == 0) {
            return OMX_ErrorInsufficientResources;
        }

        addPort(binarysplitterPort);
        mOutConfig[idx - 1] = false;
    }

    for (idx=0; idx<getPortCount(); idx++) {
        AFM_PcmPort *pcmPort = static_cast<AFM_PcmPort *>(getPort(idx));
        if (mIsHost) {
            //pcmPort->forceStandardTunneling();
            pcmPort->setSupportedProprietaryComm(AFM_HOST_PROPRIETARY_COMMUNICATION);
        }
        else {
            pcmPort->setSupportedProprietaryComm(AFM_MPC_PROPRIETARY_COMMUNICATION);
        }
    }

    return OMX_ErrorNone;
}