PS2 OPL SND TEST

Status
Not open for further replies.
Would a stalled thread on the IOP stall the whole app (stuff like the animation)?

@Krah: Hm... EE-SIO might be an alternative... ;)

If it still freezes when changing the stuff according to @sp193's ideas and without calling sfxRead() again, then there could be quite some possible places where to search for the cause of the issue... Maybe someone with an EE-SIO-connection could help out.

Does the debug-build which prints on-screen-information work for you?

If it does, you could add some print(f)'s after every action and for the return-values of AUDSRV. Maybe an unexpected answer stalls/crashes the EE-Thread (backend/RPC-Thread)... [an 'exception']

...or AUDSRV does stall... Does it support stopping access to a voice-channel, 'flushing' the path and load a new path (during runtime, without a reinit of the lib)?


On another note... Last time I tried, PS2Link didn't compile anymore and I can't find the newest as a pre-compiled build.
 
You don't need a TOOL or the SIO mod. Even if you cannot start OPL via ps2link (although you should be able to), you can still boot OPL from LaunchELF or whatever you want. The TTY driver is loaded from OPL, so printf() output will still go over the network.
Just use ps2client to listen for messages from the PS2, with the listen option. You will likely need the -h option to specify the IP address of the PS2, unless you are on Windows.

The EE SIO is only very useful if you must somehow work without a working SIF implementation (and perhaps, that was the SIO interface's official purpose).
Otherwise, we have printf() for that purpose. I never used the SIO for debugging any project, so you will likely not need it too.

In place of the TOOL, there is also RDB, which can complete the DECI2 implementation on a CEX console. Although it has various limitations and many bugs.
 
I forgot about the TTY, but I really should have mentioned RDB (your TDB-Version)!

Thank you for reminding me to TTY in OPL and PS2Client's 'listen-function'!
 
@sp193
You pointed out earlier audsrv_adpcm_init() sets the core 1 master volume to 0x3fff (max_volume) at init. would it be possible to edit this so it can be changed with audsrv_set_volume() as currently that call seems to only affect PCM functions ie audsrv_play_audio().

Any calls to audsrv_set_volume() does not affect ADPCM to the point its not even necessary to call it at startup as its already set to default max_volume within audsrv_adpcm_init().

The only reason I would like to do this is that i've had reports of the sfx being too loud, of course I could edit the files themselves and decrease the volume but as @TnA said to me this is just a work around and if the end user wants to use their own sfx they may find theirs being far too loud and no volume adjustment within the settings.

If this seems like too much hassle and you simply don't have time, that is totally understandable. I was leaning towards just editing the default sound files and decreasing the volume anyway but thought I would ask :)
 
  • Like
Reactions: TnA
Would you mind pulling the latest OPL-Changes (@Maximus32's last commit(s), to implement the change that HIRES is no longer a compile-time-flag)?

...even tho' your branch still needs some small changes, I think it's quite close to an initial merge of the feature...

...and I really think, OPL should be tagged '0.9.4' finally and if there are many bugs, there could be a '0.9.5'-release sooner than it currently takes since '0.9.3'.



Edit: Oh, I see! You just merged the changes to your repo! Would you mind posting an open Test-build again? I can compile it but would like to officially share a test-ELF (i.e. on psxtools.de and Ps2-home [or you share it on the second forum/board on your own...] ;) ).
 
Last edited:
...and I really think, OPL should be tagged '0.9.4'
While I agree it would be nice to see a 0.9.4 release, I really have no say in this what so ever.

Would you mind posting an open Test-build again?
Here you go.
Can you let me know if im still missing any sound calls, I still haven't been able to test on anything other than pcsx2.

Interestingly decreasing the sound files volume 25% makes no audible difference on pcsx2, I am curious if it is the same on the real hardware (volume sounds at the same level).
 

Attachments

Last edited:
IMO, it is noticeable!
But there seems to be a small glitch. The first time I press Start, that sound is played louder and if I return back and press Start again, it seems to have a lower volume...

Btw.: I think another (and) easier, yet more effective (but still a) workaround would be, to initialize the sound-lib with a lower value to begin with (during init).
 
Btw.: I think another (and) easier, yet more effective (but still a) workaround would be, to initialize the sound-lib with a lower value to begin with (during init).
Not possible unfortunately without changing the lib itself (which is in the SDK).
If you take a look a couple posts back there is a link to the audsrv_adpcm_init() function, in that function the volume is set to max any calls to audsrv_set_volume() do not adjust adpcm volume. I even tried setting the volume to mute just to see what would happen and it was still max...

Although now I think about it I only tested on pcsx2....I really need to get my ps2 plugged back in..
 
Yes, please give it a try on the real hardware! :)

