Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Jamulus.pro
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ win32 {

!exists(/usr/include/jack/jack.h) {
!exists(/usr/local/include/jack/jack.h) {
message(Warning: jack.h was not found at the usual place, maybe the jack dev packet is missing)
message("Warning: jack.h was not found at the usual place, maybe the jack dev packet is missing")
}
}

Expand All @@ -123,9 +123,6 @@ win32 {
LIBS += -ljack
}

# enable to following line to support compilation on the Raspberry Pi
#LIBS += -lrt

# Linux is our source distribution, include sources from other OSs
DISTFILES += mac/sound.h \
mac/sound.cpp \
Expand Down Expand Up @@ -170,7 +167,10 @@ HEADERS += src/audiomixerboard.h \
src/soundbase.h \
src/testbench.h \
src/util.h \
src/analyzerconsole.h
src/analyzerconsole.h \
src/recorder/jamrecorder.h \
src/recorder/creaperproject.h \
src/recorder/cwavestream.h

HEADERS_OPUS = libs/opus/include/opus.h \
libs/opus/include/opus_multistream.h \
Expand Down Expand Up @@ -264,7 +264,10 @@ SOURCES += src/audiomixerboard.cpp \
src/socket.cpp \
src/soundbase.cpp \
src/util.cpp \
src/analyzerconsole.cpp
src/analyzerconsole.cpp \
src/recorder/jamrecorder.cpp \
src/recorder/creaperproject.cpp \
src/recorder/cwavestream.cpp

SOURCES_OPUS = libs/opus/src/opus.c \
libs/opus/src/opus_decoder.c \
Expand Down
2 changes: 2 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ source:

- Some pixmaps are from the Open Clip Art Library (OCAL):
http://openclipart.org

- Server wave recording, coded by pljones
3 changes: 3 additions & 0 deletions src/chatdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public slots:
void OnLocalInputTextTextChanged ( const QString& strNewText );
void OnClearPressed();

void keyPressEvent ( QKeyEvent *e ) // block escape key
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }

signals:
void NewLocalInputText ( QString strNewText );
};
9 changes: 7 additions & 2 deletions src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class CClientDlg : public QDialog, private Ui_CClientDlgBase
const QString& strConnOnStartupAddress,
const bool bNewShowComplRegConnList,
const bool bShowAnalyzerConsole,
QWidget* parent = 0,
Qt::WindowFlags f = 0 );
QWidget* parent = nullptr,
Qt::WindowFlags f = nullptr );

protected:
void SetGUIDesign ( const EGUIDesign eNewDesign );
Expand Down Expand Up @@ -205,4 +205,9 @@ public slots:
void OnAudioChannelsChanged() { UpdateRevSelection(); }
void OnNumClientsChanged ( int iNewNumClients );
void OnNewClientLevelChanged() { MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel; }

void accept() { close(); } // introduced by pljones

void keyPressEvent ( QKeyEvent *e ) // block escape key
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
};
4 changes: 4 additions & 0 deletions src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ LED bar: lbr
#if !defined ( GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_ )
#define GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_

#if _WIN32
# define _CRT_SECURE_NO_WARNINGS
#endif

#include <QString>
#include <QEvent>
#include <QDebug>
Expand Down
60 changes: 40 additions & 20 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,16 @@
#include "serverdlg.h"
#include "settings.h"
#include "testbench.h"
#include "util.h"


// Implementation **************************************************************

int main ( int argc, char** argv )
{
#ifdef _WIN32
// no console on windows -> just write in string and dump it
QString strDummySink;
QTextStream tsConsole ( &strDummySink );
#else
QTextStream tsConsole ( stdout );
#endif
QString strArgument;
double rDbleArgument;
QTextStream& tsConsole = *( ( new ConsoleWriterFactory() )->get() );
QString strArgument;
double rDbleArgument;

// initialize all flags and string which might be changed by command line
// arguments
Expand All @@ -66,6 +61,7 @@ int main ( int argc, char** argv )
QString strServerName = "";
QString strLoggingFileName = "";
QString strHistoryFileName = "";
QString strRecordingDirName = "";
QString strCentralServer = "";
QString strServerInfo = "";
QString strWelcomeMessage = "";
Expand Down Expand Up @@ -292,6 +288,21 @@ int main ( int argc, char** argv )
}


