How to clear buffer when it can't load new file?

    Apr 07 2014 | 10:55 pm
    I'm in a pickle again.
    I am loading a sequence of audio files into a buffer, sometimes the files will not be there and it will give me an error message saying 'Can't open ____'. This is ok, but I want it to then clear the buffer with silence if it cannot find a new file, rather than repeatedly playback the file that's already in the buffer.
    Any ideas? Is there a way to tap into the error messages in the Max window and trigger events (such as clearing a buffer) if particular error messages show up?

    • Apr 07 2014 | 11:50 pm
      You could use the error object to do this. Other options are the absolutepath object (to check the file path to see if its valid) and the bang outlet of buffer~:
    • Apr 07 2014 | 11:56 pm
      Your absolutepath method is a wonderfully elegant way to achieve exactly what I needed. Thank you so much!
    • Apr 08 2014 | 12:04 am
    • Apr 08 2014 | 12:17 am
      Ah. Too slow. Ben's kung fu is strong.
    • Apr 08 2014 | 1:00 am
      setting a size again should also clear it.