Edit:
Not possible unfortunately without changing the lib itself (which is in the SDK).

Sure, but isn't that basically just one value which needs to be changed in AUDSRV?

If you are concerned about changing a lib just for one project (within the PS2SDK), the changed file(s) could be excluded and linked from the OPL-Source-folder, just like uLE's 'changed sources for external projects' or however it was named...
 
Last edited:
I can add a feature for controlling the voice channel volume levels, but it cannot be done now.

You might want to complete the rest of the system first.
 
I can add a feature for controlling the voice channel volume levels, but it cannot be done now.
That's great! It would also be handy, if Per-game-sounds and BGM would ever be part of the support, to blend out BGM (turn it down in 1-5% steps after a few ms, until it reaches 0% to 'fade out' the sound pretty fast, instead of cutting/muting it all together) once game-sounds are ought/meant to be played.

You might want to complete the rest of the system first.
@Krah : Well, that's what I wrote you in the PM. There are still other places of the structure, to work at. ;)
  • Streaming of files bigger than *insert file-size here (i.e. 0.5MB)* , is one of these. ;) That would be necessary for BGM (longer than a loop of a few seconds) and per-game-sounds atleast...
  • A bit additional work on the path-routine (where to get external sounds from) would be needed, to ever support per-theme-sounds, or per-game-sounds.
  • The problem of loading new sounds during runtime (without a restart of OPL) would need to be fixed as well, atleast for the per-game-sounds...
  • Some things are missing sounds... (especially the buttons on the right side of the OSD-Keyboard)
  • etc.

Btw.: Shouldn't the errors like 'HDD not found' be linked to the error- or alert-sound? Maybe it is and I just imagine things...


Edit: If this function could control every voice-channel separately AND the master-volume, the Audio-Settings could get quite some new toggles/bars (i.e. master- & per-sfx-volume-control), etc.

...and sound-files would not need to be 'normalized' or reconverted with a lower volume. That's quite cool as well!
 
Last edited:
I can add a feature for controlling the voice channel volume levels, but it cannot be done now.
That would be great thank you, no rush.

Btw.: Shouldn't the errors like 'HDD not found' be linked to the error- or alert-sound? Maybe it is and I just imagine things...
what does this error msg look like?? Is it just a msgbox like selecting power off for example? I've never seen/had this error as I have and have always had a HDD.

Edit: If this function could control every voice-channel separately AND the master-volume, the Audio-Settings could get quite some new toggles/bars (i.e. master- & per-sfx-volume-control), etc.
I don't think it's necessary to control each individual voice channel. A setting to control all 24 voice channels volume would be fine. Something like audsrv_adpcm_volume() as set_volume() already handles the pcm master volume.
 
  • Like
Reactions: TnA
I don't think it's necessary to control each individual voice channel. A setting to control all 24 voice channels volume would be fine. Something like audsrv_adpcm_volume() as set_volume() already handles the pcm master volume.
Anyway, with its current design, it isn't possible to control each of the 24 channels as volume levels for 24 unique ADPCM samples. AUDSRV will currently pick a free channel to play any ADPCM sample that you tell it to play, as long as it is loaded into SPU2 memory.
 
