Sound is stereo when patch opened, but mono when closed

Ruben R's icon

A brief introduction to what I am trying to build: I am writing a Max Audio Effect that reads incoming audio into a buffer~ (eventually for processing/manipulation), where a 'time' knob sets the rate at which a new audio buffer is acquired. A phasor~ object serves as the main engine of the patch, where every wave represents a new sample being recorded/played. Changing the time knob will update the sample period once the wave has finished and the old buffer has been played completely. Furthermore, I made a Freeze/Record mechanism: Record mode is the mode I just described; in Freeze mode, no new audio will be recorded into the audio buffer, and the current buffer will be looped.

The audio is being recorded using two poke~ objects (one for left outlet of plugin~, one for right outlet of plugin~), and is being played using two index~ objects (one for left inlet of plugout~, one fot right inlet of plugout~). The buffer~ has been set to have two channels. The I/O mappings seem to have been set-up correctly for stereo sound.

However, when I use the audio effect, the incoming stereo sound becomes mono. When I pan completely left (using Utility device) no sound can be heard, and when I pan completely right, the sound comes through both ears. This is only the case when the patch is closed. When I open up the patch (using the edit button) and leave the effect turned on, the sound is perfectly stereo and panning left and right shows expected behaviour.

Does anyone have an idea how this may be caused? When I connect a noise~ object to the left inlet of plugout, and a cycle~ object to the right inlet of plugout~, I can hear the stereo sound working perfectly fine. (Note: I am using Max 8)

Max Patch
Copy patch and select New From Clipboard in Max.

ghost from the past's icon

insert 2 meter~ objects at plugin~ outputs to see what is coming in.

Beside that, why don't you use tapin~ / tapout~ in stereo

with feedback set to freeze or not instead of that many objects ?

record start fades audio input in, clears delay if needed and closes feedback.

record stop does the opposite.