Engine not outputting sound

Hello all,

I am trying to step through the code of the MidiRecordingDemo.

Firstly, I managed to get the DemoRunner working using the instructions on the repo. When I run things through there, everything works fine, 100%, but I wanted to get things running in my own project using Projucer.

To that end, I tried copying the relevant files into a new project. These are the files I copied over:

  • Components.cpp
  • Components.h
  • DemoRunner.h
  • Main.cpp
  • MidiRecordingDemo.h
  • PluginWindow.h
  • Utilities.h

I put all of them in a single directory, updated the #include, and a few other minor changes to get things to compile, and configured my .jucer like this

<?xml version="1.0" encoding="UTF-8"?>

<JUCERPROJECT id="F65dWy" name="Untitled" projectType="guiapp" useAppConfig="0"
              addUsingNamespaceToJuceHeader="0" jucerFormatVersion="1" pluginCharacteristicsValue="pluginProducesMidiOut,pluginWantsMidiIn"
              defines="JUCE_MODAL_LOOPS_PERMITTED=1" cppLanguageStandard="17"
  <MAINGROUP id="L0hbSJ" name="Untitled">
    <GROUP id="{40287891-65F2-379B-D7E6-D28D726EE4E9}" name="Source">
      <FILE id="hJ37E3" name="Components.cpp" compile="1" resource="0" file="Source/Components.cpp"/>
      <FILE id="KlnK4A" name="Components.h" compile="0" resource="0" file="Source/Components.h"/>
      <FILE id="cy69Uy" name="DemoRunner.h" compile="0" resource="0" file="Source/DemoRunner.h"/>
      <FILE id="enBLxW" name="MidiRecordingDemo.h" compile="0" resource="0"
      <FILE id="i5C3jG" name="PluginWindow.h" compile="0" resource="0" file="Source/PluginWindow.h"/>
      <FILE id="rsSs3G" name="Utilities.h" compile="0" resource="0" file="Source/Utilities.h"/>
      <FILE id="QdvzEI" name="Main.cpp" compile="1" resource="0" file="Source/Main.cpp"/>
    <XCODE_MAC targetFolder="Builds/MacOSX">
        <CONFIGURATION isDebug="1" name="Debug" targetName="Untitled"/>
        <CONFIGURATION isDebug="0" name="Release" targetName="Untitled"/>
        <MODULEPATH id="juce_audio_basics" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_audio_devices" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_audio_formats" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_audio_processors" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_audio_utils" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_core" path="tracktion_engine/modules/juce"/>
        <MODULEPATH id="juce_data_structures" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_events" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_graphics" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_gui_basics" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_gui_extra" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="tracktion_engine" path="tracktion_engine/modules"/>
        <MODULEPATH id="juce_dsp" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="juce_osc" path="tracktion_engine/modules/juce/modules"/>
        <MODULEPATH id="tracktion_graph" path="tracktion_engine/modules"/>
    <MODULE id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_audio_devices" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_audio_formats" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_audio_processors" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_audio_utils" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_core" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_data_structures" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_dsp" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_events" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_gui_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="juce_osc" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
    <MODULE id="tracktion_engine" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
    <MODULE id="tracktion_graph" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>

Pretty much everything is running smoothly. I can add and remove tracks, plugins, clips, I can record MIDI, and save the edit. But I’m not getting any sound.

At first I wasn’t sure if the MIDI messages were making it into the plugin, so I loaded in an instance of Vital. From what I can tell, it looks like the MIDI is coming through fine, and Vital is outputting audio, but I’m not getting any output from the application.

So I’m pretty confused now… My best guess is that there is some flag or config that I am missing. I’m not very good with CMake yet, so I am having trouble deciphering DemoRunner’s CMakeList.txt.

Could someone help me get this up and running?

Are you sure you have set your audio interface properly?

I believe so. Using the Audio Settings built into the DemoRunner code, I am able to confirm that my audio interface is selected as the output target, and I can hear the test tone.

Does anyone maybe have some tips on how I could debug this? I’ve been trying to trace my way through the code to figure what is actually responsible for getting sound from the Engine to my interface, but haven’t had much luck as of yet.

If the Midirecordingdemo is making sound all you need to do is find the difference to your setup. Without knowing what you have changed, no one can know, what is wrong.

So there seems to be a problem with using “Untitled” as the applicationName of the Engine.

While I was fiddling around with things and suddenly I had audio. After back tracking and a bit of experimentation, my best guess is that “Untitled” is reserved by something and causes the engine to fail to output without raising any sort of exception.

1 Like

I can’t think of anything that would cause problems with using “Untitled”.
What OS are you on? My guess is that it might be some kind of audio device permissions issue?

macOS Monterey v12.4

To baramgb’s point, I did a full diff of my code compared to the demo, and not much had been changed, just #include lines and adding static to the EngineHelper methods.

The biggest difference was that I was using the .jucer file I included at the top, which as far as I can tell is a pretty close match to what is in the demo project.

I know that it’s bizarre, but I’m not sure how to debug the engine to figure out what is really going on, and this name workaround seems to have solved my issue for now.

My best guess is that you’ve saved some audio settings that don’t work in to the “Untitled” settings file which are getting reloaded when you open that project. Changing the Engine project name has probably just created some new, default, settings.

Could you elaborate on what settings file you are referring to? I would love to know how to check for this in case it gets messed up again.

You can find the settings folder using Engine::getPropertyStorage().getAppPrefsFolder()

1 Like