@sp193
I've been playing around with a bgm thread but I'm not having much luck, I tried to split the code into multiple functions so only the playing part is the actual running thread.

Code:
//bgm gubbins
static int wav;
static int bgm_thread_id = -1;
static int gEnableBGM = 1; //this is here for testing until an option is made in settings

static unsigned char bgm_stack[0xA00] ALIGNED(128);

extern void *_gp;

static int bgmFormat(void)
{
    int ret;
    struct audsrv_fmt_t bgm_fmt;

    bgm_fmt.bits = 16;
    bgm_fmt.freq = 22050;
    bgm_fmt.channels = 2;

    if ((ret = audsrv_set_format(&bgm_fmt))!= 0)
    {
        printf("Error setting audio format %d\n", ret);
    }
    else audsrv_set_volume(MAX_VOLUME);

    return ret;
}

static int bgmLoad(const char *bgm_path)
{
    wav = fileXioOpen(bgm_path, O_RDONLY);
    if (wav >= 0) {
        printf("Failed to open wav file \n");
        return -ENOENT;
    }

    return 0;
}

static int bgmPlay(void)
{
    int ret;
    char chunk[2048];

    fileXioLseek(wav, 0x30, SEEK_SET);

    while (1)
    {
        ret = fileXioRead(wav, chunk, sizeof(chunk));
        if (ret > 0)
        {
            audsrv_wait_audio(ret);
            audsrv_play_audio(chunk, ret);
        }

        if (ret < sizeof(chunk))
        {
            fileXioLseek(wav, 0x30, SEEK_SET);
        }
    }

    return 0;
}

static void bgmThread(void *args)
{
     while (gEnableBGM)
    {
        if(!gEnableBGM){
            audsrv_stop_audio();
            SleepThread();
            continue;
        }

    bgmPlay();

    }

    printf("Close Thread\n");
    ExitDeleteThread();
}

int bgmInit(void)
{ 
    int ret;
    char bgm_path[256];
    char device_path[128];
    ee_thread_t bgm_thread;

    bgmFormat();

    getAudioDevice(device_path);
    sprintf(bgm_path, "%s/bgm.wav", device_path);

    ret = bgmLoad(bgm_path);

    bgm_thread.gp_reg = &_gp;
    bgm_thread.func = &bgmThread;
    bgm_thread.stack = bgm_stack;
    bgm_thread.stack_size = sizeof(bgm_stack);
    bgm_thread.attr = 0;
    bgm_thread.initial_priority = 0x29;
    bgm_thread_id = CreateThread(&bgm_thread);

     if (bgm_thread_id >= 0)
    {
        ret = StartThread(bgm_thread_id, NULL);
        if (ret < 0) printf("bgmInit: StartThread returned %d\n", ret);
    }
    else
        printf("CreateThread failed: %d\n", bgm_thread_id);
  
    return ret;
}

I made bgmInit part of the deferredinit, I thought that would be the best place for it?
Code:
static void deferredAudioInit(void)
{
    int ret;
    ret = sfxInit();
    if (ret >= 0)
        LOG("sfxInit: %d samples loaded.\n", ret);
    else
        LOG("sfxInit: failed to initialize - %d.\n", ret);
  
    ret = bgmInit();
    if (ret >= 0)
        LOG("bgmInit: bgm loaded.\n");
    else
        LOG("bgmInit: failed to initialize.\n");
}

Are there any major problems you can see straight off the bat? I'm not sure if the chunk size needs to be smaller as some sram is already taken up by sfx.
 
  • Like
Reactions: TnA
I have made some changes to AUDSRV:
  • MIN_VOLUME and MAX_VOLUME on the EE will now be defined as 0 and 100 respectively, to fit the local functions.
  • audsrv_play_adpcm was changed to audsrv_ch_play_adpcm, so that the channel can be specified.
  • Added audsrv_adpcm_set_volume().