// Recording directory -------------------------------------------------
if ( GetStringArgument ( tsConsole,
argc,
argv,
i,
"-R",
"--recordingdirectory",
strArgument ) )
{
strRecordingDirName = strArgument;
tsConsole << "- recording directory name: " << strRecordingDirName << endl;
continue;
}


// Central server ------------------------------------------------------
if ( GetStringArgument ( tsConsole,
argc,
Expand Down Expand Up @@ -402,7 +413,14 @@ int main ( int argc, char** argv )

// Application/GUI setup ---------------------------------------------------
// Application object
QApplication app ( argc, argv, bUseGUI );
if ( !bUseGUI && !strHistoryFileName.isEmpty() )
{
tsConsole << "Qt5 requires a windowing system to paint a JPEG image; disabling history graph" << endl;
strHistoryFileName = "";
}
QCoreApplication* pApp = bUseGUI
? new QApplication ( argc, argv )
: new QCoreApplication ( argc, argv );

#ifdef _WIN32
// set application priority class -> high priority
Expand All @@ -412,7 +430,7 @@ int main ( int argc, char** argv )
// be located in the install directory of the software by the installer.
// Here, we set the path to our application path.
QDir ApplDir ( QApplication::applicationDirPath() );
app.addLibraryPath ( QString ( ApplDir.absolutePath() ) );
pApp->addLibraryPath ( QString ( ApplDir.absolutePath() ) );
#endif

// init resources
Expand Down Expand Up @@ -445,19 +463,19 @@ int main ( int argc, char** argv )
strConnOnStartupAddress,
bShowComplRegConnList,
bShowAnalyzerConsole,
0,
nullptr,
Qt::Window );

// show dialog
ClientDlg.show();
app.exec();
pApp->exec();
}
else
{
// only start application without using the GUI
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl;

app.exec();
pApp->exec();
}
}
else
Expand All @@ -473,10 +491,10 @@ int main ( int argc, char** argv )
strCentralServer,
strServerInfo,
strWelcomeMessage,
strRecordingDirName,
bCentServPingServerInList,
bDisconnectAllClients,
eLicenceType );

if ( bUseGUI )
{
// special case for the GUI mode: as the default we want to use
Expand All @@ -496,7 +514,7 @@ int main ( int argc, char** argv )
CServerDlg ServerDlg ( &Server,
&Settings,
bStartMinimized,
0,
nullptr,
Qt::Window );

// show dialog (if not the minimized flag is set)
Expand All @@ -505,7 +523,7 @@ int main ( int argc, char** argv )
ServerDlg.show();
}

