Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d3e430c
Noise not needed - F4 shows if shaders are compiled.
milkdropper Jun 7, 2020
d3962f4
Don't compile native presets by default in Visual Studio
milkdropper Jun 7, 2020
cce18bf
Debug / duplicate info
milkdropper Jun 7, 2020
84b3b56
Missed a debug native preset.
milkdropper Jun 7, 2020
9a9151b
Make texture errors more clear - we failed looking for multiple exten…
milkdropper Jun 7, 2020
d084c2b
Move images from presets folder to textures folder
milkdropper Jun 7, 2020
9059e09
Documented missing textures.
milkdropper Jun 7, 2020
e250cac
Undo Visual Studio version bump.
milkdropper Jun 7, 2020
82522a7
Renable NativePresetFactory (but the example native presets remain di…
milkdropper Jun 7, 2020
de80a14
Comment
milkdropper Jun 7, 2020
5fd5bbc
Fixes / updates to audio device toggling.
milkdropper Jun 8, 2020
a015013
Stop crashing if there is no input microphone. Make fake audio dynami…
milkdropper Jun 12, 2020
63b3245
Remove debug output.
milkdropper Jun 12, 2020
decdeb5
Document VC++ redist requirement.
milkdropper Jun 12, 2020
0574c67
F4 missing from SDL help menu.
milkdropper Jun 26, 2020
c870da3
Windows app instead of Console (no more cmd.exe pop-up when launching).
milkdropper Jul 4, 2020
b1936e7
Fullscreen for built-in settings.
milkdropper Jul 4, 2020
c187a77
New icon (based on github and idle preset and consistent with Steam)
milkdropper Jul 4, 2020
f779657
Change language for loopback / audio changing.
milkdropper Jul 4, 2020
ea89584
default fullscreen for built-in settings.
milkdropper Jul 4, 2020
8860432
Revert "Fullscreen for built-in settings."
milkdropper Jul 26, 2020
c4d4ec9
Revert "default fullscreen for built-in settings."
milkdropper Jul 26, 2020
8ba5d59
Revert "9a9151b9"
milkdropper Jul 26, 2020
421dfb4
9a9151b9
milkdropper Jul 26, 2020
b89e761
fake_audio to fakeAudio
milkdropper Jul 26, 2020
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Its purpose in life is to read an audio input and to produce mesmerizing visuals
### Available For
* [macOS, Linux (binary)](https://github.com/projectM-visualizer/projectm/releases)
* [Windows Store (PC, XBOX, Phone)](https://www.microsoft.com/store/apps/9NDCVH0VCWJN)
* [Windows (standalone binary)](https://github.com/projectM-visualizer/projectm/releases) (Requires the latest [Visual C++ redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads))
* [Android](https://play.google.com/store/apps/details?id=com.psperl.projectM)
* [iOS](https://itunes.apple.com/us/app/projectm-music-visualizer/id530922227?mt=8&ign-mpt=uo%3D4)
* [iTunes plugin (macOS)](https://github.com/projectM-visualizer/projectm/releases/)
Expand Down
Binary file added msvc/projectM.ico
Binary file not shown.
10 changes: 0 additions & 10 deletions msvc/projectM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,17 @@ Global
{013DE011-EC24-3643-A8EE-F2609E7E4741}.Release|x64.ActiveCfg = Release|x64
{013DE011-EC24-3643-A8EE-F2609E7E4741}.Release|x64.Build.0 = Release|x64
{55A71B6A-5C7E-30D5-8210-302A8D2080DB}.Debug|x64.ActiveCfg = Debug|x64
{55A71B6A-5C7E-30D5-8210-302A8D2080DB}.Debug|x64.Build.0 = Debug|x64
{55A71B6A-5C7E-30D5-8210-302A8D2080DB}.Release|x64.ActiveCfg = Release|x64
{55A71B6A-5C7E-30D5-8210-302A8D2080DB}.Release|x64.Build.0 = Release|x64
{9260C46C-6BC9-396F-9310-6BAAD56A7801}.Debug|x64.ActiveCfg = Debug|x64
{9260C46C-6BC9-396F-9310-6BAAD56A7801}.Release|x64.ActiveCfg = Release|x64
{7A203034-A4D7-3A2B-9138-CB125F9B35E6}.Debug|x64.ActiveCfg = Debug|x64
{7A203034-A4D7-3A2B-9138-CB125F9B35E6}.Debug|x64.Build.0 = Debug|x64
{7A203034-A4D7-3A2B-9138-CB125F9B35E6}.Release|x64.ActiveCfg = Release|x64
{7A203034-A4D7-3A2B-9138-CB125F9B35E6}.Release|x64.Build.0 = Release|x64
{6E418BC8-5407-3A37-96BD-5201D47DE753}.Debug|x64.ActiveCfg = Debug|x64
{6E418BC8-5407-3A37-96BD-5201D47DE753}.Debug|x64.Build.0 = Debug|x64
{6E418BC8-5407-3A37-96BD-5201D47DE753}.Release|x64.ActiveCfg = Release|x64
{6E418BC8-5407-3A37-96BD-5201D47DE753}.Release|x64.Build.0 = Release|x64
{B7C4937F-A36D-3B6C-A8AC-CA99772AE5EC}.Debug|x64.ActiveCfg = Debug|x64
{B7C4937F-A36D-3B6C-A8AC-CA99772AE5EC}.Debug|x64.Build.0 = Debug|x64
{B7C4937F-A36D-3B6C-A8AC-CA99772AE5EC}.Release|x64.ActiveCfg = Release|x64
{B7C4937F-A36D-3B6C-A8AC-CA99772AE5EC}.Release|x64.Build.0 = Release|x64
{27DDCE71-E33B-3521-92B5-9918356D78A1}.Debug|x64.ActiveCfg = Debug|x64
{27DDCE71-E33B-3521-92B5-9918356D78A1}.Debug|x64.Build.0 = Debug|x64
{27DDCE71-E33B-3521-92B5-9918356D78A1}.Release|x64.ActiveCfg = Release|x64
{27DDCE71-E33B-3521-92B5-9918356D78A1}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 4 additions & 3 deletions msvc/projectMSDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<ImportLibrary>projectM-sdl/Debug/projectMSDL.lib</ImportLibrary>
<ProgramDataBaseFile>projectM-sdl/Debug/projectMSDL.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<SubSystem>Windows</SubSystem>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -133,7 +133,7 @@
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<ImportLibrary>projectM-sdl/Release/projectMSDL.lib</ImportLibrary>
<ProgramDataBaseFile>projectM-sdl/Release/projectMSDL.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<SubSystem>Windows</SubSystem>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -176,7 +176,7 @@
<ResourceCompile Include="projectM.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="projectm_qDj_icon.ico">
<Image Include="projectM.ico">
<DeploymentContent>true</DeploymentContent>
</Image>
</ItemGroup>
Expand Down Expand Up @@ -210,6 +210,7 @@
<Exec Command="copy /Y &quot;$(MSBuildThisFileDirectory)..\LICENSE.txt&quot; &quot;$(OutDir)LICENSE.txt&quot;" />
<Exec Command="copy /Y &quot;$(MSBuildThisFileDirectory)..\AUTHORS.txt&quot; &quot;$(OutDir)AUTHORS.txt&quot;" />
<Exec Command="copy /Y &quot;$(MSBuildThisFileDirectory)..\README.md&quot; &quot;$(OutDir)README.md&quot;" />
<Exec Command="copy /Y &quot;$(MSBuildThisFileDirectory)projectM.ico&quot; &quot;$(OutDir)projectM.ico&quot;" />
<Exec Command="copy /Y &quot;$(MSBuildThisFileDirectory)projectm_qDj_icon.ico&quot; &quot;$(OutDir)projectm_qDj_icon.ico&quot;" />
<Exec Command="copy /Y &quot;$(MSBuildThisFileDirectory)Setup.iss&quot; &quot;$(OutDir)Setup.iss&quot;" />
<Exec Command="copy /Y &quot;$(MSBuildThisFileDirectory)setup_inno.bmp&quot; &quot;$(OutDir)setup_inno.bmp&quot;" />
Expand Down
2 changes: 2 additions & 0 deletions src/libprojectM/PresetFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ std::string PresetFactory::protocol(const std::string & url, std::string & path)
else {
path = url.substr(pos + 3, url.length());
// std::cout << "[PresetFactory] path is " << path << std::endl;
#ifdef DEBUG
std::cout << "[PresetFactory] url is " << url << std::endl;
#endif
return url.substr(0, pos);
}

Expand Down
2 changes: 2 additions & 0 deletions src/libprojectM/Renderer/ShaderEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,9 @@ GLuint ShaderEngine::compilePresetShader(const PresentShaderType shaderType, Sha
}

if (ret != GL_FALSE) {
#ifdef DEBUG
std::cerr << "Successful compilation of " << shaderTypeString << std::endl;
#endif
} else {
std::cerr << "Compilation error (step3) of " << shaderTypeString << std::endl;

Expand Down
89 changes: 56 additions & 33 deletions src/projectM-sdl/pmSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,45 @@ void projectMSDL::audioInputCallbackS16(void *userdata, unsigned char *stream, i
app->pcm()->addPCM16(pcm16);
}

SDL_AudioDeviceID projectMSDL::selectAudioInput(int _count) {
// TODO: implement some sort of UI allowing the user to select which audio input device they would like to use


// ask the user which capture device to use
// printf("Please select which audio input to use:\n");
printf("Detected devices:\n");
for (int i = 0; i < _count; i++) {
printf(" %i: 🎤%s\n", i, SDL_GetAudioDeviceName(i, true));
}

return 0;
}

int projectMSDL::toggleAudioInput() {

CurAudioDevice++;
if (CurAudioDevice >= NumAudioDevices)
// trigger a toggle with CMD-I or CTRL-I
if (wasapi) { // we are currently on WASAPI, so we are going to revert to a microphone/line-in input.
if (this->openAudioInput())
this->beginAudioCapture();
CurAudioDevice = 0;
selectedAudioDevice = CurAudioDevice;
initAudioInput();
selectedAudioDevice = CurAudioDevice;
this->wasapi = false; // Track wasapi as off so projectMSDL will stop listening to WASAPI loopback in pmSDL_main.
}
else {
this->endAudioCapture(); // end current audio capture.
CurAudioDevice++; // iterate device index
if (CurAudioDevice >= NumAudioDevices) { // We reached outside the boundaries of available audio devices.
CurAudioDevice = 0; // Return to first audio device in the index.
#ifdef WASAPI_LOOPBACK
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would really love to see this code live in "driver" subclasses rather than all #ifdef'd in between the rest of the code in this big file someday

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree the #ifdef stuff looks sloppy and confusing when nested like this. I didn't want to undo what someone else did so I kept with it. But hopefully the comments will keep it OK for now.

I did A LOT of testing so it should work on windows / mac without issue.

// If we are at the boundary and WASAPI is enabled then let's load WASAPI instead.
projectM::setToastMessage("Loopback audio selected");
SDL_Log("Loopback audio selected");
this->fakeAudio = false; // disable fakeAudio in case it was enabled.
this->wasapi = true; // Track wasapi as on so projectMSDL will listen to it.
#else
if (NumAudioDevices == 1) // If WASAPI_LOOPBACK was not enabled and there is only one audio device, it's pointless to toggle anything.
{
SDL_Log("There is only one audio capture device. There is nothing to toggle at this time.");
return 1;
}
// If WASAPI_LOOPBACK is not enabled and we have multiple input devices, return to device index 0 and let's listen to that device.
selectedAudioDevice = CurAudioDevice;
initAudioInput();
this->beginAudioCapture();
#endif
}
else {
// This is a normal scenario where we move forward in the audio device index.
selectedAudioDevice = CurAudioDevice;
initAudioInput();
this->beginAudioCapture();
}
}
return 1;
}

Expand All @@ -105,15 +123,17 @@ int projectMSDL::initAudioInput() {

if (audioDeviceID == 0) {
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "Failed to open audio capture device: %s", SDL_GetError());
SDL_Quit();
return 0;
}

// read characteristics of opened capture device
SDL_Log("Opened audio capture device index=%i devId=%i: %s", selectedAudioDevice, audioDeviceID, SDL_GetAudioDeviceName(selectedAudioDevice, true));
std::string deviceToast = "Listening to ";
deviceToast += SDL_GetAudioDeviceName(selectedAudioDevice, true);
std::string deviceToast = SDL_GetAudioDeviceName(selectedAudioDevice, true); // Example: Microphone rear
deviceToast += " selected";
projectM::setToastMessage(deviceToast);
#ifdef DEBUG
SDL_Log("Samples: %i, frequency: %i, channels: %i, format: %i", have.samples, have.freq, have.channels, have.format);
#endif
audioChannelsCount = have.channels;
audioSampleRate = have.freq;
audioSampleCount = have.samples;
Expand All @@ -124,9 +144,12 @@ int projectMSDL::initAudioInput() {
}

int projectMSDL::openAudioInput() {
fakeAudio = false; // if we are opening an audio input then there is no need for fake audio.
// get audio driver name (static)
#ifdef DEBUG
const char* driver_name = SDL_GetCurrentAudioDriver();
SDL_Log("Using audio driver: %s\n", driver_name);
#endif

// get audio input device
unsigned int i;
Expand All @@ -135,23 +158,18 @@ int projectMSDL::openAudioInput() {
CurAudioDevice = 0;
if (NumAudioDevices == 0) {
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "No audio capture devices found");
SDL_Quit();
projectM::setToastMessage("No audio capture devices found: using simulated audio");
fakeAudio = true;
return 0;
}
#ifdef DEBUG
for (i = 0; i < NumAudioDevices; i++) {
SDL_Log("Found audio capture device %d: %s", i, SDL_GetAudioDeviceName(i, true));
}
#endif

// device to open
// default selected Audio Device to 0.
selectedAudioDevice = 0;
if (NumAudioDevices > 1) {
// need to choose which input device to use
selectedAudioDevice = selectAudioInput(CurAudioDevice);
if (selectedAudioDevice > NumAudioDevices) {
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "No audio input device specified.");
SDL_Quit();
}
}

initAudioInput();

return 1;
Expand All @@ -164,6 +182,7 @@ void projectMSDL::beginAudioCapture() {

void projectMSDL::endAudioCapture() {
SDL_PauseAudioDevice(audioDeviceID, true);
SDL_CloseAudioDevice(audioDeviceID);
}

void projectMSDL::setHelpText(const std::string & helpText) {
Expand Down Expand Up @@ -465,6 +484,10 @@ void projectMSDL::init(SDL_Window *window, SDL_GLContext *_glCtx, const bool _re
glCtx = _glCtx;
projectM_resetGL(width, height);

#ifdef WASAPI_LOOPBACK
wasapi = true;
#endif

// are we rendering to a texture?
renderToTexture = _renderToTexture;
if (renderToTexture) {
Expand Down
3 changes: 2 additions & 1 deletion src/projectM-sdl/pmSDL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class projectMSDL : public projectM {


bool done;
bool wasapi = false; // Used to track if wasapi is currently active. This bool will allow us to run a WASAPI app and still toggle to microphone inputs.
bool fakeAudio = false; // Used to track fake audio, so we can turn it off and on.
projectMSDL(Settings settings, int flags);
projectMSDL(std::string config_file, int flags);
void init(SDL_Window *window, SDL_GLContext *glCtx, const bool renderToTexture = false);
Expand Down Expand Up @@ -135,7 +137,6 @@ class projectMSDL : public projectM {
static void audioInputCallbackS16(void *userdata, unsigned char *stream, int len);

void keyHandler(SDL_Event *);
SDL_AudioDeviceID selectAudioInput(int _count);
void renderTexture();
};

Expand Down
Loading