Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  volume control for xobox on Sansa ClipV2
« previous next »
  • Print
Pages: [1]

Author Topic: volume control for xobox on Sansa ClipV2  (Read 1733 times)

Offline adw

  • Member
  • *
  • Posts: 9
volume control for xobox on Sansa ClipV2
« on: October 14, 2011, 02:14:20 PM »
Hi,

I'm trying to add volume control (for music playing) to the "xobox" game. Currently the volume keys are non functional. I have tried to add

#include "misc.h"
#include "settings.h"
...
        switch (button) {
...
            case BUTTON_VOL_UP:
                global_settings.volume++;
                setvol();
                break;
            case BUTTON_VOL_DOWN:
                global_settings.volume--;
                setvol();
                break;

but I get

/home/user/rockbox/build/apps/plugins/xobox.o: In function `plugin_start':
xobox.c:(.text+0xcd8): undefined reference to `setvol'
xobox.c:(.text+0xcf0): undefined reference to `setvol'
xobox.c:(.text+0x152c): undefined reference to `global_settings'

Can anyone help me?
« Last Edit: October 14, 2011, 02:25:57 PM by adw »
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: volume control for xobox on Sansa ClipV2
« Reply #1 on: October 14, 2011, 02:25:47 PM »
Theres no setvol function in plugins.h.  Just looking around at what other plugins do, I believe you want:

rb->sound_set(SOUND_VOLUME, vol);

mpegplayer controls all kinds of playback options, so its probably worth looking at as well.
Logged

Offline adw

  • Member
  • *
  • Posts: 9
Re: volume control for xobox on Sansa ClipV2
« Reply #2 on: October 19, 2011, 03:26:07 AM »
Thanks a lot, that worked well.

I have decided to make the volume keys change volume when the game is active, or change track when the game is paused:

Code: [Select]
        switch (button) {
...

            case BUTTON_VOL_UP:
                if (!pause) {
                    limit = rb->sound_max(SOUND_VOLUME);
                    if (++rb->global_settings->volume > limit)
                        rb->global_settings->volume = limit;
                    rb->sound_set(SOUND_VOLUME, rb->global_settings->volume);
                } else {
                    rb->audio_next();
                }
                break;
            case BUTTON_VOL_UP|BUTTON_REPEAT:
                if (!pause) {
                    limit = rb->sound_max(SOUND_VOLUME);
                    if (++rb->global_settings->volume > limit)
                        rb->global_settings->volume = limit;
                    rb->sound_set(SOUND_VOLUME, rb->global_settings->volume);
                }
                break;
            case BUTTON_VOL_DOWN:
                if (!pause) {
                    limit = rb->sound_min(SOUND_VOLUME);
                    if (--rb->global_settings->volume < limit)
                        rb->global_settings->volume = limit;
                    rb->sound_set(SOUND_VOLUME, rb->global_settings->volume);
                } else {
                    rb->audio_prev();
                }
                break;
            case BUTTON_VOL_DOWN|BUTTON_REPEAT:
                if (!pause) {
                    limit = rb->sound_min(SOUND_VOLUME);
                    if (--rb->global_settings->volume < limit)
                        rb->global_settings->volume = limit;
                    rb->sound_set(SOUND_VOLUME, rb->global_settings->volume);
                }
                break;
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  volume control for xobox on Sansa ClipV2
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.053 seconds with 15 queries.