예제 #1
0
int main (int argc, char* argv[]) {
  jack_client_t* client;
  char const default_name[] = "connector";

  // this is moderately retarded
  aliases[0] = (char *) malloc (jack_port_name_size());
  aliases[1] = (char *) malloc (jack_port_name_size());

  client = jack_client_open(default_name, JackNullOption, NULL);

  while (1) {
    const char **portnames;
    const char **orig;
    orig = portnames = jack_get_ports(client, "", "", 0);

    desired_connection *desired = desired_connections;
    while (desired->from_port) {
      ensure_connected(client, orig, desired);
      desired++;
    }
    printf("\n");
    sleep(5);
    jack_free(orig);
  }
}
//---------------------------------------------------------------------------------------
// Sends a command in datum form to the remote IDE
// 
// #Params
//   datum: command in datum form from a cmd_*() method
//   
// #Modifiers: virtual
// #Author(s): Conan Reis
void SkUERemote::on_cmd_send(const ADatum & datum)
  {
  if (is_connected())
    {
    int32 bytes_sent = 0;

    // $Note - CReis Assumes that Send() is able to transfer entire datum in 1 pass.
    m_socket_p->Send(datum.get_buffer(), datum.get_length(), bytes_sent);

    // Did sending go wrong?
    if (bytes_sent <= 0)
      {
      // Reconnect
      set_mode(SkLocale_embedded);
      ensure_connected(5.0);

      // Try again
      if (m_socket_p)
        {
        m_socket_p->Send(datum.get_buffer(), datum.get_length(), bytes_sent);
        }
      }
    }
  else
    {
    SkDebug::print(
      "SkookumScript: Remote IDE is not connected - command ignored!\n"
      "[Connect runtime to Skookum IDE and try again.]\n",
      SkLocale_local,
      SkDPrintType_warning);
    }
  }