Menu

midi files cause rabbit to crash

Help
2007-02-24
2013-04-29
  • Nobody/Anonymous

    Hello,

    I am including a midi file in my response to the rabbit via the following code:

       
        List<ProgramFrame.Sound> sounds = new List<ProgramFrame.Sound>();
        byte[] sound = File.ReadAllBytes("song.mid"); // I have verified that this midi file is being read properly
        ProgramFrame.Sound sound_frame = new ProgramFrame.Sound(sound);
        sounds.Add(sound_frame);
        ProgramFrame sound_program = new ProgramFrame(m_Identifier, 1, sound, sounds);
        Response.Append(sound_program);

    ...but whenever I send this response, the rabbit crashes (i.e., stops polling the server)!  This crash occurs even if the assembly code does not instruct the rabbit to actually play the midi.  I have tried this with a variety of midi files, but I get the same result each time. 

    Am I doing something obviously wrong?  Any ideas?

    Thanks

     
    • Tim Franssen

      Tim Franssen - 2007-02-24

      You must be sending the Rabbit an incorrect package somehow, it can't be a midi specific issue on the rabbit side, as long as you´re not playing the thing. And there's no way of telling what goes wrong unless we get to see a bit more code. Or are you trying to use the Nabazlab source?

      You could try to add an incorrect opcode interrupt handler in the Nabatag firmware that you're sending to see if the rabbit is getting garbage. Also, a packet sniffer could do you a lot of good.

      Good luck!

       
    • Emmanuel

      Emmanuel - 2007-02-26

      Hi,

      The ProgramFrame constructor you are using is:
      public ProgramFrame(int Identifier, byte Transition, byte[] ByteCode, IEnumerable<Sound> Sounds)

      The third parameter is the assembled bytecode, not a sound. So in place of:
      ProgramFrame sound_program = new ProgramFrame(m_Identifier, 1, sound, sounds);

      I think you should be doing:
      ProgramFrame sound_program = new ProgramFrame(m_Identifier, 1, bytecode, sounds);

      Hope that helps,
      Emmanuel.

       

Log in to post a comment.