NEW: Tox

2017-12-09 Thread MazoComp
Hi!

Tox is secure distributed messaging protocol with audio and video chat
capabilities.

The attached ports are:
 * net/toxcore  Tox client library
 * net/toxicAn ncurses-based Tox client

I have to warn you: don't compile the "sound" flavor, it depends on
openal which causes segmentation faults, but 1.16.0 version of openal
port doesn't cause segmentation faults, also openal doesn't support
sndio backend, so you won't be able to speak, but you'll be able to
listen.



tox.tar.gz
Description: application/tar-gz


Re: NEW: tox

2014-04-25 Thread Dmitrij D. Czarkoff
Dmitrij D. Czarkoff said:
> There is one issue to note: by default tox clients are initialized to
> IPv6 and enable dual IPv4/6 sockets to support both address types.
> OpenBSD doesn't support such sockets, so if IPv6 address is not
> available, toxic should be started with "-4" switch, or it will never
> connect.

Apparently I forgot about another caveat: toxic uses OpenAL for sound,
and it currently lacks record support with sndio backend.

The attached patch adds sound recording capabilities to audio/openal:


  $PORTSDIR/audio/openal/patches/patch-Alc_backends_sndio_c

$OpenBSD$
--- Alc/backends/sndio.c.orig   Tue Dec 11 21:35:55 2012
+++ Alc/backends/sndio.cTue Apr  8 09:52:30 2014
@@ -44,9 +44,11 @@ typedef struct {
 
 ALvoid *mix_data;
 ALsizei data_size;
+ALsizei frame_size;
 
 volatile int killNow;
 ALvoid *thread;
+unsigned int mode;
 } sndio_data;
 
 
@@ -54,19 +56,16 @@ static ALuint sndio_proc(ALvoid *ptr)
 {
 ALCdevice *device = ptr;
 sndio_data *data = device->ExtraData;
-ALsizei frameSize;
 size_t wrote;
 
 SetRTPriority();
 
-frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
-
 while(!data->killNow && device->Connected)
 {
 ALsizei len = data->data_size;
 ALubyte *WritePtr = data->mix_data;
 
-aluMixData(device, WritePtr, len/frameSize);
+aluMixData(device, WritePtr, len/data->frame_size);
 while(len > 0 && !data->killNow)
 {
 wrote = sio_write(data->sndHandle, WritePtr, len);
@@ -88,20 +87,18 @@ static ALuint sndio_proc(ALvoid *ptr)
 }
 
 
-
-static ALCenum sndio_open_playback(ALCdevice *device, const ALCchar 
*deviceName)
+static ALCenum sndio_open(ALCdevice *device, const ALCchar *deviceName, 
unsigned int mode)
 {
 sndio_data *data;
 
-if(!deviceName)
-deviceName = sndio_device;
-else if(strcmp(deviceName, sndio_device) != 0)
-return ALC_INVALID_VALUE;
+if(!deviceName || !strcmp(deviceName,sndio_device))
+deviceName = SIO_DEVANY;
 
 data = calloc(1, sizeof(*data));
 data->killNow = 0;
+data->mode = mode;
 
-data->sndHandle = sio_open(NULL, SIO_PLAY, 0);
+data->sndHandle = sio_open(deviceName, mode, 0);
 if(data->sndHandle == NULL)
 {
 free(data);
@@ -115,8 +112,19 @@ static ALCenum sndio_open_playback(ALCdevice *device, 
 return ALC_NO_ERROR;
 }
 
-static void sndio_close_playback(ALCdevice *device)
+static ALCenum sndio_open_playback(ALCdevice *device, const ALCchar 
*deviceName)
 {
+return sndio_open(device, deviceName, SIO_PLAY);
+}
+
+static ALCenum sndio_open_capture(ALCdevice *device, const ALCchar *deviceName)
+{
+return sndio_open(device, deviceName, SIO_REC);
+}
+
+
+static void sndio_close(ALCdevice *device)
+{
 sndio_data *data = device->ExtraData;
 
 sio_close(data->sndHandle);
@@ -124,16 +132,19 @@ static void sndio_close_playback(ALCdevice *device)
 device->ExtraData = NULL;
 }
 
-static ALCboolean sndio_reset_playback(ALCdevice *device)
+static ALCboolean sndio_reset(ALCdevice *device)
 {
 sndio_data *data = device->ExtraData;
 struct sio_par par;
+unsigned int *chan;
 
 sio_initpar(&par);
 
 par.rate = device->Frequency;
-par.pchan = ((device->FmtChans != DevFmtMono) ? 2 : 1);
 
+chan = (data->mode == SIO_PLAY) ? &(par.pchan) : &(par.rchan);
+*chan = ((device->FmtChans != DevFmtMono) ? 2 : 1);
+
 switch(device->FmtType)
 {
 case DevFmtByte:
@@ -181,7 +192,7 @@ static ALCboolean sndio_reset_playback(ALCdevice *devi
 }
 
 device->Frequency = par.rate;
-device->FmtChans = ((par.pchan==1) ? DevFmtMono : DevFmtStereo);
+device->FmtChans = ((*chan==1) ? DevFmtMono : DevFmtStereo);
 
 if(par.bits == 8 && par.sig == 1)
 device->FmtType = DevFmtByte;
@@ -209,19 +220,32 @@ static ALCboolean sndio_reset_playback(ALCdevice *devi
 return ALC_TRUE;
 }
 
-static ALCboolean sndio_start_playback(ALCdevice *device)
+static ALCboolean sndio_start(ALCdevice *device)
 {
 sndio_data *data = device->ExtraData;
 
+sndio_reset(device);
+
 if(!sio_start(data->sndHandle))
 {
 ERR("Error starting playback\n");
 return ALC_FALSE;
 }
 
-data->data_size = device->UpdateSize * 
FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
+data->frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
+data->data_size = device->UpdateSize * data->frame_size;
 data->mix_data = calloc(1, data->data_size);
 
+return ALC_TRUE;
+}
+
+static ALCboolean sndio_start_playback(ALCdevice *device)
+{
+sndio_data *data = device->ExtraData;
+
+if (sndio_start(device) == ALC_FALSE)
+return ALC_FALSE;
+
 data->thread = StartThread(sndio_proc, device);
 if(data->thread == NULL

NEW: tox

2014-04-24 Thread Dmitrij D. Czarkoff
Hello!

Tox is secure distributed messaging protocol with audio and video chat
capabilities.

The attached ports are:

 * net/toxcore-git  client library for the Tox protocol.
 * net/toxic-gitcurses-based client for the Tox protocol.

There is one issue to note: by default tox clients are initialized to
IPv6 and enable dual IPv4/6 sockets to support both address types.
OpenBSD doesn't support such sockets, so if IPv6 address is not
available, toxic should be started with "-4" switch, or it will never
connect.

-- 
Dmitrij D. Czarkoff


tox.tar.gz
Description: application/tar-gz