matkatmusic/AudioFilePlayer

directoryScannerBackgroundThread.startThread (3); causes error in Juce 7 on VS2019 and VS2022

Closed this issue · 3 comments

The line

directoryScannerBackgroundThread.startThread (3);

in PluginProcessor.cpp

causes an error using Juce 7 with VS2019 or VS2022

Severity Code Description Project File Line Suppression State
Error C2665 'juce::Thread::startThread': no overloaded function could convert all the argument types AudioFilePlayer_SharedCode D:\users-data\wevan\Dev\Juce\JuceTutorials\AudioFilePlayer-master\Source\PluginProcessor.cpp 26

Changing the line to

directoryScannerBackgroundThread.startThread();

which starts the thread with default priority removes the error and the AudioFilePlayer seems to work in the AudioPluginHost.

I'm not sure if this priority change potentially has other unintended effects.

Chris

If you want to specify priority you could probably just do a static cast. Documentations has priorities ranging from -2 to 2. I replaced the line as follows for "high" priority:

directoryScannerBackgroundThread.startThread (static_castjuce::Thread::Priority(1));

https://docs.juce.com/master/classThread.html#aae22d3d18dffe1adbbc2baf564e0383b

If you just want to fix the issue without altering the code:

directoryScannerBackgroundThread.startThread (static_cast<juce::Thread::Priority>(3));

This issue is now fixed as of f26e633