예제 #1
0
파일: PCMRemap.cpp 프로젝트: AaronDnz/xbmc
/* sets the output format supported by the audio renderer */
void CPCMRemap::SetOutputFormat(unsigned int channels, enum PCMChannels *channelMap, bool ignoreLayout/* = false */)
{
  m_outChannels   = channels;
  m_outSet        = channelMap != NULL;
  m_ignoreLayout  = ignoreLayout;
  if (channelMap)
    memcpy(m_outMap, channelMap, sizeof(enum PCMChannels) * channels);

  DumpMap("O", channels, channelMap);
  BuildMap();
}
예제 #2
0
/* sets the input format, and returns the requested channel layout */
enum PCMChannels *CPCMRemap::SetInputFormat(unsigned int channels, enum PCMChannels *channelMap, unsigned int sampleSize, unsigned int sampleRate)
{
  m_inChannels   = channels;
  m_inSampleSize = sampleSize;
  m_sampleRate   = (float)sampleRate;
  m_inSet        = channelMap != NULL;
  if (channelMap)
    memcpy(m_inMap, channelMap, sizeof(enum PCMChannels) * channels);

  /* fix me later */
  assert(sampleSize == 2);

  /* get the audio layout, and count the channels in it */
  if (!m_bAudio2)
    m_channelLayout  = (enum PCMLayout)g_guiSettings.GetInt("audiooutput.channellayout");
  else
    m_channelLayout  = (enum PCMLayout)g_guiSettings.GetInt("audiooutput2.channellayout");
  if (m_channelLayout >= PCM_MAX_LAYOUT) m_channelLayout = PCM_LAYOUT_2_0;

  //spdif only has 2 pcm channels, so don't try to use more
  if (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958)
  {
    CLog::Log(LOGINFO, "CPCMRemap: Configured speaker layout: %s (iec958)\n", PCMLayoutStr(m_channelLayout).c_str());
    m_channelLayout = PCM_LAYOUT_2_0;
  }
  else
    CLog::Log(LOGINFO, "CPCMRemap: Configured speaker layout: %s\n", PCMLayoutStr(m_channelLayout).c_str());

  
  DumpMap("I", channels, channelMap);
  BuildMap();

  /* now remove the empty channels from PCMLayoutMap;
   * we don't perform upmixing so we want the minimum amount of those */
  if (channelMap) {
    if (!m_outSet)
      ResolveChannels(); /* Do basic channel resolving to find out the empty channels;
                          * If m_outSet == true, this was done already by BuildMap() above */
    int i = 0;
    for (enum PCMChannels *chan = PCMLayoutMap[m_channelLayout]; *chan != PCM_INVALID; ++chan)
      if (m_lookupMap[*chan][0].channel != PCM_INVALID) {
        /* something is mapped here, so add the channel */
        m_layoutMap[i++] = *chan;
      }
    m_layoutMap[i] = PCM_INVALID;
  } else
    memcpy(m_layoutMap, PCMLayoutMap[m_channelLayout], sizeof(PCMLayoutMap[m_channelLayout]));

  m_attenuation = 1.0;
  m_attenuationInc = 1.0;
  m_holdCounter = 0;

  return m_layoutMap;
}
예제 #3
0
void EventMapView::DumpEventMap(EEventMap *aEventMap) {
    char name[256];
    
    while (aEventMap) {
        strcpy(name, aEventMap->Name);
        if (aEventMap->Parent) {
            strcat(name, ": ");
            strcat(name, aEventMap->Parent->Name);
        }
        AddLine(name);
        if (aEventMap->KeyMap)
            DumpMap(0, aEventMap->KeyMap);
        aEventMap = aEventMap->Parent;
        if (aEventMap != 0)
            AddLine("");
    }
}
예제 #4
0
void EventMapView::DumpMap(const char *aPrefix, EKeyMap *aKeyMap) {
    EKey *Key;
    
    Key = aKeyMap->fKeys;
    while (Key) {
        if (Key->fKeyMap) {
            char Prefix[32] = "";
            
            if (aPrefix) {
                strcpy(Prefix, aPrefix);
                strcat(Prefix, "_");
            }
            GetKeyName(Prefix + strlen(Prefix), sizeof(Prefix)-strlen(Prefix), Key->fKey);
            DumpMap(Prefix, Key->fKeyMap);
        } else {
            DumpKey(aPrefix, Key);
        }
        Key = Key->fNext;
    }
}
예제 #5
0
파일: PCMRemap.cpp 프로젝트: Anankin/xbmc
/* sets the input format, and returns the requested channel layout */
enum PCMChannels *CPCMRemap::SetInputFormat(unsigned int channels, enum PCMChannels *channelMap, unsigned int sampleSize, unsigned int sampleRate, PCMLayout layout)
{
  m_inChannels   = channels;
  m_inSampleSize = sampleSize;
  m_sampleRate   = sampleRate;
  m_inSet        = channelMap != NULL;
  if (channelMap)
    memcpy(m_inMap, channelMap, sizeof(enum PCMChannels) * channels);

