voice_set_device problems

Eric Plaster (plaster@imageman.com)
Thu, 03 Jun 1999 10:11:54 -0500



--------------909ED3C638EEEED842FC4CDB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Hello everyone!

I need some help with the libvoice stuff.  I'm righting a voicemail
frontend to vgetty and started using by just calling vm on the command
line.  Soon I realized that I could just use the libvoice the same way
that vm does.  So I got it work.  The problem now is that I need to do
the following in C:
    vm play -s /path/name.rmd        and
    vm record -m  /path/name.rmd

To do this I initialize the library like this:

 check_system();
 voice_config("vm", "");
 voice_register_event_handler(vm_voice_events);
 if (getenv("VOICE_PID") == NULL)
 {
  int tries = 0;

  while (((result = voice_open_device()) != OK) && ((++tries) <
      cvd.max_tries.d.i))
  {
   sleep(cvd.retry_delay.d.i);
  }

  if (result != OK)
  {
   printf("vmail: could not open a voice modem device\n");
   exit(FAIL);
  };

  voice_mode_on();

  if (voice_set_device(voice_device) != OK)
  {
   printf("%s: could not set voice device\n",
      program_name);
   exit(FAIL);
  };
 }
}

voice_device is set to INTERNAL_SPEAKER.
when I switch to EXTERNAL_MICROPHONE like this,

 int voice_device = EXTERNAL_MICROPHONE;
 if (voice_set_device(voice_device) != OK)
 {
  printf("%s: could not set voice device\n",
     program_name);
  exit(FAIL);
 };
 fprintf(stderr, "vmail: recording voice file %s\n", file);
 voice_record_file(file);

I get this error:
vm: Modem returned ERROR

How do I set the EXTERNAL_MICROPHONE so that I can record from the mic?

Also, how does the "voice_config("vm", "");" functino work?  I couldn't
get it to work until I put vm in there.

Is there any documentation on the libvoice out there?

--

Eric Plaster                    Image Manipulation Systems
Software Engineer               (612)753-5602 x117
plaster@imageman.com            www.imageman.com



--------------909ED3C638EEEED842FC4CDB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
&nbsp;
<BR>Hello everyone!
<P>I need some help with the libvoice stuff.&nbsp; I'm righting a voicemail
frontend to vgetty and started using by just calling vm on the command
line.&nbsp; Soon I realized that I could just use the libvoice the same
way that vm does.&nbsp; So I got it work.&nbsp; The problem now is that
I need to do the following in C:
<BR>&nbsp;&nbsp;&nbsp; vm play -s /path/name.rmd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
and
<BR>&nbsp;&nbsp;&nbsp; vm record -m&nbsp; /path/name.rmd
<P>To do this I initialize the library like this:
<P>&nbsp;check_system();
<BR>&nbsp;voice_config("vm", "");
<BR>&nbsp;voice_register_event_handler(vm_voice_events);
<BR>&nbsp;if (getenv("VOICE_PID") == NULL)
<BR>&nbsp;{
<BR>&nbsp; int tries = 0;
<P>&nbsp; while (((result = voice_open_device()) != OK) &amp;&amp; ((++tries)
&lt;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cvd.max_tries.d.i))
<BR>&nbsp; {
<BR>&nbsp;&nbsp; sleep(cvd.retry_delay.d.i);
<BR>&nbsp; }
<P>&nbsp; if (result != OK)
<BR>&nbsp; {
<BR>&nbsp;&nbsp; printf("vmail: could not open a voice modem device\n");
<BR>&nbsp;&nbsp; exit(FAIL);
<BR>&nbsp; };
<P>&nbsp; voice_mode_on();
<P>&nbsp; if (voice_set_device(voice_device) != OK)
<BR>&nbsp; {
<BR>&nbsp;&nbsp; printf("%s: could not set voice device\n",
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; program_name);
<BR>&nbsp;&nbsp; exit(FAIL);
<BR>&nbsp; };
<BR>&nbsp;}
<BR>}
<P>voice_device is set to INTERNAL_SPEAKER.
<BR>when I switch to EXTERNAL_MICROPHONE like this,
<P>&nbsp;int voice_device = EXTERNAL_MICROPHONE;
<BR>&nbsp;if (voice_set_device(voice_device) != OK)
<BR>&nbsp;{
<BR>&nbsp; printf("%s: could not set voice device\n",
<BR>&nbsp;&nbsp;&nbsp;&nbsp; program_name);
<BR>&nbsp; exit(FAIL);
<BR>&nbsp;};
<BR>&nbsp;fprintf(stderr, "vmail: recording voice file %s\n", file);
<BR>&nbsp;voice_record_file(file);
<P>I get this error:
<BR>vm: Modem returned ERROR
<P>How do I set the EXTERNAL_MICROPHONE so that I can record from the mic?
<P>Also, how does the "voice_config("vm", "");" functino work?&nbsp; I
couldn't get it to work until I put vm in there.
<P>Is there any documentation on the libvoice out there?
<PRE>--&nbsp;

Eric Plaster&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Image Manipulation Systems
Software Engineer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (612)753-5602 x117
plaster@imageman.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www.imageman.com</PRE>
&nbsp;</HTML>

--------------909ED3C638EEEED842FC4CDB--