add actual blow-into-mic sample that actually works

This commit is contained in:
Arisotura 2020-05-21 02:33:48 +02:00
parent 108647e033
commit f79583bf16
4 changed files with 5548 additions and 9 deletions

View File

@ -28,6 +28,8 @@
#include "NDS.h" #include "NDS.h"
#include "mic_blow.h"
namespace Frontend namespace Frontend
{ {
@ -92,19 +94,16 @@ void Mic_FeedSilence()
void Mic_FeedNoise() void Mic_FeedNoise()
{ {
// note: DS games seem to expect very saturated 'blowing into mic' noise int sample_len = sizeof(mic_blow) / sizeof(u16);
s16 noisesample[8] = {-0x8000, -0x8000, 0x7FFF, -0x8000, 0x7FFF, 0x7FFF, -0x8000, 0x7FFF}; static int sample_pos = 0;
int j = 0;
s16 tmp[735]; s16 tmp[735];
for (int i = 0; i < 735; i++) for (int i = 0; i < 735; i++)
{ {
int val = noisesample[j]; tmp[i] = mic_blow[sample_pos];
j++; sample_pos++;
if (j >= 8) j = rand() & 7; if (sample_pos >= sample_len) sample_pos = 0;
tmp[i] = val;
} }
NDS::MicInputFrame(tmp, 735); NDS::MicInputFrame(tmp, 735);

5539
src/frontend/mic_blow.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -95,7 +95,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Noise will be forwarded to the emulated microphone, simulating blowing into the microphone.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Noise will be forwarded to the emulated microphone, simulating blowing into the microphone.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>White noise</string> <string>Blow noise</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -12,6 +12,7 @@ SET(SOURCES_QT_SDL
../Util_ROM.cpp ../Util_ROM.cpp
../Util_Audio.cpp ../Util_Audio.cpp
../FrontendUtil.h ../FrontendUtil.h
../mic_blow.h
../../../melon.qrc ../../../melon.qrc
) )