Shop OBEX P1 Docs P2 Docs Learn Events
P2 audio093b-8-sc - Syntax trouble? — Parallax Forums

P2 audio093b-8-sc - Syntax trouble?

Helo All

This Method in the code: pub start(mbox,scope,cache) :cog,base | iii
Shows this message:
Error - Expected a unique paramenter name (scope)

Question: May be it lost part of the code or the "scope" need be defined in some place?

Thanks

Comments

  • JonnyMacJonnyMac Posts: 8,929
    edited 2022-11-28 21:13

    I believe scope is a keyword used by the Spin2 debugger. You may want to change the name of that parameter in the code where it's used.

  • pik33pik33 Posts: 2,350
    edited 2022-11-29 07:27

    It may be. The driver was written using Flexprop, where there is no "scope" debug.

    Also, Flexprop treats names in different way than Propeller Tool. In Flexprop there can be 'scope' as the parameter and then I can use 'scope' in the dat section. Propeller Tool doesn't like this.

    Until I can look and correct the problem, try to rename the 'scope' variable in the 'start' method.

  • pik33pik33 Posts: 2,350

    Try this version. I renamed the variable and moved the label in PASM section - Propeller Tool didn't like the label in org line.

  • @pik33

    There is something in the new version that is blocking it to work

  • @pik33

    Could be the not included "sinus.s2" file?

  • pik33pik33 Posts: 2,350
    edited 2022-11-30 07:28

    No, it doesn't need it. I left it commented out for testing purpose. It is simply a sine wave sample.

    I didn't test this driver with a Propeller Tool, so there may be more incompatible things in it. Can you put your not working test code here so I can check what doesn't work?

    You can also try if it works OK when compiled with Flexprop.

  • pik33pik33 Posts: 2,350
    edited 2022-12-01 08:33

    The file compiles with the newest Propeller Tool

    It will not do anything visible or hearable after compiling as standalone program. This is a driver. It is intended to be used as an object in the program. While compiled and uploaded to a P2 standalone, it will do nothing useful.

    You have to write your program, which will initialize the driver, prepare samples for it, then tell the driver what to play.

    To do this, you call start method, which will return driver's cog number and a pointer to virtual register block. To play something you have to prepare your samples and det these registers to proper values as in description.

    I will check if the driver works with Propeller Tool - I have to write a small test program to check this. I will put it then to the driver's github folder.

  • @pik33
    Thank you very much!

  • pik33pik33 Posts: 2,350
    edited 2022-12-01 14:41

    This test program should generate (a loud) sawtooth sound - tested on both Propeller Tool and Flexprop, at pins 14,15 - pins are defined at the start of the driver code.

    Edit: parameters in the start call are not used, except 0 as the first parameter which means don't use PSRAM. The $61000 is the PSRAM cache address, not used here as we have no PSRAM in this test.
    $60000 is the scope data address so you can visualize your audio.

    Normally you should allocate the RAM for these as variables and pass the pointers to the driver.

    To do: make the rest of driver versions Propeller Tool compatible - "scope" has to be renamed, a label "audio" has to be moved under org line.

  • @pik33

    Great!!!

    Thank you a lot.

Sign In or Register to comment.