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
2 changes: 1 addition & 1 deletion src/libprojectM/FileScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void FileScanner::scanPosix(ScanCallback cb) {
fileSystem = fts_open(dirList, FTS_LOGICAL|FTS_NOCHDIR|FTS_NOSTAT, &fts_compare);
if (fileSystem == NULL) {
std::string s;
for (int i = 0; i < _rootDirs.size(); i++)
for (std::size_t i = 0; i < _rootDirs.size(); i++)
s += _rootDirs[i] + ' ';
handleDirectoryError(s);

Expand Down
2 changes: 1 addition & 1 deletion src/libprojectM/KeyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode
if (isTextInputActive()) break; // don't handle this key if search menu is up.
if (renderer->showmenu) {
int downPreset = m_presetPos->lastIndex() + (renderer->textMenuPageSize / 2.0f); // jump down by page size / 2
if (downPreset >= (m_presetLoader->size() - 1)) // handle upper boundary
if (static_cast<std::size_t>(downPreset) >= (m_presetLoader->size() - 1)) // handle upper boundary
downPreset = 0;
selectPreset(downPreset); // jump down menu half a page.
}
Expand Down
10 changes: 5 additions & 5 deletions src/libprojectM/MilkdropPresetFactory/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ llvm::Value *PrefunExpr::_llvm(JitContext &jitx)
class PrefunExprOne : public PrefunExpr
{
public:
PrefunExprOne(Func *function, Expr **expr_list_) : PrefunExpr(function,expr_list_) {}
PrefunExprOne(Func *fun, Expr **expr_list_) : PrefunExpr(fun,expr_list_) {}
float eval ( int mesh_i, int mesh_j )
{
float val = expr_list[0]->eval ( mesh_i, mesh_j );
Expand Down Expand Up @@ -260,7 +260,7 @@ class IfEqualExpr : public PrefunExpr
class IfExpr : public PrefunExpr
{
public:
IfExpr(Func *function, Expr **expr_list_) : PrefunExpr(function,expr_list_) {}
IfExpr(Func *fun, Expr **expr_list_) : PrefunExpr(fun,expr_list_) {}

float eval ( int mesh_i, int mesh_j )
{
Expand Down Expand Up @@ -322,7 +322,7 @@ class IfExpr : public PrefunExpr
class SinExpr : public PrefunExpr
{
public:
SinExpr(Func *function, Expr **expr_list_) : PrefunExpr(function,expr_list_) {}
SinExpr(Func *fun, Expr **expr_list_) : PrefunExpr(fun,expr_list_) {}
float eval ( int mesh_i, int mesh_j ) override
{
float val = expr_list[0]->eval ( mesh_i, mesh_j );
Expand All @@ -334,7 +334,7 @@ class SinExpr : public PrefunExpr
class CosExpr : public PrefunExpr
{
public:
CosExpr(Func *function, Expr **expr_list_) : PrefunExpr(function,expr_list_) {}
CosExpr(Func *fun, Expr **expr_list_) : PrefunExpr(fun,expr_list_) {}
float eval ( int mesh_i, int mesh_j ) override
{
float val = expr_list[0]->eval ( mesh_i, mesh_j );
Expand All @@ -346,7 +346,7 @@ class CosExpr : public PrefunExpr
class LogExpr : public PrefunExpr
{
public:
LogExpr(Func *function, Expr **expr_list_) : PrefunExpr(function,expr_list_) {}
LogExpr(Func *fun, Expr **expr_list_) : PrefunExpr(fun,expr_list_) {}
float eval ( int mesh_i, int mesh_j ) override
{
float val = expr_list[0]->eval( mesh_i, mesh_j );
Expand Down
6 changes: 4 additions & 2 deletions src/libprojectM/Renderer/MilkdropWaveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void MilkdropWaveform::WaveformMath(RenderContext &context)
break;

case DoubleLine://dual waveforms

{

wave_x_temp=-2*0.4142f*(fabs(fabs(mystery)-.5f)-.5f);

Expand Down Expand Up @@ -384,6 +384,8 @@ void MilkdropWaveform::WaveformMath(RenderContext &context)
}

break;

}
case last:
break;
}
}
10 changes: 5 additions & 5 deletions src/libprojectM/Renderer/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void Renderer::RenderTouch(const Pipeline& pipeline, const PipelineContext& pipe
{
Pipeline pipelineTouch;
MilkdropWaveform wave;
for(int x = 0; x < waveformList.size(); x++){
for(std::size_t x = 0; x < waveformList.size(); x++){
pipelineTouch.drawables.push_back(&wave);
wave = waveformList[x];

Expand Down Expand Up @@ -701,7 +701,7 @@ bool Renderer::timeCheck(const milliseconds currentTime, const milliseconds last
}

// If we touched on the renderer where there is an existing waveform.
bool Renderer::touchedWaveform(float x, float y, int i)
bool Renderer::touchedWaveform(float x, float y, std::size_t i)
{
if (waveformList[i].x > (x-0.05f) && waveformList[i].x < (x+0.05f) // if x +- 0.5f
&& ((waveformList[i].y > (y-0.05f) && waveformList[i].y < (y+0.05f)) // and y +- 0.5f
Expand All @@ -717,7 +717,7 @@ bool Renderer::touchedWaveform(float x, float y, int i)
void Renderer::touch(float x, float y, int pressure, int type = 0)
{

for (int i = 0; i < waveformList.size(); i++) {
for (std::size_t i = 0; i < waveformList.size(); i++) {
if (touchedWaveform(x, y, i))
{
// if we touched an existing waveform with left click, drag it and don't continue with adding another.
Expand Down Expand Up @@ -767,7 +767,7 @@ void Renderer::touchDrag(float x, float y, int pressure)
{
// if we left clicked & held in the approximate position of a waveform, snap to it and adjust x / y to simulate dragging.
// For lines we don't worry about the x axis.
for (int i = 0; i < waveformList.size(); i++) {
for (std::size_t i = 0; i < waveformList.size(); i++) {
if (touchedWaveform(x, y, i))
{
waveformList[i].x = x;
Expand All @@ -782,7 +782,7 @@ void Renderer::touchDestroy(float x, float y)
{
// if we right clicked approximately on the position of the waveform, then remove it from the waveform list.
// For lines we don't worry about the x axis.
for (int i = 0; i < waveformList.size(); i++) {
for (std::size_t i = 0; i < waveformList.size(); i++) {
if (touchedWaveform(x, y, i))
{
waveformList.erase(waveformList.begin() + i);
Expand Down
2 changes: 1 addition & 1 deletion src/libprojectM/Renderer/Renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Renderer
void touchDrag(float x, float y, int pressure);
void touchDestroy(float x, float y);
void touchDestroyAll();
bool touchedWaveform(float x, float y, int i);
bool touchedWaveform(float x, float y, std::size_t i);

void setToastMessage(const std::string& theValue);
void setSearchText(const std::string& theValue);
Expand Down
1 change: 1 addition & 0 deletions src/libprojectM/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ typedef enum {

typedef enum {
/** Modifiers */
PROJECTM_KMOD_NONE = -1,
PROJECTM_KMOD_LSHIFT,
PROJECTM_KMOD_RSHIFT,
PROJECTM_KMOD_CAPS,
Expand Down
12 changes: 6 additions & 6 deletions src/libprojectM/projectM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void projectM::projectM_resetTextures()


projectM::projectM ( std::string config_file, int flags) :
_pcm(0), beatDetect ( 0 ), renderer ( 0 ), _pipelineContext(new PipelineContext()), _pipelineContext2(new PipelineContext()), m_presetPos(0),
renderer ( 0 ), _pcm(0), beatDetect ( 0 ), _pipelineContext(new PipelineContext()), _pipelineContext2(new PipelineContext()), m_presetPos(0),
timeKeeper(NULL), m_flags(flags), _matcher(NULL), _merger(NULL)
{
readConfig(config_file);
Expand All @@ -124,7 +124,7 @@ projectM::projectM ( std::string config_file, int flags) :
}

projectM::projectM(Settings settings, int flags):
_pcm(0), beatDetect ( 0 ), renderer ( 0 ), _pipelineContext(new PipelineContext()), _pipelineContext2(new PipelineContext()), m_presetPos(0),
renderer ( 0 ), _pcm(0), beatDetect ( 0 ), _pipelineContext(new PipelineContext()), _pipelineContext2(new PipelineContext()), m_presetPos(0),
timeKeeper(NULL), m_flags(flags), _matcher(NULL), _merger(NULL)
{
readSettings(settings);
Expand Down Expand Up @@ -900,7 +900,7 @@ void projectM::selectPrevious(const bool hardCut) {
renderer->m_activePresetID--;
selectPresetByName(renderer->m_presetList[renderer->m_activePresetID-1].name,true);
}
} else if (settings().shuffleEnabled && presetHistory.size() >= 1 && presetHistory.back() != m_presetLoader->size() && !renderer->showmenu) { // if randomly browsing presets, "previous" should return to last random preset not the index--. Avoid returning to size() because that's the idle:// preset.
} else if (settings().shuffleEnabled && presetHistory.size() >= 1 && static_cast<std::size_t>(presetHistory.back()) != m_presetLoader->size() && !renderer->showmenu) { // if randomly browsing presets, "previous" should return to last random preset not the index--. Avoid returning to size() because that's the idle:// preset.
presetFuture.push_back(m_presetPos->lastIndex());
selectPreset(presetHistory.back());
presetHistory.pop_back();
Expand All @@ -922,7 +922,7 @@ void projectM::selectNext(const bool hardCut) {
if (isTextInputActive() && renderer->m_presetList.size() >= 1) // if search is active and there are search results
{
// if search menu is down, next is based on search terms.
if (renderer->m_activePresetID >= renderer->m_presetList.size()) {
if (static_cast<std::size_t>(renderer->m_activePresetID) >= renderer->m_presetList.size()) {
// loop to top of page is at bottom
renderer->m_activePresetID = 1;
selectPresetByName(renderer->m_presetList[0].name,true);
Expand All @@ -931,7 +931,7 @@ void projectM::selectNext(const bool hardCut) {
// otherwise move forward
selectPresetByName(renderer->m_presetList[renderer->m_activePresetID].name,true);
}
} else if (settings().shuffleEnabled && presetFuture.size() >= 1 && presetFuture.front() != m_presetLoader->size() && !renderer->showmenu) { // if shuffling and we have future presets already stashed then let's go forward rather than truely move randomly.
} else if (settings().shuffleEnabled && presetFuture.size() >= 1 && static_cast<std::size_t>(presetFuture.front()) != m_presetLoader->size() && !renderer->showmenu) { // if shuffling and we have future presets already stashed then let's go forward rather than truely move randomly.
presetHistory.push_back(m_presetPos->lastIndex());
selectPreset(presetFuture.back());
presetFuture.pop_back();
Expand Down Expand Up @@ -1133,7 +1133,7 @@ void projectM::toggleSearchText()
}

// get index from search results based on preset name
const unsigned int projectM::getSearchIndex(std::string &name) const
unsigned int projectM::getSearchIndex(std::string &name) const
{
for (auto& it : renderer->m_presetList) {
if (it.name == name) return it.id;
Expand Down
10 changes: 5 additions & 5 deletions src/libprojectM/projectM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,13 @@ class DLLEXPORT projectM
}

/// Occurs when active preset has switched. Switched to index is returned
virtual void presetSwitchedEvent(bool isHardCut, size_t index) const {};
virtual void shuffleEnabledValueChanged(bool isEnabled) const {};
virtual void presetSwitchFailedEvent(bool hardCut, unsigned int index, const std::string & message) const {};
virtual void presetSwitchedEvent(bool /*isHardCut*/, size_t /*index*/) const {};
virtual void shuffleEnabledValueChanged(bool /*isEnabled*/) const {};
virtual void presetSwitchFailedEvent(bool /*hardCut*/, unsigned int /*index*/, const std::string & /*message*/) const {};


/// Occurs whenever preset rating has changed via changePresetRating() method
virtual void presetRatingChanged(unsigned int index, int rating, PresetRatingType ratingType) const {};
virtual void presetRatingChanged(unsigned int /*index*/, int /*rating*/, PresetRatingType /*ratingType*/) const {};


inline PCM * pcm() {
Expand All @@ -315,7 +315,7 @@ class DLLEXPORT projectM
std::vector<int> presetFuture;

/// Get the preset index given a name
const unsigned int getSearchIndex(std::string &name) const;
unsigned int getSearchIndex(std::string &name) const;

void selectPrevious(const bool);
void selectNext(const bool);
Expand Down
33 changes: 16 additions & 17 deletions src/projectM-jack/qprojectM-jack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,9 @@ class ProjectMApplication : public QApplication {
std::string read_config()
{

int n;

char num[512];
FILE *in;
FILE *out;
FILE *f_in;
FILE *f_out;

char * home;
char projectM_home[1024];
Expand All @@ -113,10 +111,10 @@ std::string read_config()
projectM_home[strlen(home)+strlen("/.projectM/config.inp")]='\0';


if ((in = fopen(projectM_home, "r")) != 0)
if ((f_in = fopen(projectM_home, "r")) != 0)
{
printf("reading ~/.projectM/config.inp \n");
fclose(in);
fclose(f_in);
return std::string(projectM_home);
}
else
Expand All @@ -132,24 +130,24 @@ std::string read_config()
strcpy(projectM_home+strlen(home), "/.projectM/config.inp");
projectM_home[strlen(home)+strlen("/.projectM/config.inp")]='\0';

if((out = fopen(projectM_home,"w"))!=0)
if((f_out = fopen(projectM_home,"w"))!=0)
{

if ((in = fopen(projectM_config, "r")) != 0)
if ((f_in = fopen(projectM_config, "r")) != 0)
{

while(fgets(num,80,in)!=NULL)
while(fgets(num,80,f_in)!=NULL)
{
fputs(num,out);
fputs(num,f_out);
}
fclose(in);
fclose(out);
fclose(f_in);
fclose(f_out);


if ((in = fopen(projectM_home, "r")) != 0)
if ((f_in = fopen(projectM_home, "r")) != 0)
{
printf("created ~/.projectM/config.inp successfully\n");
fclose(in);
fclose(f_in);
return std::string(projectM_home);
}
else{printf("This shouldn't happen, using implementation defaults\n");abort();}
Expand All @@ -159,9 +157,9 @@ std::string read_config()
else
{
printf("Cannot create ~/.projectM/config.inp, using default config file\n");
if ((in = fopen(projectM_config, "r")) != 0)
if ((f_in = fopen(projectM_config, "r")) != 0)
{ printf("Successfully opened default config file\n");
fclose(in);
fclose(f_in);
return std::string(projectM_config);}
else{ printf("Using implementation defaults, your system is really messed up, I'm surprised we even got this far\n"); abort();}

Expand All @@ -176,6 +174,7 @@ std::string read_config()
int
process (jack_nframes_t nframes, void *arg)
{
Q_UNUSED(arg);

jack_default_audio_sample_t *in;

Expand All @@ -191,6 +190,7 @@ process (jack_nframes_t nframes, void *arg)

void jack_shutdown (void *arg)
{
Q_UNUSED(arg);
exit (1);
}

Expand All @@ -201,7 +201,6 @@ int main (int argc, char **argv) {
jack_options_t options = JackNullOption;
jack_status_t status;
int i;
char projectM_data[1024];

// Start a new application
ProjectMApplication app(argc, argv);
Expand Down
25 changes: 13 additions & 12 deletions src/projectM-pulseaudio/QPulseAudioDeviceModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
#include <QMessageBox>
#include <QHash>

QPulseAudioDeviceModel::QPulseAudioDeviceModel(const QHash<int, QString> & devices, const QHash<int,QString>::const_iterator & devicePosition, QObject * parent): _devices(devices), _devicePosition(devicePosition) {

}

void QPulseAudioDeviceModel::updateItemHighlights()
{
if ( rowCount() == 0 )
return;
QPulseAudioDeviceModel::QPulseAudioDeviceModel(const QHash<int, QString> & devices, const QHash<int,QString>::const_iterator & devicePosition, QObject * parent): QAbstractListModel(parent), _devices(devices), _devicePosition(devicePosition) {

emit ( dataChanged ( this->index (0), this->index ( rowCount()-1 ) ));
}
}

void QPulseAudioDeviceModel::updateItemHighlights()
{
if ( rowCount() == 0 )
return;

emit ( dataChanged ( this->index (0), this->index ( rowCount()-1 ) ));
}

QVariant QPulseAudioDeviceModel::data ( const QModelIndex & index, int role = Qt::DisplayRole ) const
{
Expand Down Expand Up @@ -82,8 +82,9 @@ QVariant QPulseAudioDeviceModel::data ( const QModelIndex & index, int role = Qt

int QPulseAudioDeviceModel::rowCount ( const QModelIndex & parent) const
{

return _devices.count();
Q_UNUSED(parent);

return _devices.count();
}


Expand Down
Loading