Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TPF
jacktrip
Commits
2f4d247b
Commit
2f4d247b
authored
Jun 18, 2008
by
jcaceres
Browse files
merged with trunk -r114
parent
a9c1bac4
Changes
30
Hide whitespace changes
Inline
Side-by-side
src/
a
udioDevice.cpp
→
src/
A
udioDevice.cpp
View file @
2f4d247b
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
* audioDevice.cpp
* audioDevice.cpp
*/
*/
#include
"
a
udioDevice.h"
#include
"
A
udioDevice.h"
#include
<time
.h
>
#include
<
c
time>
using
namespace
std
;
using
namespace
std
;
AudioDevice
::
AudioDevice
(
bool
testMode
)
AudioDevice
::
AudioDevice
(
bool
testMode
)
...
...
src/
a
udioDevice.h
→
src/
A
udioDevice.h
View file @
2f4d247b
...
@@ -35,12 +35,12 @@
...
@@ -35,12 +35,12 @@
#define _AUDIO_DEVICE_H
#define _AUDIO_DEVICE_H
#include
<iostream>
#include
<iostream>
#include
<stdlib
.h
>
#include
<
c
stdlib>
#include
<math
.h
>
#include
<
c
math>
#include
"audioInfo.h"
#include
"audioInfo.h"
#include
"JackClient.h"
#include
"JackClient.h"
#include
"qt
hread
.h"
#include
<QT
hread
>
#include
"
StreamBD
.h"
#include
"
JackTrip
.h"
#include
<QWaitCondition>
#include
<QWaitCondition>
#include
<QSemaphore>
#include
<QSemaphore>
...
...
src/
a
udio
_i
nput.cpp
→
src/
A
udio
I
nput.cpp
View file @
2f4d247b
...
@@ -35,14 +35,14 @@
...
@@ -35,14 +35,14 @@
*
*
*/
*/
#include
"
a
udio
_i
nput.h"
#include
"
A
udio
I
nput.h"
#include
"
s
tream.h"
#include
"
S
tream.h"
#include
<iostream>
#include
<iostream>
using
namespace
std
;
using
namespace
std
;
AudioInput
::
AudioInput
(
AudioDevice
*
audioDevice
,
AudioInfoT
audioInfo
)
:
AudioInput
::
AudioInput
(
AudioDevice
*
audioDevice
,
AudioInfoT
audioInfo
)
:
InputPlugin
(
"Audio Input Plugin"
),
Input
Stream
Plugin
(
"Audio Input
Stream
Plugin"
),
audioDevice
(
audioDevice
),
audioInfo
(
audioInfo
)
audioDevice
(
audioDevice
),
audioInfo
(
audioInfo
)
{
{
dontRun
=
audioInfo
->
jack
;
dontRun
=
audioInfo
->
jack
;
...
...
src/
a
udio
_i
nput.h
→
src/
A
udio
I
nput.h
View file @
2f4d247b
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
#ifndef _AUDIO_INPUT_H
#ifndef _AUDIO_INPUT_H
#define _AUDIO_INPUT_H
#define _AUDIO_INPUT_H
#include
"
i
nput
_p
lugin.h"
#include
"
I
nput
StreamP
lugin.h"
#include
"
a
udioDevice.h"
#include
"
A
udioDevice.h"
#include
"audioInfo.h"
#include
"audioInfo.h"
/**
/**
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
* on a Stream.
* on a Stream.
*/
*/
class
AudioInput
:
public
InputPlugin
class
AudioInput
:
public
Input
Stream
Plugin
{
{
private:
private:
AudioDevice
*
audioDevice
;
AudioDevice
*
audioDevice
;
...
...
src/
a
udio
_o
utput.cpp
→
src/
A
udio
O
utput.cpp
View file @
2f4d247b
...
@@ -31,16 +31,16 @@
...
@@ -31,16 +31,16 @@
* audio_output.cpp
* audio_output.cpp
*/
*/
#include
"
a
udio
_o
utput.h"
#include
"
A
udio
O
utput.h"
#include
"
s
tream.h"
#include
"
S
tream.h"
//#include "ambisonics/ambisonicsdecoder.h"
//#include "ambisonics/ambisonicsdecoder.h"
#include
<string
.h
>
#include
<
c
string>
#include
<iostream>
#include
<iostream>
using
namespace
std
;
using
namespace
std
;
AudioOutput
::
AudioOutput
(
AudioDevice
*
audioDevice
,
AudioInfoT
audioInfo
)
:
AudioOutput
::
AudioOutput
(
AudioDevice
*
audioDevice
,
AudioInfoT
audioInfo
)
:
OutputPlugin
(
"Audio Output plugin"
),
Output
Stream
Plugin
(
"Audio Output plugin"
),
audioDevice
(
audioDevice
),
audioInfo
(
audioInfo
),
decoder
(
NULL
)
audioDevice
(
audioDevice
),
audioInfo
(
audioInfo
),
decoder
(
NULL
)
{
{
dontRun
=
audioInfo
->
jack
;
dontRun
=
audioInfo
->
jack
;
...
...
src/
a
udio
_o
utput.h
→
src/
A
udio
O
utput.h
View file @
2f4d247b
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
#ifndef _AUDIO_OUTPUT_H
#ifndef _AUDIO_OUTPUT_H
#define _AUDIO_OUTPUT_H
#define _AUDIO_OUTPUT_H
#include
"
o
utput
_p
lugin.h"
#include
"
O
utput
StreamP
lugin.h"
#include
"
a
udioDevice.h"
#include
"
A
udioDevice.h"
#include
"audioInfo.h"
#include
"audioInfo.h"
class
AmbisonicsDecoder
;
class
AmbisonicsDecoder
;
...
@@ -44,7 +44,7 @@ class AmbisonicsDecoder;
...
@@ -44,7 +44,7 @@ class AmbisonicsDecoder;
* @brief Sends audio buffers from a Stream to the RtAudio (sound) device.
* @brief Sends audio buffers from a Stream to the RtAudio (sound) device.
*/
*/
class
AudioOutput
:
public
OutputPlugin
class
AudioOutput
:
public
Output
Stream
Plugin
{
{
private:
private:
AudioDevice
*
audioDevice
;
AudioDevice
*
audioDevice
;
...
...
src/Documentation.h
deleted
100644 → 0
View file @
a9c1bac4
/*! \mainpage StreamBD Documentation
*
*
* Download streamBD <a
href="http://www-ccrma.stanford.edu/groups/soundwire/software/newstream/newstream1_0b.tar.gz">here</a>.
* \n
* View installation and run <a href="INSTRUCTIONS.TXT">instructions</a>.
* \n
* If you encounter CommonC++ errors (compile-time errors that begin cc_ )
* Download CommonC++1.5.0 (http://cplusplus.sourceforge.net) from here:
* <a
href="http://www-ccrma.stanford.edu/groups/soundwire/software/newstream/commomc++-1.5.0.tar>http://www-ccrma.stanford.edu/groups/soundwire/software/newstream/commonc++-1.5.0.tar</a>.
* \n
*\section intro Introduction
*
* StreamBD provides low-latency uncompressed audio streaming over high quality networks.
* It can be used to route audio streams across a high quality network, or to use the network
* connection as the delay line in a simple string synthesis to "pluck" the network, and generate
* a multi-channel network harp as described in our ICASSP2002 <a href="http://www-ccrma.stanford.edu/%7Ecc/soundwire/icassp02.pdf">paper</a>.
*
* As an audio stream router it consists of the following four nodes:
* \n\n
* audioin, audioout, netin, netout.
* \n\n
* Streambd can be run in any of the following modes to achieve any
* possible connection of input to output.
* \n\n
* <B>Transmit</B>\n
* Run with a remote hostname, this mode establishes a
* connection to a remote host running in RECEIVE mode. It
* patches audio in exactly the same way RECEIVE does:
* audioin to netout, netin to audioout. Use one machine in
* TRANSMIT mode and one machine in RECEIVE mode to establish
* a bidirectional connection.
* \n\n
* <B>Receive</B>\n
* Listen for a connection from another machine running in
* TRANSMIT mode. When contacted, patch audioin to netout and
* netin to audioout. Use one machine in RECEIVE mode and one
* machine in TRANSMIT mode to establish a bidirectional
* connection.
* \n\n
* <B>Netmirror</B>\n
* Patch netin to netout. Do not create audioin or audioout.
* (No audio interface is needed.) The input stream from the
* network is streamed straight to the network output. When run
* the program listens for a connection. When contacted by
* another machine running in TRANSMIT mode, it establishes a
* return connection. Use this mode to test your connection to
* a remote machine.
* \n\n
* <B>Sndmirror</B> \n
* Patch audioin to audioout. Do not create netin or netout.
* (No network interface is needed.) All sound input is streamed
* straight to the sound output. Use this mode to test audio
* hardware.
* \n\n
* <B>HarpT</B>\n
* Run with a hostname, this mode connects to a HARPR receiver
* machine, and adds STK low pass filtering or delay (to
* "tune" the different strings of the Netharp). Coefficients
* for the STK processes are specified at the command line (off
* by default).
* \n\n
* <B>HarpR</B>\n
* Connected to by a HARPT. Can also apply processes so that
* synthesis CPU requirements can be shared between the
* two machines (low-pass filtering on one, delay on the other.)
* \n\n
* Questions or comments: Daniel Walling (<a href="mailto:dwalling@ccrma.stanford.edu">dwalling@ccrma.stanford.edu</a>).
*/
/**********************************************************************
* File: streambd.h
**********************************************************************
* A project of the SoundWIRE research group at CCRMA
* http://www-ccrma.stanford.edu/groups/soundwire/
* --------------------------------------------------------------------
* Coded by Daniel Walling (dwalling@ccrma.stanford.edu)
* Based on Scott Wilson's streambd code (rswilson@ccrma.stanford.edu)
* --------------------------------------------------------------------
*/
#ifndef _STREAM_BD_H
#define _STREAM_BD_H
#endif
src/
i
nput
_p
lugin.h
→
src/
I
nput
StreamP
lugin.h
View file @
2f4d247b
...
@@ -36,18 +36,18 @@
...
@@ -36,18 +36,18 @@
#ifndef _INPUT_PLUGIN_H
#ifndef _INPUT_PLUGIN_H
#define _INPUT_PLUGIN_H
#define _INPUT_PLUGIN_H
#include
"
p
lugin.h"
#include
"
StreamP
lugin.h"
class
Stream
;
class
Stream
;
class
InputPlugin
:
public
Plugin
class
Input
Stream
Plugin
:
public
Stream
Plugin
{
{
protected:
protected:
int
key
;
int
key
;
Stream
*
stream
;
Stream
*
stream
;
public:
public:
InputPlugin
(
const
char
*
name
)
:
key
(
-
1
)
Input
Stream
Plugin
(
const
char
*
name
)
:
key
(
-
1
)
{
{
this
->
setName
(
name
);
this
->
setName
(
name
);
this
->
dontRun
=
false
;
this
->
dontRun
=
false
;
...
...
src/JackClient.cpp
View file @
2f4d247b
...
@@ -32,9 +32,9 @@
...
@@ -32,9 +32,9 @@
*/
*/
#include
"JackClient.h"
#include
"JackClient.h"
#include
"
math
.h"
#include
<c
math
>
#include
"
string
.h"
#include
<c
string
>
#include
"
a
udioDevice.h"
#include
"
A
udioDevice.h"
//#include "qstring.h"
//#include "qstring.h"
#include
<QString>
#include
<QString>
//#include <q3textstream.h>
//#include <q3textstream.h>
...
...
src/JackClient.h
View file @
2f4d247b
...
@@ -36,9 +36,9 @@
...
@@ -36,9 +36,9 @@
#define _JACKCLIENT_H_
#define _JACKCLIENT_H_
#include
<jack/jack.h>
#include
<jack/jack.h>
#include
"
stdio
.h"
#include
<c
stdio
>
#include
"
stdlib
.h"
#include
<c
stdlib
>
#include
<
qs
tring
.h
>
#include
<
QS
tring>
class
AudioDevice
;
class
AudioDevice
;
class
JackClient
//:public Stk
class
JackClient
//:public Stk
...
...
src/
StreamBD
.cpp
→
src/
JackTrip
.cpp
View file @
2f4d247b
...
@@ -28,20 +28,23 @@
...
@@ -28,20 +28,23 @@
*/
*/
/*
/*
*
StreamBD
.cpp
*
JackTrip
.cpp
*/
*/
//#include "
StreamBD
.h"
//#include "
JackTrip
.h"
#include
"
a
udioDevice.h"
#include
"
A
udioDevice.h"
using
namespace
std
;
using
namespace
std
;
extern
QString
*
extern
QString
*
IPv4Addr
(
char
*
namebuf
);
IPv4Addr
(
char
*
namebuf
);
/**
* @brief return fifo priority for streambd.
//---------------------------------------------------------------------------------------------
/*! \brief Returns fifo priority for streambd.
*
*/
*/
//---------------------------------------------------------------------------------------------
int
int
get_fifo_priority
(
bool
half
)
get_fifo_priority
(
bool
half
)
{
{
...
@@ -52,13 +55,16 @@ get_fifo_priority (bool half)
...
@@ -52,13 +55,16 @@ get_fifo_priority (bool half)
if
(
half
)
priority
=
(
max
-
(
max
-
min
)
/
2
);
if
(
half
)
priority
=
(
max
-
(
max
-
min
)
/
2
);
else
else
priority
=
max
;
priority
=
max
;
//
priority=min;
//priority=min;
return
priority
;
return
priority
;
}
}
/**
* @brief Set fifo priority (if user has sufficient privileges).
//---------------------------------------------------------------------------------------------
/*! \brief Set fifo priority (if user has sufficient privileges).
*
*/
*/
//---------------------------------------------------------------------------------------------
int
int
set_fifo_priority
(
bool
half
)
set_fifo_priority
(
bool
half
)
{
{
...
@@ -94,20 +100,33 @@ set_fifo_priority (bool half)
...
@@ -94,20 +100,33 @@ set_fifo_priority (bool half)
}
}
StreamBD
::
StreamBD
()
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
JackTrip
::
JackTrip
()
{
{
args
=
new
cmdLineArgs
;
args
=
new
cmdLineArgs
;
}
}
StreamBD
::~
StreamBD
()
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
JackTrip
::~
JackTrip
()
{
{
// TODO: put destructor code here
// TODO: put destructor code here
}
}
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
int
int
StreamBD
::
cmd
(
MainDialog
*
eventThread
)
JackTrip
::
cmd
(
MainDialog
*
eventThread
)
{
{
// Get the local host address
// Get the local host address
QString
*
localhostName
=
GetLocalHostName
();
QString
*
localhostName
=
GetLocalHostName
();
...
@@ -170,7 +189,7 @@ StreamBD::cmd (MainDialog *eventThread)
...
@@ -170,7 +189,7 @@ StreamBD::cmd (MainDialog *eventThread)
t
.
netin
=
new
UDPInput
(
netInfo
,
audioInfo
);
t
.
netin
=
new
UDPInput
(
netInfo
,
audioInfo
);
t
.
netout
=
new
UDPOutput
(
netInfo
,
audioInfo
);
t
.
netout
=
new
UDPOutput
(
netInfo
,
audioInfo
);
ConnectPlugins
(
t
.
netin
,
t
.
netout
,
t
.
streamout
);
Connect
Stream
Plugins
(
t
.
netin
,
t
.
netout
,
t
.
streamout
);
break
;
break
;
//remove STK dependency
//remove STK dependency
...
@@ -182,7 +201,7 @@ StreamBD::cmd (MainDialog *eventThread)
...
@@ -182,7 +201,7 @@ StreamBD::cmd (MainDialog *eventThread)
addSTKProcesses (t.streamin);
addSTKProcesses (t.streamin);
ConnectPlugins (t.netin, t.netout, t.streamin);
Connect
Stream
Plugins (t.netin, t.netout, t.streamin);
audioDevice = new AudioDevice (args->audioDeviceID,
audioDevice = new AudioDevice (args->audioDeviceID,
args->
args->
...
@@ -192,7 +211,7 @@ StreamBD::cmd (MainDialog *eventThread)
...
@@ -192,7 +211,7 @@ StreamBD::cmd (MainDialog *eventThread)
t.audioout = new AudioOutput (audioDevice, audioInfo);
t.audioout = new AudioOutput (audioDevice, audioInfo);
addPlugin (t.audioout, t.streamin);
add
Stream
Plugin (t.audioout, t.streamin);
// Synchronize network packet transfers to audio device tick rate.
// Synchronize network packet transfers to audio device tick rate.
t.streamin->synchronizeOutputsTo (t.audioout);
t.streamin->synchronizeOutputsTo (t.audioout);
...
@@ -206,7 +225,7 @@ StreamBD::cmd (MainDialog *eventThread)
...
@@ -206,7 +225,7 @@ StreamBD::cmd (MainDialog *eventThread)
addSTKProcesses (t.streamout);
addSTKProcesses (t.streamout);
ConnectPlugins (t.netin, t.netout, t.streamout);
Connect
Stream
Plugins (t.netin, t.netout, t.streamout);
break;
break;
*/
*/
...
@@ -221,7 +240,7 @@ StreamBD::cmd (MainDialog *eventThread)
...
@@ -221,7 +240,7 @@ StreamBD::cmd (MainDialog *eventThread)
t
.
audioin
=
new
AudioInput
(
audioDevice
,
audioInfo
);
t
.
audioin
=
new
AudioInput
(
audioDevice
,
audioInfo
);
t
.
audioout
=
new
AudioOutput
(
audioDevice
,
audioInfo
);
t
.
audioout
=
new
AudioOutput
(
audioDevice
,
audioInfo
);
ConnectPlugins
(
t
.
audioin
,
t
.
audioout
,
t
.
streamout
);
Connect
Stream
Plugins
(
t
.
audioin
,
t
.
audioout
,
t
.
streamout
);
break
;
break
;
default:
default:
...
@@ -237,12 +256,12 @@ StreamBD::cmd (MainDialog *eventThread)
...
@@ -237,12 +256,12 @@ StreamBD::cmd (MainDialog *eventThread)
audioDevice
->
setThreads
(
t
);
audioDevice
->
setThreads
(
t
);
t
.
netin
=
new
UDPInput
(
netInfo
,
audioInfo
);
t
.
netin
=
new
UDPInput
(
netInfo
,
audioInfo
);
t
.
netin
->
setGUI
((
QObject
*
)
eventThread
);
//
t.netin->setGUI((QObject *)eventThread);
t
.
netout
=
new
UDPOutput
(
netInfo
,
audioInfo
);
t
.
netout
=
new
UDPOutput
(
netInfo
,
audioInfo
);
t
.
netout
->
setGUI
((
QObject
*
)
eventThread
);
//
t.netout->setGUI((QObject *)eventThread);
ConnectPlugins
(
t
.
audioin
,
t
.
netout
,
t
.
streamout
);
Connect
Stream
Plugins
(
t
.
audioin
,
t
.
netout
,
t
.
streamout
);
ConnectPlugins
(
t
.
netin
,
t
.
audioout
,
t
.
streamin
);
Connect
Stream
Plugins
(
t
.
netin
,
t
.
audioout
,
t
.
streamin
);
}
}
...
@@ -283,13 +302,22 @@ StreamBD::cmd (MainDialog *eventThread)
...
@@ -283,13 +302,22 @@ StreamBD::cmd (MainDialog *eventThread)
}
}
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
void
void
StreamBD
::
start
()
JackTrip
::
start
()
{
{
}
}
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
void
void
StreamBD
::
finish
()
JackTrip
::
finish
()
{
{
cout
<<
"Finishing"
<<
endl
;
cout
<<
"Finishing"
<<
endl
;
if
(
args
->
jack
)
if
(
args
->
jack
)
...
@@ -302,36 +330,52 @@ StreamBD::finish ()
...
@@ -302,36 +330,52 @@ StreamBD::finish ()
cout
<<
"stopped streamout threads"
<<
endl
;
cout
<<
"stopped streamout threads"
<<
endl
;
}
}
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
void
void
StreamBD
::
go
()
JackTrip
::
go
()
/* cause run loop to start */
/* cause run loop to start */
{
{
start
();
start
();
}
}
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
void
void
StreamBD
::
stop
()
JackTrip
::
stop
()
/* cause run loop to finish */
/* cause run loop to finish */
{
{
// loop = false; not a thread
// loop = false; not a thread
finish
();
finish
();
}
}
//---------------------------------------------------------------------------------------------
/*! \brief
*/
//---------------------------------------------------------------------------------------------
void
void
StreamBD
::
join
()
JackTrip
::
join
()
/* wait for thread to exit */
/* wait for thread to exit */
{
{
// wait (); not a thread
// wait (); not a thread
}
}
//---------------------------------------------------------------------------------------------
/* PrintUsage(
struct cmdLineArgs *args
)
/*
! \brief
PrintUsage()
*
------------------------------------
*
* Print all of the command line arguments and their default values
* Print all of the command line arguments and their default values
*/
*/
//---------------------------------------------------------------------------------------------
void
void
StreamBD
::
PrintUsage
()
JackTrip
::
PrintUsage
()
{
{
cout
<<
"==========================================================================="
<<
endl
;
cout
<<
"==========================================================================="
<<
endl
;
cout
<<
" jacktrip A project of the SoundWIRE group at CCRMA, Stanford."
<<
endl
;
cout
<<
" jacktrip A project of the SoundWIRE group at CCRMA, Stanford."
<<
endl
;
...
@@ -373,14 +417,16 @@ StreamBD::PrintUsage ()
...
@@ -373,14 +417,16 @@ StreamBD::PrintUsage ()
endl
;
endl
;