2016-04-25 20:33:48 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2015
|
|
|
|
* by Dimok
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event will the authors be held liable for any
|
|
|
|
* damages arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any
|
|
|
|
* purpose, including commercial applications, and to alter it and
|
|
|
|
* redistribute it freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you
|
|
|
|
* must not claim that you wrote the original software. If you use
|
|
|
|
* this software in a product, an acknowledgment in the product
|
|
|
|
* documentation would be appreciated but is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and
|
|
|
|
* must not be misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source
|
|
|
|
* distribution.
|
|
|
|
***************************************************************************/
|
2016-04-28 21:00:19 +02:00
|
|
|
#include "common/common.h"
|
2016-04-25 20:33:48 +02:00
|
|
|
#include "os_functions.h"
|
|
|
|
#include "ax_functions.h"
|
|
|
|
|
2017-03-30 17:51:11 +02:00
|
|
|
u32 sound_handle __attribute__((section(".data"))) = 0;
|
2016-04-28 21:23:45 +02:00
|
|
|
|
2016-04-25 20:33:48 +02:00
|
|
|
EXPORT_DECL(void, AXInitWithParams, u32 * params);
|
2016-04-28 21:00:19 +02:00
|
|
|
EXPORT_DECL(void, AXInit, void);
|
2016-04-25 20:33:48 +02:00
|
|
|
EXPORT_DECL(void, AXQuit, void);
|
|
|
|
EXPORT_DECL(u32, AXGetInputSamplesPerSec, void);
|
|
|
|
EXPORT_DECL(u32, AXGetInputSamplesPerFrame, void);
|
|
|
|
EXPORT_DECL(s32, AXVoiceBegin, void *v);
|
|
|
|
EXPORT_DECL(s32, AXVoiceEnd, void *v);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceType, void *v, u16 type);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceOffsets, void *v, const void *buf);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceSrcType, void *v, u32 type);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceVe, void *v, const void *vol);
|
|
|
|
EXPORT_DECL(s32, AXSetVoiceDeviceMix, void *v, s32 device, u32 id, void *mix);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceState, void *v, u16 state);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceSrc, void *v, const void *src);
|
|
|
|
EXPORT_DECL(s32, AXSetVoiceSrcRatio, void *v,f32 ratio)
|
|
|
|
EXPORT_DECL(void *, AXAcquireVoice, u32 prio, void * callback, u32 arg);
|
|
|
|
EXPORT_DECL(void, AXFreeVoice, void *v);
|
|
|
|
EXPORT_DECL(void, AXRegisterFrameCallback, void * callback);
|
|
|
|
EXPORT_DECL(u32, AXGetVoiceLoopCount, void *v);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset);
|
|
|
|
EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset);
|
|
|
|
|
2016-04-28 21:23:45 +02:00
|
|
|
void InitAcquireAX(void)
|
2016-04-25 20:33:48 +02:00
|
|
|
{
|
2017-04-10 11:04:06 +02:00
|
|
|
u32 *funcPointer = 0;
|
2016-04-25 20:33:48 +02:00
|
|
|
|
2016-04-28 21:00:19 +02:00
|
|
|
if(OS_FIRMWARE >= 400)
|
|
|
|
{
|
|
|
|
AXInit = 0;
|
|
|
|
|
|
|
|
OSDynLoad_Acquire("sndcore2.rpl", &sound_handle);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXInitWithParams);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXGetInputSamplesPerSec);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AXInitWithParams = 0;
|
|
|
|
AXGetInputSamplesPerSec = 0;
|
|
|
|
|
|
|
|
OSDynLoad_Acquire("snd_core.rpl", &sound_handle);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXInit);
|
|
|
|
}
|
2016-04-28 21:23:45 +02:00
|
|
|
}
|
2016-04-28 21:00:19 +02:00
|
|
|
|
2016-04-28 21:23:45 +02:00
|
|
|
void InitAXFunctionPointers(void)
|
|
|
|
{
|
2017-04-10 11:04:06 +02:00
|
|
|
u32 *funcPointer = 0;
|
2016-09-23 14:34:35 +02:00
|
|
|
|
2016-04-28 21:23:45 +02:00
|
|
|
InitAcquireAX();
|
2016-09-23 14:34:35 +02:00
|
|
|
|
2016-04-25 20:33:48 +02:00
|
|
|
OS_FIND_EXPORT(sound_handle, AXQuit);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXVoiceBegin);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXVoiceEnd);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceType);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceOffsets);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceSrcType);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceVe);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceDeviceMix);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceState);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceSrc);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceSrcRatio);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXAcquireVoice);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXFreeVoice);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXRegisterFrameCallback);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXGetVoiceLoopCount);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceEndOffset);
|
|
|
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceLoopOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProperlyEndTransitionAudio(void)
|
|
|
|
{
|
|
|
|
bool (* check_os_audio_transition_flag_old)(void);
|
|
|
|
void (* AXInit_old)(void);
|
|
|
|
void (* AXQuit_old)(void);
|
2016-04-28 21:00:19 +02:00
|
|
|
|
2017-04-10 11:04:06 +02:00
|
|
|
u32 *funcPointer = 0;
|
|
|
|
u32 sound_handle;
|
2016-04-25 20:33:48 +02:00
|
|
|
OSDynLoad_Acquire("snd_core.rpl", &sound_handle);
|
2016-04-28 21:00:19 +02:00
|
|
|
|
2016-04-25 20:33:48 +02:00
|
|
|
OS_FIND_EXPORT_EX(sound_handle, check_os_audio_transition_flag, check_os_audio_transition_flag_old);
|
|
|
|
OS_FIND_EXPORT_EX(sound_handle, AXInit, AXInit_old);
|
|
|
|
OS_FIND_EXPORT_EX(sound_handle, AXQuit, AXQuit_old);
|
2016-04-28 21:00:19 +02:00
|
|
|
|
2016-04-25 20:33:48 +02:00
|
|
|
if (check_os_audio_transition_flag_old())
|
|
|
|
{
|
|
|
|
AXInit_old();
|
|
|
|
AXQuit_old();
|
|
|
|
}
|
2016-04-28 21:00:19 +02:00
|
|
|
}
|