Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 44kHz WT and option for max voices #20

Merged
merged 6 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ option(BUILD_SONIVOX_STATIC "Build the static library" TRUE)
option(BUILD_SONIVOX_SHARED "Build the shared library" TRUE)
option(BUILD_TESTING "Build the unit tests" TRUE)
option(CMAKE_POSITION_INDEPENDENT_CODE "Whether to create position-independent targets" TRUE)
option(USE_44KHZ "Use 44kHz wavetable instead of 22kHz one" TRUE)
set(MAX_VOICES 64 CACHE STRING "Maximum number of voices")

include(GNUInstallDirs)

Expand Down Expand Up @@ -98,7 +100,7 @@ list(APPEND SOURCES
#arm-wt-22k/lib_src/eas_xmf.c
#arm-wt-22k/lib_src/eas_xmfdata.c
#arm-wt-22k/lib_src/jet.c
arm-wt-22k/lib_src/wt_22khz.c
arm-wt-22k/lib_src/wt_200k_G.c
)

configure_file(arm-wt-22k/host_src/eas.cmake libsonivox/eas.h @ONLY)
Expand All @@ -117,8 +119,7 @@ target_compile_definitions( sonivox-objects PRIVATE
UNIFIED_DEBUG_MESSAGES
EAS_WT_SYNTH
NUM_OUTPUT_CHANNELS=2
_SAMPLE_RATE_22050
MAX_SYNTH_VOICES=64
MAX_SYNTH_VOICES=${MAX_VOICES}
_16_BIT_SAMPLES
_FILTER_ENABLED
DLS_SYNTHESIZER
Expand All @@ -131,6 +132,16 @@ target_compile_definitions( sonivox-objects PRIVATE
#JET_INTERFACE
)

if(USE_44KHZ)
target_compile_definitions( sonivox-objects PRIVATE
_SAMPLE_RATE_44100
)
else()
target_compile_definitions( sonivox-objects PRIVATE
_SAMPLE_RATE_22050
)
endif()

target_include_directories( sonivox-objects PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/libsonivox
arm-wt-22k/host_src
Expand Down Expand Up @@ -244,6 +255,16 @@ if (BUILD_TESTING)
test/SonivoxTest.cpp
)

if(USE_44KHZ)
target_compile_definitions( SonivoxTest PRIVATE
_SAMPLE_RATE_44100
)
else()
target_compile_definitions( SonivoxTest PRIVATE
_SAMPLE_RATE_22050
)
endif()

target_include_directories( SonivoxTest PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
arm-wt-22k/include
Expand Down
143 changes: 143 additions & 0 deletions arm-wt-22k/lib_src/wt_200k_G.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/*----------------------------------------------------------------------------
*
* Filename: wt_200k_G.c
* Source: wt_200k_G.dls
* CmdLine: -w wt_200k_G.c -l wt_200k_G.log -ce -cf wt_200k_G.dls -w -l -ce -cf wt_200k_G.dls
* Purpose: Wavetable sound libary
*
* Copyright (c) 2009 Sonic Network Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*----------------------------------------------------------------------------
* Revision Control:
* $Revision: 960 $
* $Date: 2009-03-18 15:08:29 -0500 (Wed, 18 Mar 2009) $
*----------------------------------------------------------------------------
*/

/*----------------------------------------------------------------------------
*
* Filename: wt_44khz.c
* Purpose: Wavetable sound libary
*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "eas_sndlib.h"

/*----------------------------------------------------------------------------
* Programs
*----------------------------------------------------------------------------
*/
const S_PROGRAM eas_programs[] =
{
{ 7864320, 0 } /* program 0 */
}; /* end Programs */

/*----------------------------------------------------------------------------
* Banks
*----------------------------------------------------------------------------
*/
const S_BANK eas_banks[] =
{
{ /* bank 0 */
30976,
{
291, 324, 314, 334, 202, 319, 95, 195,
107, 92, 371, 89, 87, 85, 135, 82,
200, 192, 130, 267, 193, 302, 207, 210,
128, 125, 190, 120, 118, 213, 221, 271,
80, 78, 308, 164, 220, 310, 166, 167,
186, 182, 181, 179, 160, 178, 176, 115,
155, 153, 151, 149, 75, 73, 374, 111,
252, 254, 258, 305, 256, 157, 146, 137,
249, 237, 245, 241, 274, 262, 260, 265,
172, 171, 309, 277, 284, 307, 136, 344,
173, 168, 345, 353, 346, 70, 110, 311,
357, 144, 104, 67, 364, 367, 64, 288,
142, 140, 98, 355, 133, 123, 61, 113,
285, 280, 279, 278, 370, 286, 359, 283,
101, 236, 163, 235, 234, 233, 232, 231,
162, 363, 230, 281, 165, 229, 109, 228
}
}
}; /* end Banks */

#ifdef _SAMPLE_RATE_44100
#include "wt_44khz.c"
#else
#include "wt_22khz.c"
#endif

#include "wt_200k_samples.c"

/*----------------------------------------------------------------------------
* S_EAS
*----------------------------------------------------------------------------
*/

#ifdef _SAMPLE_RATE_44100
const EAS_U32 sampleRate = 0xAC44;
#else
const EAS_U32 sampleRate = 0x5622;
#endif

const S_EAS easSoundLib = {
0x01534145,

#if defined (_8_BIT_SAMPLES)
0x00100000 | sampleRate,
#else //_16_BIT_SAMPLES
0x00200000 | sampleRate,
#endif

eas_banks,
eas_programs,
eas_regions,
eas_articulations,
eas_sampleLengths,
eas_sampleOffsets,
eas_samples,
0,
1,
1,
377,
185,
150,
0
}; /* end S_EAS */

/*----------------------------------------------------------------------------
* Statistics
*
* Number of banks: 1
* Number of programs: 1
* Number of regions: 377
* Number of articulations: 185
* Number of samples: 150
* Size of sample pool: 212050
*----------------------------------------------------------------------------
*/
Loading