Skip to content

Commit

Permalink
feat(core): Improve python scripts.
Browse files Browse the repository at this point in the history
They are now also available with the SDK.

Signed-off-by: Axel Nana <[email protected]>
  • Loading branch information
na2axl committed Dec 18, 2023
1 parent da0a136 commit af0cd22
Show file tree
Hide file tree
Showing 10 changed files with 625 additions and 473 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ endif()
set(AM_LIB_DESTINATION "lib/${RUNTIME_OUTPUT_DIRECTORY}")
set(AM_INC_DESTINATION "include")
set(AM_SHM_DESTINATION "schemas")
set(AM_PYS_DESTINATION "scripts")
set(AM_BIN_DESTINATION "bin/${RUNTIME_OUTPUT_DIRECTORY}")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${AM_BIN_DESTINATION}")
Expand Down Expand Up @@ -436,6 +437,14 @@ install(
FILES_MATCHING PATTERN "*.bfbs"
)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/
DESTINATION ${AM_PYS_DESTINATION}
FILES_MATCHING
PATTERN "*.py"
PATTERN "build_schemas.py" EXCLUDE
)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/
DESTINATION "${CMAKE_INSTALL_PREFIX}/cmake"
Expand Down
7 changes: 5 additions & 2 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ set(PROJECT_NAME ss_amplitude_audio_samples)
project(${PROJECT_NAME})

add_custom_target(ss_amplitude_audio_sample_assets
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_assets.py --output ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/samples/assets
COMMAND
python3 ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_project.py -p ${CMAKE_SOURCE_DIR}/samples/rawassets -b ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/samples/assets -f ${CMAKE_SOURCE_DIR}/bin/flatc
WORKING_DIRECTORY
${CMAKE_SOURCE_DIR}
)

