Add some music from *Style Savvy*

ALSO: Add one music track from *Jim Power: The Lost Dimension in 3D* (GEN/MD)
This commit is contained in:
RocketRobz 2021-07-06 00:57:43 -06:00
parent cedfa71a24
commit 4df51dfc6c
39 changed files with 246 additions and 20 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -53,10 +53,42 @@ void loadMusic(int num) {
startName = "romfs:/music/sonicMania/studiopolisZoneAct1_start.wav";
loopName = "romfs:/music/sonicMania/studiopolisZoneAct1_loop.wav";
break;
case 10: // Sonic Mania - Special Stage: "Dimension Heist"
case 10: // Sonic Mania - Special Stage: "Dimension Heist"
startName = "romfs:/music/sonicMania/specialStage_start.wav";
loopName = "romfs:/music/sonicMania/specialStage_loop.wav";
break;
case 11: // Style Savvy - My Room
startName = "romfs:/music/styleSavvy/myRoom_start.wav";
loopName = "romfs:/music/styleSavvy/myRoom_loop.wav";
break;
case 12: // Style Savvy - Map (Spring)
startName = "romfs:/music/styleSavvy/mapSpring_start.wav";
loopName = "romfs:/music/styleSavvy/mapSpring_loop.wav";
break;
case 13: // Style Savvy - Map (Summer)
startName = "romfs:/music/styleSavvy/mapSummer_start.wav";
loopName = "romfs:/music/styleSavvy/mapSummer_loop.wav";
break;
case 14: // Style Savvy - Map (Fall)
startName = "romfs:/music/styleSavvy/mapFall_start.wav";
loopName = "romfs:/music/styleSavvy/mapFall_loop.wav";
break;
case 15: // Style Savvy - Map (Winter)
startName = "romfs:/music/styleSavvy/mapWinter_start.wav";
loopName = "romfs:/music/styleSavvy/mapWinter_loop.wav";
break;
case 16: // Style Savvy - Wireless Menu
startName = "romfs:/music/styleSavvy/wirelessMenu_start.wav";
loopName = "romfs:/music/styleSavvy/wirelessMenu_loop.wav";
break;
case 17: // Style Savvy - Wireless Map
startName = "romfs:/music/styleSavvy/wirelessMap_start.wav";
loopName = "romfs:/music/styleSavvy/wirelessMap_loop.wav";
break;
case 18: // Jim Power: The Lost Dimension in 3D (GEN/MD) - Stage 3: Mutant's Forest
startName = "romfs:/music/jimPower3D_gen/mutantsForest_start.wav";
loopName = "romfs:/music/jimPower3D_gen/mutantsForest_loop.wav";
break;
}
if (access(startName, F_OK) == 0) {

View File

@ -0,0 +1,9 @@
const char* jimPowerBgmNames[] = {
"Mutant's Forest",
"",
"",
};
int jimPowerBgmNums[] = {
18,
};

19
include/ss1BgmNames.h Normal file
View File

@ -0,0 +1,19 @@
const char* ss1BgmNames[] = {
"My Room",
"Map (Spring)",
"Map (Summer)",
"Map (Fall)",
"Map (Winter)",
"Wireless Menu",
"Wireless Map",
};
int ss1BgmNums[] = {
11,
12,
13,
14,
15,
16,
17,
};

View File

@ -21,7 +21,7 @@ class SoundControl {
// Refill the stream buffers
volatile void updateStream();
void loadStream(const char* path, const char* loopPath, u32 sampleRate, bool loop);
void loadStream(const char* path, const char* loopPath, u32 sampleRate, bool stereo, bool loop);
void beginStream();
void stopStream();
void fadeOutStream();
@ -34,6 +34,7 @@ class SoundControl {
mm_stream stream;
mm_ds_system sys;
bool stream_is_playing;
bool stream_is_stereo;
bool loopingPoint;
bool looping;
//mm_sound_effect snd_loading;

View File

@ -7,6 +7,7 @@ void loadMusic(int num) {
const char* startName = "";
const char* loopName = "";
u32 sampleRate = 0;
bool stereo = true;
switch (num) {
case 0: // Pokemon Stadium - Stadium Select
@ -58,11 +59,52 @@ void loadMusic(int num) {
loopName = "nitro:/music/sonicMania/studiopolisZoneAct1_loop.raw";
sampleRate = 44100;
break;
case 10: // Sonic Mania - Special Stage: "Dimension Heist"
case 10: // Sonic Mania - Special Stage: "Dimension Heist"
startName = "nitro:/music/sonicMania/specialStage_start.raw";
loopName = "nitro:/music/sonicMania/specialStage_loop.raw";
sampleRate = 44100;
break;
case 11: // Style Savvy - My Room
startName = "nitro:/music/styleSavvy/myRoom_start.raw";
loopName = "nitro:/music/styleSavvy/myRoom_loop.raw";
sampleRate = 32000;
break;
case 12: // Style Savvy - Map (Spring)
startName = "nitro:/music/styleSavvy/mapSpring_start.raw";
loopName = "nitro:/music/styleSavvy/mapSpring_loop.raw";
sampleRate = 32000;
break;
case 13: // Style Savvy - Map (Summer)
startName = "nitro:/music/styleSavvy/mapSummer_start.raw";
loopName = "nitro:/music/styleSavvy/mapSummer_loop.raw";
sampleRate = 32000;
break;
case 14: // Style Savvy - Map (Fall)
startName = "nitro:/music/styleSavvy/mapFall_start.raw";
loopName = "nitro:/music/styleSavvy/mapFall_loop.raw";
sampleRate = 32000;
break;
case 15: // Style Savvy - Map (Winter)
startName = "nitro:/music/styleSavvy/mapWinter_start.raw";
loopName = "nitro:/music/styleSavvy/mapWinter_loop.raw";
sampleRate = 32000;
break;
case 16: // Style Savvy - Wireless Menu
startName = "nitro:/music/styleSavvy/wirelessMenu_start.raw";
loopName = "nitro:/music/styleSavvy/wirelessMenu_loop.raw";
sampleRate = 32000;
break;
case 17: // Style Savvy - Wireless Map
startName = "nitro:/music/styleSavvy/wirelessMap_start.raw";
loopName = "nitro:/music/styleSavvy/wirelessMap_loop.raw";
sampleRate = 32000;
break;
case 18: // Jim Power: The Lost Dimension in 3D (GEN/MD) - Stage 3: Mutant's Forest
startName = "nitro:/music/jimPower3D_gen/mutantsForest_start.raw";
loopName = "nitro:/music/jimPower3D_gen/mutantsForest_loop.raw";
sampleRate = 48000;
stereo = false;
break;
}
snd().loadStream(startName, loopName, sampleRate, true);
snd().loadStream(startName, loopName, sampleRate, stereo, true);
}

View File

@ -30,6 +30,7 @@ extern char debug_buf[256];
extern volatile u32 sample_delay_count;
char* SFX_DATA = (char*)NULL;
s8 monoBuffer[STREAMING_BUF_LENGTH] = {0};
mm_word SOUNDBANK[MSL_BANKSIZE] = {0};
SoundControl::SoundControl()
@ -92,7 +93,7 @@ mm_sfxhand SoundControl::playSelect() { return mmEffectEx(&snd_select); }
mm_sfxhand SoundControl::playBack() { return mmEffectEx(&snd_back); }
mm_sfxhand SoundControl::playHighlight() { return mmEffectEx(&snd_highlight); }
void SoundControl::loadStream(const char* path, const char* loopPath, u32 sampleRate, bool loop) {
void SoundControl::loadStream(const char* path, const char* loopPath, u32 sampleRate, bool stereo, bool loop) {
if (stream_source) {
stream_is_playing = false;
mmStreamClose();
@ -116,46 +117,119 @@ void SoundControl::loadStream(const char* path, const char* loopPath, u32 sample
stream.format = MM_STREAM_8BIT_STEREO; // select format
stream.timer = MM_TIMER0; // use timer0
stream.manual = false; // auto filling
stream_is_stereo = stereo;
looping = loop;
int byteLen = stream_is_stereo ? sizeof(s16) : sizeof(s8);
if (loopableMusic) {
fseek(stream_start_source, 0, SEEK_END);
size_t fileSize = ftell(stream_start_source);
fseek(stream_start_source, 0, SEEK_SET);
// Prep the first section of the stream
fread((void*)play_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_start_source);
if (fileSize < STREAMING_BUF_LENGTH*sizeof(s16)) {
if (stream_is_stereo) {
fread((void*)play_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_start_source);
} else {
fread((void*)monoBuffer, sizeof(s8), STREAMING_BUF_LENGTH, stream_start_source);
s8 mono2stereo[2];
for (int i = 0; i < STREAMING_BUF_LENGTH; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)play_stream_buf+i, &mono2stereo, sizeof(s16));
}
}
if (fileSize < (size_t)STREAMING_BUF_LENGTH*byteLen) {
size_t fillerSize = 0;
while (fileSize+fillerSize < STREAMING_BUF_LENGTH*sizeof(s16)) {
while (fileSize+fillerSize < (size_t)STREAMING_BUF_LENGTH*byteLen) {
fillerSize++;
}
fread((void*)play_stream_buf+fileSize, 1, fillerSize, stream_source);
if (stream_is_stereo) {
fread((void*)play_stream_buf+fileSize, 1, fillerSize, stream_source);
} else {
fread((void*)monoBuffer+fileSize, sizeof(s8), fillerSize, stream_source);
s8 mono2stereo[2];
for (int i = (int)fileSize; i < STREAMING_BUF_LENGTH; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)play_stream_buf+i, &mono2stereo, sizeof(s16));
}
}
// Fill the next section premptively
fread((void*)fill_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_source);
if (stream_is_stereo) {
fread((void*)fill_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_source);
} else {
fread((void*)monoBuffer, sizeof(s8), STREAMING_BUF_LENGTH, stream_source);
s8 mono2stereo[2];
for (int i = 0; i < STREAMING_BUF_LENGTH; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)fill_stream_buf+i, &mono2stereo, sizeof(s16));
}
}
loopingPoint = true;
} else {
// Fill the next section premptively
fread((void*)fill_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_start_source);
fileSize -= STREAMING_BUF_LENGTH*sizeof(s16);
if (fileSize < STREAMING_BUF_LENGTH*sizeof(s16)) {
if (stream_is_stereo) {
fread((void*)fill_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_start_source);
} else {
fread((void*)monoBuffer, sizeof(s8), STREAMING_BUF_LENGTH, stream_start_source);
s8 mono2stereo[2];
for (int i = 0; i < STREAMING_BUF_LENGTH; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)fill_stream_buf+i, &mono2stereo, sizeof(s16));
}
}
fileSize -= STREAMING_BUF_LENGTH*byteLen;
if (fileSize < (size_t)STREAMING_BUF_LENGTH*byteLen) {
size_t fillerSize = 0;
while (fileSize+fillerSize < STREAMING_BUF_LENGTH*sizeof(s16)) {
while (fileSize+fillerSize < (size_t)STREAMING_BUF_LENGTH*byteLen) {
fillerSize++;
}
fread((void*)fill_stream_buf+fileSize, 1, fillerSize, stream_source);
if (stream_is_stereo) {
fread((void*)fill_stream_buf+fileSize, 1, fillerSize, stream_source);
} else {
fread((void*)monoBuffer+fileSize, sizeof(s8), fillerSize, stream_source);
s8 mono2stereo[2];
for (int i = (int)fileSize; i < STREAMING_BUF_LENGTH; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)fill_stream_buf+i, &mono2stereo, sizeof(s16));
}
}
loopingPoint = true;
}
}
} else {
// Prep the first section of the stream
fread((void*)play_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_source);
if (stream_is_stereo) {
fread((void*)play_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_source);
} else {
fread((void*)monoBuffer, sizeof(s8), STREAMING_BUF_LENGTH, stream_source);
s8 mono2stereo[2];
for (int i = 0; i < STREAMING_BUF_LENGTH; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)play_stream_buf+i, &mono2stereo, sizeof(s16));
}
}
// Fill the next section premptively
fread((void*)fill_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_source);
if (stream_is_stereo) {
fread((void*)fill_stream_buf, sizeof(s16), STREAMING_BUF_LENGTH, stream_source);
} else {
fread((void*)monoBuffer, sizeof(s8), STREAMING_BUF_LENGTH, stream_source);
s8 mono2stereo[2];
for (int i = 0; i < STREAMING_BUF_LENGTH; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)fill_stream_buf+i, &mono2stereo, sizeof(s16));
}
}
loopingPoint = true;
}
@ -218,12 +292,35 @@ volatile void SoundControl::updateStream() {
int instance_to_fill = std::min(SAMPLES_LEFT_TO_FILL, SAMPLES_TO_FILL);
// If we don't read enough samples, loop from the beginning of the file.
instance_filled = fread((s16*)fill_stream_buf + filled_samples, sizeof(s16), instance_to_fill, loopingPoint ? stream_source : stream_start_source);
if (stream_is_stereo) {
instance_filled = fread((s16*)fill_stream_buf + filled_samples, sizeof(s16), instance_to_fill, loopingPoint ? stream_source : stream_start_source);
} else {
instance_filled = fread(&monoBuffer, sizeof(s8), instance_to_fill, loopingPoint ? stream_source : stream_start_source);
s8 mono2stereo[2];
for (int i = 0; i < instance_to_fill; i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)fill_stream_buf + (filled_samples + i), &mono2stereo, sizeof(s16));
}
}
if (instance_filled < instance_to_fill) {
if (looping) {
fseek(stream_source, 0, SEEK_SET);
int i = fread((s16*)fill_stream_buf + filled_samples + instance_filled,
sizeof(s16), (instance_to_fill - instance_filled), stream_source);
int i = 0;
if (stream_is_stereo) {
i = fread((s16*)fill_stream_buf + filled_samples + instance_filled,
sizeof(s16), (instance_to_fill - instance_filled), stream_source);
} else {
i = fread(&monoBuffer, sizeof(s8), (instance_to_fill - instance_filled), stream_source);
if (i > 0) {
s8 mono2stereo[2];
for (int i = 0; i < (instance_to_fill - instance_filled); i++) {
mono2stereo[0] = monoBuffer[i];
mono2stereo[1] = monoBuffer[i];
tonccpy((s16*)fill_stream_buf + (filled_samples + instance_filled + i), &mono2stereo, sizeof(s16));
}
}
}
if (i==0) {
toncset((s16*)fill_stream_buf + filled_samples + instance_filled, 0, (instance_to_fill - instance_filled)*sizeof(s16));
} else {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -30,10 +30,12 @@
#include "pdarkBgNames.h"
#include "smBgNames.h"
#include "jimPowerBgmNames.h"
#include "marioGolfAdvanceTourBgmNames.h"
#include "mmBattleAndChaseBgmNames.h"
#include "pkmnStadiumBgmNames.h"
#include "sonicManiaBgmNames.h"
#include "ss1BgmNames.h"
#include "tetrisPartyBgmNames.h"
#include <unistd.h>
@ -115,10 +117,12 @@ static u8 charPageOrder[] = {
};
static u8 bgmPageOrder[] = {
6, // Jim Power
2, // Mario Golf: Advance Tour
1, // MegaMan: Battle and Chase
0, // Pokemon Stadium
4, // Sonic Mania
5, // Style Savvy
3, // Tetris Party
};
@ -147,7 +151,11 @@ void PhotoStudio::getMaxChars() {
// Music
switch (bgmPageOrder[bgm_highlightedGame]) {
case 0:
import_totalCharacters = 0;
break;
case 1:
import_totalCharacters = 0;
break;
case 2:
import_totalCharacters = 0;
break;
@ -157,6 +165,12 @@ void PhotoStudio::getMaxChars() {
case 4:
import_totalCharacters = 5;
break;
case 5:
import_totalCharacters = 6;
break;
case 6:
import_totalCharacters = 0;
break;
}
} else if (subScreenMode == 1) {
// Locations
@ -702,6 +716,10 @@ const char* PhotoStudio::bgmGameTitle(void) const {
return "Tetris Party";
case 4:
return "Sonic Mania";
case 5:
return ss1Title();
case 6:
return "Jim Power";
}
return "???";
}
@ -782,6 +800,10 @@ const char* PhotoStudio::bgmName(int i) const {
return tetrisPartyBgmNames[i];
case 4:
return sonicManiaBgmNames[i];
case 5:
return ss1BgmNames[i];
case 6:
return jimPowerBgmNames[i];
}
return "???";
}
@ -818,6 +840,10 @@ int PhotoStudio::getBgmNum(void) const {
return tetrisPartyBgmNums[bgmList_cursorPosition];
case 4:
return sonicManiaBgmNums[bgmList_cursorPosition];
case 5:
return ss1BgmNums[bgmList_cursorPosition];
case 6:
return jimPowerBgmNums[bgmList_cursorPosition];
}
return 0;
}