Git Product home page Git Product logo

arduino-rtttl-player's People

Contributors

lovesegfault avatar ponty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

arduino-rtttl-player's Issues

Bug in use of read_word, as demonstrated by failing Ram.pde

The example testing the use of songs stored in Ram (Ram.pde) reveals a bug (which is implicit also in the other examples). In my environment at least, the Ram version of the examples doesn't play correctly, and never could.

That's because the notes array is declared as...

const prog_uint16_t notes[] PROGMEM

...and the read_word function is mistakenly invoked with a boolean which actually records whether the const char *p for the song should be interpreted as progmem or not, not the notes array.

This bug in the logic therefore confuses the reading of the notes[] array if the song is NOT stored in progmem.

The result is that if that the line in the _play(...) function which reads...

_tone(read_word(&notes[(scale - 4) * 12 + note], pgm));

...breaks when pgm is false, or in other words, mistakenly tries to access the PROGMEM notes array as if it was in ordinary RAM, just because pgm is false (the song itself happens to be stored in RAM). This creates junk notes on playback. Changing this line in rtttl.h so it reads...

_tone(read_word(&notes[(scale - 4) * 12 + note], true));

...should fix the problem for all playback types.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.