By the way, have you managed to successfully use ps2link with OPL yet? If you had issues booting the packed file, have you tried booting opl.elf?

Code:
static int bgmLoad(const char *bgm_path)
{
    wav = fileXioOpen(bgm_path, O_RDONLY);
    if (wav >= 0) {
        printf("Failed to open wav file \n");
        return -ENOENT;
    }

    return 0;
}

open() will always return >=0 on success, which is the File Descriptor (FD). So you should be checking if wav is < 0 instead.

Code:
static void bgmThread(void *args)
{
     while (gEnableBGM)
    {
        if(!gEnableBGM){
            audsrv_stop_audio();
            SleepThread();
            continue;
        }

    bgmPlay();

    }

    printf("Close Thread\n");
    ExitDeleteThread();
}

Have you decided on what willbedone if/when gEnableBGM is suddenly changed to 0?
Depending on what the thread was doing when you change gEnableBGM, it can either:
  • Terminate & delete itself (Run &rarr; Dormant &rarr; Deleted).
  • Stop audio playback & sleep (Run &rarr; Sleep). There seems to be no code that will ever delete/wake up the thread, so how will this be restarted?

Code:
int bgmInit(void)
{
   ...
    ret = bgmLoad(bgm_path);
    ...
}

You aren't checking the return value of bgmLoad(). So if bgmLoad() doesn't actually load the WAV, then the following actions will result in undefined behaviour.

I made bgmInit part of the deferredinit, I thought that would be the best place for it?
Code:
static void deferredAudioInit(void)
{
    int ret;
    ret = sfxInit();
    if (ret >= 0)
        LOG("sfxInit: %d samples loaded.\n", ret);
    else
        LOG("sfxInit: failed to initialize - %d.\n", ret);
 
    ret = bgmInit();
    if (ret >= 0)
        LOG("bgmInit: bgm loaded.\n");
    else
        LOG("bgmInit: failed to initialize.\n");
}

Yes, you could probably do that.

I'm not sure if the chunk size needs to be smaller as some sram is already taken up by sfx.

By the documentation, the memory for ADPCM begins at address 0x5010 of local memory. The documentation also states that the ring buffers for PCM audio begins at the start of local memory (0x4000-0x4FFF). The hardware will access that region of memory. So there should be no need to worry about PCM.
 
I have made some changes to AUDSRV:
This is great, thank you..Had a play around with it last night.

By the way, have you managed to successfully use ps2link with OPL yet? If you had issues booting the packed file, have you tried booting opl.elf?
I haven't had much time with the actual ps2 unfortunately but I do remember I was using opl.elf. Next time I get a chance I will try again as I know I really need to be able to identify where stalls/issues are happening.

Have you decided on what willbedone if/when gEnableBGM is suddenly changed to 0?
Depending on what the thread was doing when you change gEnableBGM, it can either:
  • Terminate & delete itself (Run &rarr; Dormant &rarr; Deleted).
  • Stop audio playback & sleep (Run &rarr; Sleep). There seems to be no code that will ever delete/wake up the thread, so how will this be restarted?