add_dependencies(ss_amplitude_audio_sample_assets
Expand All @@ -30,7 +33,7 @@ add_subdirectory(sample_01)
add_subdirectory(sample_02)

install(
CODE "execute_process(COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_assets.py --output ${CMAKE_INSTALL_PREFIX}/${AM_BIN_DESTINATION}/samples/assets)"
CODE "execute_process(COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_project.py -p ${CMAKE_SOURCE_DIR}/samples/rawassets -b ${CMAKE_INSTALL_PREFIX}/${AM_BIN_DESTINATION}/samples/assets -f ${CMAKE_SOURCE_DIR}/bin/flatc WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})"
)

install(
Expand Down
78 changes: 39 additions & 39 deletions samples/rawassets/buses.json → samples/rawassets/pc.buses.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
{
"buses": [
{
"id": 1,
"name": "master",
"gain": 1.0,
"child_buses": [
2,
7678456242523
],
"fader": "Linear"
},
{
"id": 2,
"name": "effects",
"gain": 1,
"duck_buses": [
{
"id": 7678456242523,
"target_gain": 0.5,
"fade_in": {
"duration": 3,
"fader": "SCurveSmooth"
},
"fade_out": {
"duration": 3,
"fader": "Linear"
}
}
],
"fader": "Linear"
},
{
"id": 7678456242523,
"name": "environment",
"gain": 0.25,
"fader": "Linear"
}
]
{
"buses": [
{
"id": 1,
"name": "master",
"gain": 1.0,
"child_buses": [
2,
7678456242523
],
"fader": "Linear"
},
{
"id": 2,
"name": "effects",
"gain": 1,
"duck_buses": [
{
"id": 7678456242523,
"target_gain": 0.5,
"fade_in": {
"duration": 3,
"fader": "SCurveSmooth"
},
"fade_out": {
"duration": 3,
"fader": "Linear"
}
}
],
"fader": "Linear"
},
{
"id": 7678456242523,
"name": "environment",
"gain": 0.25,
"fader": "Linear"
}
]
}
220 changes: 110 additions & 110 deletions samples/rawassets/audio_config.json → samples/rawassets/pc.config.json
Original file line number Diff line number Diff line change
@@ -1,111 +1,111 @@
{
"driver": "miniaudio",
"output": {
"frequency": 44100,
"channels": 2,
"buffer_size": 1024,
"format": "Float32"
},
"mixer": {
"active_channels": 50,
"virtual_channels": 100,
"pipeline_type": [
"AudioSoundProcessor",
"AudioSoundProcessor",
"AudioProcessorMixer",
"AudioSoundProcessor"
],
"pipeline": [
{
"processor": "EffectProcessor"
},
{
"processor": "OcclusionProcessor"
},
{
"dry_processor": "ObstructionProcessor",
"wet_processor": "EnvironmentProcessor",
"dry": 0.5,
"wet": 0.5
},
{
"processor": "ClipProcessor"
}
]
},
"game": {
"listener_fetch_mode": "Nearest",
"track_environments": true,
"up_axis": "Y",
"listeners": 100,
"entities": 4096,
"environments": 512,
"sound_speed": 333,
"doppler_factor": 1.0,
"obstruction": {
"lpf_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 0
},
"end": {
"x": 1,
"y": 1
},
"fader": "Linear"
}
]
},
"gain_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 1
},
"end": {
"x": 1,
"y": 0
},
"fader": "Linear"
}
]
}
},
"occlusion": {
"lpf_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 0
},
"end": {
"x": 1,
"y": 1
},
"fader": "Linear"
}
]
},
"gain_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 1
},
"end": {
"x": 1,
"y": 0
},
"fader": "Linear"
}
]
}
}
},
"buses_file": "buses.ambus"
{
"driver": "miniaudio",
"output": {
"frequency": 44100,
"channels": 2,
"buffer_size": 1024,
"format": "Float32"
},
"mixer": {
"active_channels": 50,
"virtual_channels": 100,
"pipeline_type": [
"AudioSoundProcessor",
"AudioSoundProcessor",
"AudioProcessorMixer",
"AudioSoundProcessor"
],
"pipeline": [
{
"processor": "EffectProcessor"
},
{
"processor": "OcclusionProcessor"
},
{
"dry_processor": "ObstructionProcessor",
"wet_processor": "EnvironmentProcessor",
"dry": 0.5,
"wet": 0.5
},
{
"processor": "ClipProcessor"
}
]
},
"game": {
"listener_fetch_mode": "Nearest",
"track_environments": true,
"up_axis": "Y",
"listeners": 100,
"entities": 4096,
"environments": 512,
"sound_speed": 333,
"doppler_factor": 1.0,
"obstruction": {
"lpf_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 0
},
"end": {
"x": 1,
"y": 1
},
"fader": "Linear"
}
]
},
"gain_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 1
},
"end": {
"x": 1,
"y": 0
},
"fader": "Linear"
}
]
}
},
"occlusion": {
"lpf_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 0
},
"end": {
"x": 1,
"y": 1
},
"fader": "Linear"
}
]
},
"gain_curve": {
"parts": [
{
"start": {
"x": 0,
"y": 1
},
"end": {
"x": 1,
"y": 0
},
"fader": "Linear"
}
]
}
}
},
"buses_file": "pc.buses.ambus"
}
2 changes: 1 addition & 1 deletion samples/sample_01/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static void run(AmVoidPtr param)
#endif

// Initialize Amplitude.
if (!amEngine->Initialize(AM_OS_STRING("audio_config.amconfig")))
if (!amEngine->Initialize(AM_OS_STRING("pc.config.amconfig")))
return;

if (!amEngine->LoadSoundBank(AM_OS_STRING("sample_01.ambank")))
Expand Down
2 changes: 1 addition & 1 deletion samples/sample_02/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const AmTime kFramesPerSecond = 60.0;
const Uint32 kDelayMilliseconds = static_cast<Uint32>(kAmSecond * 1.0 / kFramesPerSecond);

const char* kWindowTitle = "Amplitude Audio SDK Sample";
AmOsString kAudioConfig = AM_OS_STRING("audio_config.amconfig");
AmOsString kAudioConfig = AM_OS_STRING("pc.config.amconfig");
AmOsString kSoundBank = AM_OS_STRING("sample_02.ambank");
const char* kInstructionsTexture = "./assets/textures/instructions.bmp";
const char* kChannelTexture = "./assets/textures/channel.bmp";
Expand Down
Loading

0 comments on commit af0cd22

Please sign in to comment.