  /* get the audio layout, and count the channels in it */
  m_channelLayout  = layout;
  if (m_channelLayout >= PCM_MAX_LAYOUT) m_channelLayout = PCM_LAYOUT_2_0;


  DumpMap("I", channels, channelMap);
  BuildMap();

  /* now remove the empty channels from PCMLayoutMap;
   * we don't perform upmixing so we want the minimum amount of those */
  if (channelMap) {
    if (!m_outSet)
      ResolveChannels(); /* Do basic channel resolving to find out the empty channels;
                          * If m_outSet == true, this was done already by BuildMap() above */
    int i = 0;
    for (enum PCMChannels *chan = PCMLayoutMap[m_channelLayout]; *chan != PCM_INVALID; ++chan)
      if (m_lookupMap[*chan][0].channel != PCM_INVALID) {
        /* something is mapped here, so add the channel */
        m_layoutMap[i++] = *chan;
      }
    m_layoutMap[i] = PCM_INVALID;
  } else
    memcpy(m_layoutMap, PCMLayoutMap[m_channelLayout], sizeof(PCMLayoutMap[m_channelLayout]));

  m_attenuation = 1.0;
  m_attenuationInc = 1.0;
  m_holdCounter = 0;

  return m_layoutMap;
}
예제 #6
0
int UserClient::_CmdLOUT( OmniPacket *packet )
{
	int errCode = ERROR_OK;
	map<string, UserClient*>::iterator iter = mHashMap.find( mUserID );
	if( iter == mHashMap.end() )
	{
		gLog.log("No user info");
	}
	else
	{
		mHashMap.erase( iter );
	}

	DumpMap();

	char ret[BUFLEN];
	bzero( ret, BUFLEN );
	sprintf( ret, "LOUT %lu %d 0\r\n", packet->mTrid, errCode );
	WritePacket( ret, strlen(ret) );

	EventChannel::EventCallback( (struct bufferevent*)buffer_event, 0, this );
	return errCode;
}
예제 #7
0
int UserClient::_CmdLSIN( OmniPacket *packet )
{
	char userid[NODELEN];
	char passwd[NODELEN];
	int errCode = ERROR_OK;

	PARSE_TAG_INIT( packet->mHeader );
	PARSE_TAG_NEXT( packet->mHeader, userid );
	PARSE_TAG_NEXT( packet->mHeader, passwd );
	gLog.log("userid[%s] passwd[%s]", userid, passwd );

	if( errCode == 0 )
	{
		strcpy( mUserID, userid );
		mHashMap.insert( pair<const char*, UserClient*>(userid, this) );
	}
	DumpMap();

	char ret[BUFLEN];
	bzero( ret, BUFLEN );
	sprintf( ret, "LSIN %lu %d 0\r\n", packet->mTrid, errCode );
	WritePacket( ret, strlen(ret) );
	return errCode;
}
예제 #8
0
파일: cprint.c 프로젝트: sharkcz/xtrkcad
main( INT_T argc, char * argv[] )
{
	INT_T i;
	mapD.size.x = 4*12;
	mapD.size.y = 3*12;
	printD.scale = 1.0;
	for (i=0; i<(sizeof cmds)/(sizeof cmds[0]); i++) {
		switch (cmds[i].cmd) {
		case C_START:
			CmdPrint( cmds[i].cmd );
			DumpMap( "Start\n", 0, 0 );
			break;
		case C_DOWN:
			CmdPrint( cmds[i].cmd, cmds[i].pos );
			DumpMap( "Down (%0.3f %0.3f)\n", cmds[i].pos.x, cmds[i].pos.y );
			break;
		case C_MOVE:
			CmdPrint( cmds[i].cmd, cmds[i].pos );
			DumpMap( "Move (%0.3f %0.3f)\n", cmds[i].pos.x, cmds[i].pos.y );
			break;
		case C_UP:
			CmdPrint( cmds[i].cmd, cmds[i].pos );
			DumpMap( "Up\n", 0, 0 );
			break;
		case C_PRINT:
			DoPrintPrint( NULL );
			DumpMap( "Print\n", 0, 0 );
			break;
		case C_CANCEL:
			ClearPrint();
			DumpMap( "Cancel\n", 0, 0 );
			break;
		case C_SCALE:
			printD.scale = cmds[i].x;
			break;
		}
	}
}