I hadn't really got that far to be honest, I know that's probably not the best way to do things but for the mean time I was just trying to get the wave file to play (currently I'm not getting any bgm playback with this code). I'd probably just stop audio and sleep the thread, wake/resume at some point but that's one big issue atm; I can't figure out where to reinit things in the existing opl code, paths & volume for example as well as the thread itself.

I thought the best place would be applyconfig() in opl.c since that's where rendermodes, themes, scrollspeed etc changes are reinit but adding a simple call to setVolume()
Code:
void setVolume(void)
{
    int i;
    for (i=0; i<NUM_SFX_FILES; i++)
    {
         audsrv_adpcm_set_volume(i, gSFXVolume);
    }

    audsrv_set_volume(gBGMVolume);
}
In applyconfig() causes the console/(pcsx2 also) to hang. I had the same problem when trying to reset paths in applyconfig.
 
what does this error msg look like?? Is it just a msgbox like selecting power off for example? I've never seen/had this error as I have and have always had a HDD.
Something like 'Error 203: HDD not found', or similar... I make a short video, when I am at home.

I don't think it's necessary to control each individual voice channel.
Well, I suppose the 'fading' between BGM and any 'per-game-music' (if ever implemented), could also be realized via turning the master-volume down in steps (but still within milliseconds) and turn it up to the specified value (maximum or what's specified in a/the config), just before the 'per-game-sound' would be played.

But it is definitely of less importance! At least some kind of control about the volume - preferably during runtime (which is now possible for the master-volume) - is something crucial (as a 'base' regarding the implementation) for various features!

A setting to control all 24 voice channels volume would be fine. Something like audsrv_adpcm_volume() as set_volume() already handles the pcm master volume.

You are referring to the master-volume (which changes all channels simultaneously), correct?
Yes, that's definitely more than enough for quite a lot new sound-related features (or at least giving it a very good base to expand on). Like I said: Even the fading and BGM-to-'other'-sound-transition and other things would already work with it, so that's fine. :)

Anyway, with its current design, it isn't possible to control each of the 24 channels as volume levels for 24 unique ADPCM samples. AUDSRV will currently pick a free channel to play any ADPCM sample that you tell it to play, as long as it is loaded into SPU2 memory.

Oh, so it just chooses the next free channel, when any SFX is meant to be played? Soooo... Since we currently have only one sfx/sound running simultaneously, that would be the first... Ever... {^.^} lol

This dynamic channel-choice is quite good (i.e. for demos, or where it is not really needed to 'know' on which channel something is), IMO... But without an implementation to control on which channel it is played on, the 'backend' of - OPL - would need to track, which channel it (sounds/SFX) is/are played on (if there are ever more than 1 playing simultaneously) and then it could call (RPC) the lib to lower the volume for the channel it is meant to be played on (which would entirely depend on the implementation of a per-channel-volume-control).

Your function to define on which voice-channel it is played on (libside-extension and controlled from EE via RPCs) is better and can be reused (in other Homebrew-Projects as well as for new features related to sounds in OPL).


However... Control about all voice-channels (individual volume-control) is just NOT very important (but some volume-control during runtime IS important). :)

That (individual voice-channel-control for volume) is far less important, than any of the other things I posted in my previous post!

@sp193
I've been playing around with a bgm thread
That's great! THX for trying to implement it.

but I'm not having much luck, I tried to split the code into multiple functions so only the playing part is the actual running thread.
Yes, that's a good idea (IMO).

Code:
//bgm gubbins
static int wav;
static int bgm_thread_id = -1;
static int gEnableBGM = 1; //this is here for testing until an option is made in settings

static unsigned char bgm_stack[0xA00] ALIGNED(128);

extern void *_gp;

static int bgmFormat(void)
{
    int ret;
    struct audsrv_fmt_t bgm_fmt;

    bgm_fmt.bits = 16;
    bgm_fmt.freq = 22050;
    bgm_fmt.channels = 2;

It would be nice, if bgm_fmt could derive it's values from the audio-file itself, to properly support 1 up to 5.1-voice-channels, with 8 or 16 Bit and varying Frequency.

Btw.: 'gubbins' hehe...

Code:
 if ((ret = audsrv_set_format(&bgm_fmt))!= 0)
    {
        printf("Error setting audio format %d\n", ret);
    }
    else audsrv_set_volume(MAX_VOLUME);

    return ret;
}

So 'MAX_VOLUME' now needs to be changed (not here, but at the location, where it points to), to use the specified volume-value and the new audsrv-function @sp193 implemented.
So basically this quoted part does not need a change, but it is a reminder to implement audsrv_adpcm_set_volume(), at those other places in the source (where it is 'meant to be placed'/needed).