app.exec();
pApp->exec();
}
else
{
Expand All @@ -515,7 +533,7 @@ int main ( int argc, char** argv )
// only start application without using the GUI
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl;

app.exec();
pApp->exec();
}
}
}
Expand All @@ -525,11 +543,11 @@ int main ( int argc, char** argv )
// show generic error
if ( bUseGUI )
{
QMessageBox::critical ( 0,
QMessageBox::critical ( nullptr,
APP_NAME,
generr.GetErrorText(),
"Quit",
0 );
nullptr );
}
else
{
Expand Down Expand Up @@ -571,6 +589,8 @@ QString UsageArguments ( char **argv )
" [server1 country as QLocale ID]; ...\n"
" [server2 address]; ... (server only)\n"
" -p, --port local port number (server only)\n"
" -R, --recording enables recording and sets directory to contain\n"
" recorded jams (server only)\n"
" -s, --server start server\n"
" -u, --numchannels maximum number of channels (server only)\n"
" -w, --welcomemessage welcome message on connect (server only)\n"
Expand Down
130 changes: 130 additions & 0 deletions src/recorder/creaperproject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/******************************************************************************\
*
* Author(s):
* pljones
*
******************************************************************************
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\******************************************************************************/

#include "creaperproject.h"

/**
* @brief operator << Write details of the STrackItem to the QTextStream
* @param os the QTextStream
* @param trackItem the STrackItem
* @return the QTextStream
*
* Note: unused?
*/
QTextStream& operator<<(QTextStream& os, const recorder::STrackItem& trackItem)
{
os << "_track( "
<< "numAudioChannels(" << trackItem.numAudioChannels << ")"
<< ", startFrame(" << trackItem.startFrame << ")"
<< ", frameCount(" << trackItem.frameCount << ")"
<< ", fileName(" << trackItem.fileName << ")"
<< " );";
return os;
}

/******************************************************************************\
* recorder methods *
\******************************************************************************/
using namespace recorder;

// Reaper Project writer -------------------------------------------------------

/**
* @brief CReaperItem::CReaperItem Construct a Reaper RPP "<ITEM>" for a given RIFF WAVE file
* @param name the item name
* @param trackItem the details of where the item is in the track, along with the RIFF WAVE filename
* @param iid the sequential item id
*/
CReaperItem::CReaperItem(const QString& name, const STrackItem& trackItem, const qint32& iid)
{
QString wavName = trackItem.fileName; // assume RPP in same location...

QTextStream sOut(&out);

sOut << " <ITEM " << endl;
sOut << " FADEIN 0 0 0 0 0 0" << endl;
sOut << " FADEOUT 0 0 0 0 0 0" << endl;
sOut << " POSITION " << secondsAt48K(trackItem.startFrame) << endl;
sOut << " LENGTH " << secondsAt48K(trackItem.frameCount) << endl;
sOut << " IGUID " << iguid.toString() << endl;
sOut << " IID " << iid << endl;
sOut << " NAME " << name << endl;
sOut << " GUID " << guid.toString() << endl;

sOut << " <SOURCE WAVE" << endl;
sOut << " FILE " << '"' << wavName << '"' << endl;
sOut << " >" << endl;

sOut << " >";

sOut.flush();
}

/**
* @brief CReaperTrack::CReaperTrack Construct a Reaper RPP "<TRACK>" for a given list of track items
* @param name the track name
* @param iid the sequential track id
* @param items the list of items in the track
*/
CReaperTrack::CReaperTrack(QString name, qint32& iid, QList<STrackItem> items)
{
QTextStream sOut(&out);

sOut << " <TRACK " << trackId.toString() << endl;
sOut << " NAME " << name << endl;
sOut << " TRACKID " << trackId.toString() << endl;

int ino = 1;
foreach (auto item, items) {
sOut << CReaperItem(name + " (" + QString::number(ino) + ")", item, iid).toString() << endl;
ino++;
iid++;
}
sOut << " >";

sOut.flush();
}

/**
* @brief CReaperProject::CReaperProject Construct a Reaper RPP "<REAPER_PROJECT>" for a given list of tracks
* @param tracks the list of tracks
*/
CReaperProject::CReaperProject(QMap<QString, QList<STrackItem>> tracks)
{
QTextStream sOut(&out);

sOut << "<REAPER_PROJECT 0.1 \"5.0\" 1551567848" << endl;
sOut << " RECORD_PATH \"\" \"\"" << endl;
sOut << " SAMPLERATE 48000 0 0" << endl;
sOut << " TEMPO 120 4 4" << endl;

qint32 iid = 0;
foreach(auto trackName, tracks.keys())
{
sOut << CReaperTrack(trackName, iid, tracks[trackName]).toString() << endl;
}

sOut << ">";

sOut.flush();
}
Loading