Commit graph

29 commits

Author SHA1 Message Date
Rafaël Carré
0928cdf074 pitch_detector: don't use a struct with only one member
use fixed point type (fixed == int32_t) directly

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28072 a1c6a512-1295-4272-9138-f99709370657
2010-09-14 06:34:01 +00:00
Rafaël Carré
bd737477bf pitch_detector: build with -std=gnu99
casts in const tables declaration seesm to confuse gcc into thinking the
initializers are not constant

Also merge struct declaration and typedef

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28020 a1c6a512-1295-4272-9138-f99709370657
2010-09-07 14:09:16 +00:00
Rafaël Carré
da16248e47 Plugins: modify IRAM copying code
Move to plugin_crt0.c, plugins don't need PLUGIN_IRAM_* macros anymore
IRAM is no longered zeroed before copying (as it is at the same address
than BSS) -> Fix FS#11581
Use cpucache_invalidate() (and not cpucache_flush), needed for self-modifying code on cached IRAM

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27948 a1c6a512-1295-4272-9138-f99709370657
2010-08-30 20:47:53 +00:00
Rafaël Carré
cf2ce17d09 pitch_detector: use lcd_putsxyf(), not lcd_putsf()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27922 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 21:46:22 +00:00
Rafaël Carré
e78a12bca7 pitch detector: remove more unused functions for sim builds
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27920 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 19:15:07 +00:00
Rafaël Carré
0bdd362ab9 pitch detector: remove unused functions for sim builds
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27919 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 19:07:38 +00:00
Rafaël Carré
e09ebc4213 pitch_detector: cleanup
- cosmetics: remove trailing white space
- mark all functions and variables as static
- merge struct definition and declaration when possible
- rename tuner_settings -> settings (because it's shorter)
- remove unused enums
- don't give pointer to settings struct as argument since there is only
  one struct, same for the settings filename
- fix error cases in settings load:
    reset settings when loading failed
    close file when it hasn't the right size
- inline small load/save functions only used once
- remove unused print_char_xy
- inline print_str and print_int_xy, and use lcd_putsf (added to the
  plugin API)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27918 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 17:52:31 +00:00
Rafaël Carré
5628096e51 pitch_detector: avoid a division by zero when changing 'lowest frequency' setting
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27917 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 17:52:27 +00:00
Thomas Martitz
cae4ae2c71 Second try: Introduce plugin_crt0.c that every plugin links.
It handles exit() properly, calling the handler also when the plugin returns
normally (also make exit() more standard compliant while at it).
It also holds PLUGIN_HEADER, so that it doesn't need to be in each plugin anymore.

To work better together with callbacks passed to rb->default_event_handler_ex() introduce exit_on_usb() which will call the exit handler before showing the usb screen and exit() after it.
In most cases rb->default_event_handler_ex() was passed a callback which was manually called at all other return points. This can now be done via atexit().

In future plugin_crt0.c could also handle clearing bss, initializing iram and more.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27873 a1c6a512-1295-4272-9138-f99709370657
2010-08-24 14:30:46 +00:00
Thomas Martitz
93cb949372 Revert "Introduce plugin_crt0.c that every plugin links."
Too much errors and no time to fix them now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27863 a1c6a512-1295-4272-9138-f99709370657
2010-08-23 17:12:26 +00:00
Thomas Martitz
abdc5935be Introduce plugin_crt0.c that every plugin links.
It handles exit() properly, calling the handler also when the plugin returns
normally (also it makes exit() more standard compliant while at it).
It also holds PLUGIN_HEADER, so that it doesn't need to be in each plugin anymore.

To work better together with callbacks passed to rb->default_event_handler_ex introduce exit_on_usb() which will call the exit handler before showing the usb screen and exit() after it.
In most cases it was passed a callback which was manually called at all other return points. This can now be done via atexit().

In future plugin_crt0.c could also handle clearing bss, initializing iram and more.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27862 a1c6a512-1295-4272-9138-f99709370657
2010-08-23 16:56:49 +00:00
Michael Sevakis
b15a523870 e200v1/c200v1: Implement limited samplerate switching. Rates 24kHz and below are being a bear as far as minor crackling at higher amplitude-- leave them out for the time being since no solution is currently evident. 48, 44, 32 (rec rates 24, 22, 16) seem perfectly fine. I'm betting c200 is ok to include because it uses the same setup as e200.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27139 a1c6a512-1295-4272-9138-f99709370657
2010-06-26 10:07:17 +00:00
Michael Sevakis
d56999890f Make PCM->driver interface about as simple as it will get. Registered callback, zero data, alignment and stops are handled entirely inside pcm.c; driver merely calls fixed pcm.c callback. Remove pcm_record_more and do it just like playback; the original reason behind it isn't very practical in general. Everything checks out on supported targets. There wer some compat changes I can't check out on many unsupoorted but if there's a problem it will be a minor oops. Plugins become incompatible due to recording tweak-- full update. Sorted API.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26253 a1c6a512-1295-4272-9138-f99709370657
2010-05-24 16:42:32 +00:00
Thomas Martitz
20e9d56ba5 S#10387 - Rework pluginlib actions
It changes pluginlib actions to contain only a single and simple context (and
other one for remote directional buttons),
consisting of 7(9) buttons: up/down/left/right, select OR short select and long
select, exit and cancel (plus 2 for scrollwheel targets).
This ensures contexts don't clash with other contexts and simplifies them, at
the expense of reduced versatility. However, the versatility made it largely unusable
due to the great number of targets.
This should allow for using pluginlib actions safely for the most simple plugins (e.g. almost all demos).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26202 a1c6a512-1295-4272-9138-f99709370657
2010-05-20 17:41:28 +00:00
Michael Sevakis
3d1a85695b Give pitch_detector the IRAMming it deserves.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26018 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 12:35:05 +00:00
Michael Sevakis
d665c92652 Cache align the pitch detector audiobuffer where needed. Some other misc. changes to try to make sure everything builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26011 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 08:44:07 +00:00
Michael Sevakis
ef0b8caac0 Fix some sim warnings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26006 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 06:41:40 +00:00
Michael Sevakis
7250405c70 pitch_detector: Use continuous recording, even if the algorithm is too slow for that and record a whole buffer even if the min frequency is higher. Use the minimum samplerate that allows C-4186 to be detected (usually 11.025kHz, which can reduce computational load to 1/16 compared to 44.1kHz). Get rid of 64-bit multiplies when calculating input RMS value. Stop audio playback when entering plugin. Better backlight and CPU frequency handling. audio_sample_type->int16_t. simpler buffer size rounding.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26005 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 06:25:40 +00:00
Rafaël Carré
289b6bdb69 fix pitch_detector: recording will stop itself if the callback returns <0
stopping recording 2 times might have harmful effects

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26002 a1c6a512-1295-4272-9138-f99709370657
2010-05-13 21:32:06 +00:00
Thomas Martitz
c61e89c0ed Make creat() posix compliant API-wise. Shouldn't affect the core as it's wrapped via a static inline.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25843 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 17:35:04 +00:00
Rafaël Carré
4fd9038d35 pitch_detector: fix builds on monochrome targets, remove an unused variable
Add icons for Clip, copied from c200 icons

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25397 a1c6a512-1295-4272-9138-f99709370657
2010-03-29 23:50:07 +00:00
Nils Wallménius
f76b5d5490 Fix division by 0 by clamping freq value a little higher, some minor style and whitespace changes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23850 a1c6a512-1295-4272-9138-f99709370657
2009-12-05 01:00:47 +00:00
Dave Chapman
0d81702f52 Don't assume AUDIO_SRC_MIC always exists.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22907 a1c6a512-1295-4272-9138-f99709370657
2009-10-04 02:31:27 +00:00
Alexander Levin
72578ef558 Clarify the unit of note frequency
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22760 a1c6a512-1295-4272-9138-f99709370657
2009-09-20 17:10:16 +00:00
Alexander Levin
8163ddeb7e Pitch Detector: group note related data together
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22758 a1c6a512-1295-4272-9138-f99709370657
2009-09-20 17:03:30 +00:00
Alexander Levin
16cb628eb7 Pitch Detector: use special functions for choosing bool values
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22755 a1c6a512-1295-4272-9138-f99709370657
2009-09-20 16:33:24 +00:00
Alexander Levin
46bb567ec4 Pitch Detector: add the possibility to set the reference frequency of A (last part of FS#8768)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22753 a1c6a512-1295-4272-9138-f99709370657
2009-09-20 16:16:32 +00:00
Alexander Levin
c38f6072cc UI improvements for the pitch detector (ongoing work by David Johnston from FS#8768)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22685 a1c6a512-1295-4272-9138-f99709370657
2009-09-12 21:19:17 +00:00
Alexander Levin
af23b06b7c New plugin: pitch detector (FS#8768) by Michael Lechner and David Johnston
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22663 a1c6a512-1295-4272-9138-f99709370657
2009-09-08 16:45:05 +00:00