Code:
static int bgmLoad(const char *bgm_path)
{
    wav = fileXioOpen(bgm_path, O_RDONLY);
    if (wav >= 0) {
        printf("Failed to open wav file \n");
        return -ENOENT;
    }

 return 0;
}
Well, like @sp193 already pointed out... ;)

I left the other stuff out, because @sp193 already mentioned it (as I have seen now).

I made bgmInit part of the deferredinit, I thought that would be the best place for it?
Code:
static void deferredAudioInit(void)
{
    int ret;
    ret = sfxInit();
    if (ret >= 0)
        LOG("sfxInit: %d samples loaded.\n", ret);
    else
        LOG("sfxInit: failed to initialize - %d.\n", ret);
 
    ret = bgmInit();
    if (ret >= 0)
        LOG("bgmInit: bgm loaded.\n");
    else
        LOG("bgmInit: failed to initialize.\n");
}
Yes, it should work from there.

Are there any major problems you can see straight off the bat? I'm not sure if the chunk size needs to be smaller as some sram is already taken up by sfx.
I really don't know, how big it should be.

I have made some changes to AUDSRV:
  • MIN_VOLUME and MAX_VOLUME on the EE will now be defined as 0 and 100 respectively, to fit the local functions.
  • audsrv_play_adpcm was changed to audsrv_ch_play_adpcm, so that the channel can be specified.
  • Added audsrv_adpcm_set_volume().
Great (and quite fast)! I haven't expected it so soon (+ the additional stuff).
  1. Interesting and good idea. That makes it more 'standardized' (if another app will use the lib) and quite obvious (in human readable form) to handle/control it.
  2. Oooooh! So now we can say the one and only simultaneously played file (currently) can even be played on channel 9 (or whatever)? That's great! That's indeed greeeaaat! That's very useful (especially once we play multiple sounds simultaneously)! :encouragement:
  3. That's the function to call (during runtime), to set/control the master-volume, right?
These are all very good additions and reusable updates, to a PS2SDK-Library!
Doing that during only a few days is quite (-dare I say it -)... impressive, because it is a milestone regarding sound-control in Homebrew! I suppose you invested quite some time (since all of it [implementation + structural ideas]) would need it.

Thank you for this update!!!

By the documentation, the memory for ADPCM begins at address 0x5010 of local memory. The documentation also states that the ring buffers for PCM audio begins at the start of local memory (0x4000-0x4FFF). The hardware will access that region of memory. So there should be no need to worry about PCM.
Oh, that's good and makes it a bit easier to handle. So basically the hardware (MMU?) will take care of the stream?! THX for the info!
 
This is great, thank you..Had a play around with it last night.
(Idiom: ) I start to see a picture from the puzzle! :D

All (things related to sound) are nicely coming together.

I haven't had much time with the actual ps2 unfortunately but I do remember I was using opl.elf. Next time I get a chance I will try again as I know I really need to be able to identify where stalls/issues are happening.
Indeed! The unpacking-stub of PS2-Packer (as well as NRL) still have some prevailing issues, which had never been pinpointed, AFAIK. :-/

