Announcement

Collapse
No announcement yet.

to (Name), print (number,".wav");

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • to (Name), print (number,".wav");

    So this is my question: on my last soft I was using this to play sound from file so I can hear numbers.

    to (FileName),print(Number,".wav");file_PlayWAV(FileName);

    ( so file may be "5.wav" or "8.wav"... )
    It doesn't work with workshop 4 (syntax error)
    How do you do this now ?
    Thanks

  • #2


    The correct syntax has always been

    to (FileName);print(Number,".wav");

    It may have been that an earlier compiler release allowed a , but I am not aware of if/when that was fixed up.
    Mark

    Comment


    • #3


      Thanks you, you're wright.

      I was using this (bad) wrinting before but it was working correctly with old workshop.

      Comment


      • #4
        Sorry, it was working "yesterday", it's not working anymore. I's not exactly what you see under but it's the same problem.Thanks for help
        HTML Code:
        var Name,Number;
        
            Number:=5;
            to (Name);print(Number,".wav");
            file_PlayWAV(Name);
        Of course Number will correspond to wav file on SD card (here "5.wav")It cause a sound loop (with previous file sound) as soon it arrived to line "to(name)..."

        Comment


        • #5


          try
          file_PlayWAV(str_Ptr(Name));
          Mark

          Comment


          • #6


            I have a sound but only same last sound, not number file sound ( on SD card I have "1.wav", "2.wav".... )
            This finally used by a "TellNumberProcedure" but, here, just for test.

            (xG declared as "var")

            //test
            file_PlayWAV("ding0.wav"); // pour test a effacergfx_Set(CONTRAST, 16);AfficherImage(IndexImage1,0,0); // xG:=1; to (FileName);print(xG,".wav"); //file_PlayWAV(str_Ptr(FileName)); file_PlayWAV(FileName); pause(1000); repeat forever // test end
            rem line does same thing than the other one: I can ear the first sound played ("ding0") but not the "number sound file" second file who became like the first one (two "ding0" sounds). Also, screen picture disapear at same time as second sound.
            I think the problem cam from another part of soft or in the FileName transfer.

            Comment


            • #7
              This code from your previous post...
              HTML Code:
              var Name,Number;
              
                  Number:=5;
                  to (Name);print(Number,".wav");
                  file_PlayWAV(Name);should look like this[HTML]var Name[15],Number;
              
                  Number:=5;
                  to (Name);print(Number,".wav");
                  file_PlayWAV(Name);
              That gives enough space to save the filename, otherwise it will start writing over other variables when you use "to(Name);print(Number,".wav");" and cause all sorts of strange stuff to go wrong.This is probably the same problem in your last post. "Filename" should be declared like thisvar Filename[15];[/HTML](I just picked 15 randomly, it probably only needs to be 7 at most)

              Comment


              • #8


                I'm pretty sure your're wright and will test in a few hours. I suppose this explain why sometime it was working, depending of memory utilisation.

                Comment


                • #9


                  Yeah, I've had this problem more than once when I did the same thing you did.

                  Comment


                  • #10


                    So thank you IPaq3115 and ESPsupport

                    I had to do two things:

                    - first, of course, I had to reserve place for file name (I wonder how it worked before because I never had number talking error but probably 4DGL soft was different and allowed this "error")

                    - but it was not only the problem, it just resolve strange reaction (screen picture disapear, old sound ...) . In fact I had also to change line file_PlayWAV(Nom); to file_PlayWAV(str_Ptr(Nom));

                    Now it work's perfectly !

                    Comment

                    Working...
                    X