User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: fruitbox MP3 jukebox

Sat Oct 05, 2019 11:32 am

rubenp wrote:
Fri Oct 04, 2019 7:02 pm
Hi Karrika,

looks like you already got further than i could, mine does compile but only with the original MakeFile. Could you share your version of the makefile?
Sure.

Code: Select all

CPP         = g++
CFLAGS      = -O2 -std=c++14 -D_RPI
INC         = -I/opt/vc/include
DEPS        = fruitbox.hpp fruitbox_types.hpp pages.hpp status.hpp playqueue.hpp audio.hpp config.hpp config_base.hpp database.hpp display.hpp \
              engine.hpp fruitbox_logo.hpp info_bkgnd.hpp chooser_arrow.hpp info_font.hpp status_events.hpp userguide.hpp bitmap.hpp joystick.hpp \
              display_base.hpp input.hpp gpio.hpp
OBJ         = fruitbox.o playqueue.o audio.o config.o database.o display.o engine.o pages.o status.o userguide.o bitmap.o joystick.o input.o gpio.o
LIBS        = \
	-lmpg123 \
	-lallegro -lallegro_memfile -lallegro_font -lallegro_ttf -lallegro_primitives \
	-lallegro_image -lallegro_audio -lallegro_acodec -lallegro_video \
	-lm -ldl -L/opt/vc/lib/ -lpthread

%.o: %.cpp $(DEPS)
	$(CPP) -c -o [email protected] $< $(CFLAGS) $(INC)

# ./fruitbox: $(OBJ)
../fruitbox: $(OBJ)
	$(CPP) -Wall -o [email protected] $^ $(CFLAGS) $(LIBS) `pkg-config --libs`

.PHONY: clean
clean:
	rm -f *.o
	rm -f ../fruitbox
	touch Makefile
	touch *.?pp
I also edited away one conflicted line in gpio.cpp:
The value 0x7E000000 + 0x200000 is just arbitrary. I have absolutely no clue of where the GPIO pins sit in a Pi4. So this is WRONG. But as I am not using any GPIO pins for anything I just put in some guess.

Code: Select all

void GpioClass::OpenDevice(void)
{
  #ifdef _RPI
  uint32_t mem_fd;
  void *reg_map;

  if (gpio_base != nullptr) return; // already opened

  // /dev/mem is a psuedo-driver for accessing memory in the Linux filesystem

  if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0)
  {
    error("can't open /dev/mem");
  }
  reg_map = mmap
  (
    NULL,                                        // Address at which to start local mapping (null means don't-care)
    BLOCK_SIZE,                                  // Size of mapped memory block
    PROT_READ|PROT_WRITE,                        // Enable both reading and writing to the mapped memory
    MAP_SHARED,                                  // This program does not have exclusive access to this memory
    mem_fd,                                      // Map to /dev/mem
    0x7E000000 + 0x200000 // Offset to GPIO peripheral
  );

  if (reg_map == MAP_FAILED)
  {
    close(mem_fd);
    error("gpio mmap error.\nTry running fruitbox as sudo (i.e. sudo ./fruitbox --cfg ...)");
  }

  gpio_base = (volatile uint32_t *)reg_map;

  // first save the state of the GPIO registers so they can be restored later...
  for (uint32_t r=0; r<6; ++r)
  {
    gpio_regs.gpfsel[r] = GPFSEL[r];
  }
  // gpio_regs.gpren[0] = GPREN[0];
  // gpio_regs.gpren[1] = GPREN[1];
  // gpio_regs.gpfen[0] = GPFEN[0];
  // gpio_regs.gpfen[1] = GPFEN[1];
  gpio_regs.saved = true;

  cout << NOTE << "Opened GPIO" << endl;
  #endif
}

User avatar
fruitbox
Posts: 311
Joined: Mon Feb 22, 2016 7:35 pm
Location: UK

Re: fruitbox MP3 jukebox

Sat Oct 05, 2019 4:46 pm

Just ordered myself a Pi4, so will be looking into fixing the Pi4 build soon :)

User avatar
fruitbox
Posts: 311
Joined: Mon Feb 22, 2016 7:35 pm
Location: UK

Re: fruitbox MP3 jukebox

Thu Oct 10, 2019 9:05 pm

Hi,

fruitbox v1.15 is now released!

This is the "don't get too excited version", as it only includes minor enhancements and bug fixes. I wanted to get these out of the way before doing any significant changes, and trying to get the Pi4 version working.

Bug-fixes...
  • Fixed input button masking (32-bit to 64-bit to capture all buttons)
  • Fixed album mode Select key combination calculation
  • Identical USB Joystick controllers now treated separately (requires re-run of button config as button codes have been extended)
  • Mouse buttons now correctly identified
  • Correctly initialised/reset Time-remaining value for status HorzScale and VertScale (which means time-elapsed stretched bitmaps correctly disappear when no song playing)
Ease of use improvements...
  • Reduced reliance on console output:
    • Errors now displayed in graphical box
    • Console output now sent to fruitbox.log
    • --user-guide command line option now writes the guide to the file "userguide.txt" rather than the console
  • Added auto database update
    • Added new command line option --no-database-update
Added new skin config parameters...
  • [general] NoDuplicates
  • [general] DuplicatesUseCredits
  • [status] TimerOneShot
  • [status] TimerEnable
Added new status variables...
  • $IF_DUPLICATE_CHOICE
  • $IF_NOT_DUPLICATE_CHOICE
  • $IF_ANY_BUTTON_PRESSED
  • $IF_NOT_ANY_BUTTON_PRESSED
  • $STOP_TIMER
  • $START_TIMER
  • $RESET_TIMER

If you are upgrading from a previous version, you can just grab fruitbox directly by typing the following commands from the rpi-fruitbox-master directory...

Code: Select all

mv ./fruitbox ./fruitbox_prev
wget https://github.com/chundermike/rpi-fruitbox/raw/master/fruitbox
chmod +x ./fruitbox
Please note that if you have mapped USB joysticks / controllers to your buttons, then you will need to reconfigure your inputs again using the --configure-buttons command line option due to the changes to the USB controller input codes.

Cheers,
Mike

Return to “Graphics, sound and multimedia”