Author Topic: BASS_MusicLoad returns error code 41 on macOS  (Read 148 times)

Hunter

  • Posts: 14
Hello,
I am trying to load an XM file from memory and wanted to play it. For that I have converted a XM file into hex array. Everything is working very fine and playing music under Windows system, but I am getting error code 41 (Unsupported file format) when trying to load music from memory using "BASS_MusicLoad" under macOS.

Below is the code:
Code: [Select]
#include <stdio.h>
#include "bass.h"
#include "hwk.h"

int main(int argc, const char * argv[]) {
    printf("Loading bass module...\n");
    int init = BASS_Init(-1, 44100, BASS_DEVICE_DEFAULT, NULL, NULL);
    if(init){
        printf("Bass module loaded successfully\n");
        int music = BASS_MusicLoad(TRUE, table, 0, sizeof(table), BASS_SAMPLE_LOOP, 0);
        if(music){
            printf("Music loaded successfully\n");
            BASS_ChannelPlay(music, FALSE);
            getchar();
        }else{
            printf("Unable to load music into memory\n");
            printf("Error: %d\n", BASS_ErrorGetCode());
        }
    }else{
        printf("Unable to load bass module, exiting...\n");
    }
    return 0;
}

The converted XM to hex array (included in hwk.h header file):
https://paste.ee/p/ChClU

Can anyone help me out?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS_MusicLoad returns error code 41 on macOS
« Reply #1 on: 10 Jul '17 - 17:09 »
Are you sure the exact same code and "table" data is working on Windows? I think the "table" array's type should be "unsigned char" rather than "unsigned long".

Hunter

  • Posts: 14
Re: BASS_MusicLoad returns error code 41 on macOS
« Reply #2 on: 10 Jul '17 - 17:15 »
How stupid I am  ???

Thanks for your help.