# No audio formats found

**URL:** <https://forum.juce.com/t/no-audio-formats-found/15478>\
**Category:** Audio Plugins\
**Created:** [September 5, 2015, 12:27am UTC](https://forum.juce.com/t/no-audio-formats-found/15478 "2015-09-05T00:27:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgreenek](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kgreenek/32/67_2.png) [@kgreenek](https://forum.juce.com/u/kgreenek)\
**Post date:** [September 5, 2015, 12:27am UTC](https://forum.juce.com/t/no-audio-formats-found/15478/1 "2015-09-05T00:27:28Z")

</div>

&nbsp;

I'm trying to write a basic command-line program to print out all the vst's installed on the computer.

&nbsp;

The problem is that when I call&nbsp;audioFormatManager.getNumFormats(), it always returns 0.

&nbsp;

I am initializing the AudioFormatManager object by calling&nbsp;audioFormatManager.addDefaultFormats().

&nbsp;

I'm building this on mac (the latest macbook pro if that matters), using the auto-generated "command-line" xcode project&nbsp;without any modification (besides filling in Main.cpp).

&nbsp;

Full code:

&nbsp;

```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../JuceLibraryCode/JuceHeader.h"

juce::AudioPluginFormatManager audioFormatManager;
juce::KnownPluginList knownPluginList;

void ScanForPlugins() {
  printf("Scanning for plugins...\n");
  for (int i = 0; i < audioFormatManager.getNumFormats(); ++i) {
    auto format = audioFormatManager.getFormat(i);
    auto scanner = new juce::PluginDirectoryScanner(
        knownPluginList /* listToAddResultsTo */,
        *format /* formatToLookFor */,
        format->getDefaultLocationsToSearch() /* directoriesToSearch */,
        true /* searchRecursively */,
        juce::File::nonexistent /* deadMansPedalFile */);
    juce::String pluginName;
    while (scanner->scanNextFile(true /* dontRescanIfAlreadyInList */, pluginName));
  }
}

void Initialize() {
  audioFormatManager.addDefaultFormats();
  ScanForPlugins();
}

void ListPlugins() {
  Initialize();
  if (knownPluginList.getNumTypes() == 0) {
    printf("No plugins detected\n");
    return;
  }
  printf("Installed plugins:\n");
  for (auto i : knownPluginList) {
    printf(" %s\n", i->name.toRawUTF8());
  }
}

int main(int argc, char *argv[]) {
  static_assert(__cplusplus > 199711L, "Program requires C++11 capable compiler");
  ListPlugins();
  return 0;
}
```

&nbsp;

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 5, 2015, 4:15pm UTC](https://forum.juce.com/t/no-audio-formats-found/15478/2 "2015-09-05T16:15:00Z")

</div>

Each format can be turned on/off with a flag, using the tickboxes in the introjucer project settings. Maybe you didn't actually enable any formats?

---

<div class="post-metadata">

**Author:** ![kgreenek](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kgreenek/32/67_2.png) [@kgreenek](https://forum.juce.com/u/kgreenek)\
**Post date:** [September 5, 2015, 10:42pm UTC](https://forum.juce.com/t/no-audio-formats-found/15478/3 "2015-09-05T22:42:36Z")

</div>

Thanks, I didn't realize I had to do that. The code is working now :)
