# FormatManager.createReaderFor issue with MemoryInputStream

**URL:** <https://forum.juce.com/t/formatmanager-createreaderfor-issue-with-memoryinputstream/56658>\
**Category:** General JUCE discussion\
**Created:** [June 14, 2023, 4:07pm UTC](https://forum.juce.com/t/formatmanager-createreaderfor-issue-with-memoryinputstream/56658 "2023-06-14T16:07:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AwaAud](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@AwaAud](https://forum.juce.com/u/AwaAud)\
**Post date:** [June 14, 2023, 4:07pm UTC](https://forum.juce.com/t/formatmanager-createreaderfor-issue-with-memoryinputstream/56658/1 "2023-06-14T16:07:06Z")

</div>

I found a lot of [older posts](https://forum.juce.com/t/wav-assets-compiling-along-with-the-plugin/23761/4) using the following two lines to load in binary audio data:

```auto
MemoryInputStream* input = new MemoryInputStream (BinaryData::fille_wav, BinaryData::file_wav_size, false);
auto reader = audioFormatManager.createReaderFor (input);

```

But that doesn’t seem to work anymore. Someone posted [this solution](https://forum.juce.com/t/solved-formatmanager-createreaderfor-and-memoryinputstream-question/45394) that seemed to work for them:

```auto
std::unique_ptr<InputStream> stream = std::make_unique<MemoryInputStream>(fileData, true);
AudioFormatReader* reader = m_FormatManager.createReaderFor(std::move(stream));

```

In my code, that looks like this:

```auto
std::unique_ptr<InputStream> stream = std::make_unique<MemoryInputStream>(
            BinaryData::clickSample_wav, BinaryData::clickSample_wavSize, false);
AudioFormatReader* reader = mFormatManager.createReaderFor(std::move(stream));

```

But I get an error:

> No matching member function for call to ‘createReaderFor’

Without `std::move`, I still get the same error.  
Any ideas what might be causing that? Does binary data need to be handled differently? Android studio says that stream is `std::unique_ptr<InputStream>`, which is what I intended it to be.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 14, 2023, 4:37pm UTC](https://forum.juce.com/t/formatmanager-createreaderfor-issue-with-memoryinputstream/56658/2 "2023-06-14T16:37:33Z")

</div>

Is `mFormatManager` const in this context?

---

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [June 14, 2023, 4:43pm UTC](https://forum.juce.com/t/formatmanager-createreaderfor-issue-with-memoryinputstream/56658/3 "2023-06-14T16:43:24Z")

</div>

perhaps something more along those lines :

```auto
auto stream = std::make_unique<MemoryInputStream> (BinaryData::clickSample_wav, BinaryData::clickSample_wavSize, false);
std::unique_ptr<AudioFormatReader> reader (mFormatManager.createReaderFor (stream.release(), true));

```

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [June 15, 2023, 8:00am UTC](https://forum.juce.com/t/formatmanager-createreaderfor-issue-with-memoryinputstream/56658/4 "2023-06-15T08:00:09Z")

</div>

If you use a very old version of juce, chances are the AudioFormatReader uses the old API with raw pointers (JUCE 6 or 5).

Make it a habit not to stop reading at the line “Error”. The compiler usually adds clues, like “Considered overloads” mentioning the function and the arguments it could accept.

Since you don’t use the juce:: namespace prefix, it could also be that the problem is much earlier. In that case AudioFormatManager might be seen as unknown type but the compiler still runs witlessly into the battlefield.

So: which juce version are you using?  
What is the additional info after the line “No matching function”?