I hadn't really got that far to be honest, I know that's probably not the best way to do things but for the mean time I was just trying to get the wave file to play (currently I'm not getting any bgm playback with this code).
Oh, that's fine! You are trying it and it is normal to prototype some stuff! ;)

I'd probably just stop audio and sleep the thread, wake/resume at some point but that's one big issue atm; I can't figure out where to reinit things in the existing opl code, paths & volume for example as well as the thread itself.

I thought the best place would be applyconfig() in opl.c since that's where rendermodes, themes, scrollspeed etc changes are reinit but adding a simple call to setVolume()
Yes, that should be a valid place and a call to setVolume() should be correct as well.
Atleast I think it is...

Code:
void setVolume(void)
{
    int i;
    for (i=0; i<NUM_SFX_FILES; i++)
What's NUM_SFX_FILES (number of sfx-files/sounds?)?
Increase 'i' as long as it is smaller than that value? Should it count the sounds and set volume for these files?
Is BGM included there or are you missing a '+1'? If you forgot to include BGM, if this is a 'counter' for sounds, changing '<' to '=' or adding a +1 (or both?) would be sufficient, tho'...

Code:
    {
         audsrv_adpcm_set_volume(i, gSFXVolume);
    }

    audsrv_set_volume(gBGMVolume);
}
In applyconfig() causes the console/(pcsx2 also) to hang. I had the same problem when trying to reset paths in applyconfig.

Does it work from elsewhere?

I'm not sure, if the following structure could result in a loop, or race-condition where it un-&reloads the BGM and thus causes the thread to stall or crash, due to the error/issue in 'static void bgmThread()', which @sp193 already pointed out (when gEnableBGM is suddenly changed to 0).


Edit: Tl;Dr I assume the current structure of 'void setVolume(void)' has a fault (which probably causes another issue to be triggered, or crashes that part itself).
 
Last edited:
What's NUM_SFX_FILES (number of sfx-files/sounds?)?
yea, basically its defined as 7 atm..think of it as i=0; < 7 ; i++ . so i starts at 0 and increases by 1 each loop cycle until it reaches 7 and then continues on the function as normal. basic for loop.
its for
Code:
audsrv_adpcm_set_volume(i, gSFXVolume);
it will run the function 7 times to set the volume for the 7 voice channels in use because i went back and specified a channel for each adpcm.

Is BGM included there or are you missing a '+1'? If you forgot to include BGM
bgm volume comes after the loop as it only needs to be set once
Code:
audsrv_set_volume(gBGMVolume);
bgm is pcm and uses a different volume function. each of them are linked to user defined ints of 0-100 so 0-100% volume hense gSFXVolume etc

Does it work from elsewhere?
yea it works fine if called at init() only problem then is it cant be changed during run-time, you need to restart OPL to adjust volume, paths are also suffering from this atm.

I assume the current structure of 'void setVolume(void)' has a fault (which probably causes another issue to be triggered, or crashes that part itself).
the function itself should be fine, its pretty basic it was just an example of a basic function stalling the console when being called in applyconfig().
problem is where to call it so it can be updated on the fly (same as pathing).
 
Last edited:
  • Like
Reactions: TnA
Well, if it technically already works, then the problem rather seems to be where to place the function, than where to call it from!


Edit:

yea, basically its defined as 7 atm..think of it as i=0; < 7 ; i++ . so i starts at 0 and increases by 1 each loop cycle until it reaches 7 and then continues on the function as normal. basic for loop.
could that loop (or missing brackets) affect the thread?

its for
Code:
audsrv_adpcm_set_volume(i, gSFXVolume);
it will run the function 7 times to set the volume for the 7 voice channels in use because i went back and specified a channel for each adpcm.

Oh, so BGM doesn't need to be included in that counting, alright!
Technically your and @sp193's changes to the control of channels and volume, already does give a good base to expand upon, for per-channel-control... (I did take a look at the changes to AUDSRV.);)

bgm volume comes after the loop as it only needs to be set once
Code:
audsrv_set_volume(gBGMVolume);
bgm is pcm and uses a different volume function. each of them are linked to user defined ints of 0-100 so 0-100% volume hense gSFXVolume etc
THX for the clarification. :)

yea it works fine if called at init() only problem then is it cant be changed during run-time, you need to restart OPL to adjust volume, paths are also suffering from this atm.
Could it be a wrong placing of the function, which is called, rather than the call itself?
Weird...

the function itself should be fine, its pretty basic it was just an example of a basic function stalling the console when being called in applyconfig().
problem is where to call it so it can be updated on the fly (same as pathing).
Yes, both is quite important.

It's great, that it already came this far! ^^
 
Last edited:
Status
Not open for further replies.

Similar threads

Back
Top