Пример #1
0
int main(int argc, char **argv)
{
    HANDLE hDevice;
    u6CalibrationInfo caliInfo;

    //Opening first found U6 over USB
    if( (hDevice = openUSBConnection(-1)) == NULL )
        goto done;

    //Getting calibration information from U6
    if( getCalibrationInfo(hDevice, &caliInfo) < 0 )
        goto close;

    if( ConfigIO_example(hDevice) != 0 )
        goto close;

    //Stopping any previous streams
    StreamStop(hDevice);

    if( StreamConfig_example(hDevice) != 0 )
        goto close;

    if( StreamStart(hDevice) != 0 )
        goto close;

    StreamData_example(hDevice, &caliInfo);
    StreamStop(hDevice);

close:
    closeUSBConnection(hDevice);
done:
    return 0;
}
Пример #2
0
void CEXIMic::StreamTerminate()
{
	StreamStop();

	if ((pa_error = Pa_Terminate()) != paNoError)
		StreamLog("Pa_Terminate");
}
Пример #3
0
//Runs StreamStop and flushStream low-level functions to flush out the streaming 
//buffer.  This function is useful for stopping streaming and clearing it after
//a Comm buffer overflow.
int doFlush(int socketFDA)
{
  printf("Flushing stream.\n");
  StreamStop(socketFDA, 0);
  flushStream(socketFDA);

  return 0;
}
Пример #4
0
//Runs StreamStop and flushStream low-level functions to flush out the streaming buffer.  Also
//reads 128 bytes from streaming endpoint to clear any left over data.  If there is nothing to
//read from the streaming endpoint, then there will be a timeout delay.  This function is
//useful for stopping streaming and clearing it after a Comm buffer overflow.
int doFlush(HANDLE hDevice)
{
    uint8 recBuff[128];

    printf("Flushing stream and reading left over data.\n");
    StreamStop(hDevice);
    flushStream(hDevice);
    LJUSB_Stream(hDevice, recBuff, 128);

    return 0;
}
Пример #5
0
int main(int argc, char **argv)
{
  int socketFDA, socketFDB;
  ue9CalibrationInfo caliInfo;
  socketFDA = -1;
  socketFDB = -1;

  if(argc < 2)
  {
    printf("Please enter an ip address to connect to.\n");
    exit(0);
  }
  else if(argc > 2)
  {
    printf("Too many arguments.\nPlease enter only an ip address.\n");
    exit(0);
  }

  ipAddress = argv[1];

  if( (socketFDA = openTCPConnection(ipAddress, ue9_portA)) < 0)
    goto exit;

  doFlush(socketFDA);

  if( (socketFDB = openTCPConnection(ipAddress, ue9_portB)) < 0)
    goto close;

  if(getCalibrationInfo(socketFDA, &caliInfo) < 0)
    goto close;

  if(StreamConfig_example(socketFDA) != 0)
    goto close;

  if(StreamStart(socketFDA) != 0)
    goto close;

  StreamData_example(socketFDA, socketFDB, &caliInfo);
  StreamStop(socketFDA, 1);

close:
  if(closeTCPConnection(socketFDA) < 0)
    printf("Error: failed to close socket (portA)\n");
  if(closeTCPConnection(socketFDB) < 0)
    printf("Error: failed to close socket (portB)\n");
exit:
  return 0;
}
Пример #6
0
void CEXIMic::TransferByte(u8 &byte)
{
	if (m_position == 0)
	{
		command = byte;	// first byte is command
		byte = 0xFF;	// would be tristate, but we don't care.
		m_position++;
		return;
	}

	int pos = m_position - 1;

	switch (command)
	{
	case cmdID:
		byte = exi_id[pos];
		break;

	case cmdGetStatus:
		if (pos == 0)
			status.button = Pad::GetMicButton(slot);

		byte = status.U8[pos ^ 1];
		
		if (pos == 1)
			status.buff_ovrflw = 0;
		break;

	case cmdSetStatus:
		{
		bool wasactive = status.is_active;
		status.U8[pos ^ 1] = byte;

		// safe to do since these can only be entered if both bytes of status have been written
		if (!wasactive && status.is_active)
		{
			sample_rate = rate_base << status.sample_rate;
			buff_size = ring_base << status.buff_size;
			buff_size_samples = buff_size / sample_size;

			UpdateNextInterruptTicks();
			
			StreamStart();
		}
		else if (wasactive && !status.is_active)
		{
			StreamStop();
		}
		}
		break;

	case cmdGetBuffer:
		{
		if (ring_pos == 0)
			StreamReadOne();
		
		byte = ring_buffer[ring_pos ^ 1];
		ring_pos = (ring_pos + 1) % buff_size;
		}
		break;

	default:
		ERROR_LOG(EXPANSIONINTERFACE,  "EXI MIC: unknown command byte %02x", command);
		break;
	}

	m_position++;
}