Add more sounds internally
This commit is contained in:
@@ -6,6 +6,7 @@ class AudioPlayer
|
|||||||
public:
|
public:
|
||||||
AudioPlayer(void);
|
AudioPlayer(void);
|
||||||
~AudioPlayer(void);
|
~AudioPlayer(void);
|
||||||
static void playSound(std::string);
|
|
||||||
static void init();
|
static void init();
|
||||||
|
static void playSound(std::string);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ namespace Enum
|
|||||||
namespace Sound
|
namespace Sound
|
||||||
{
|
{
|
||||||
enum Value {
|
enum Value {
|
||||||
NoSound = 0, Victory = 1, Boing = 2
|
NoSound = 0, Victory = 1, Boing = 2, Bomb = 3,
|
||||||
|
Ping = 4, Break = 5, Splat = 6, Swoosh = 7,
|
||||||
|
Snap = 8, Page = 9
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,6 +130,8 @@ Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(setti
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioPlayer::init();
|
||||||
|
|
||||||
_window = renderDevice->window();
|
_window = renderDevice->window();
|
||||||
_window->makeCurrent();
|
_window->makeCurrent();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define NUM_SOUNDS 10
|
#define NUM_SOUNDS 32
|
||||||
static SDL_AudioSpec fmt;
|
static SDL_AudioSpec fmt;
|
||||||
static bool initiated = false;
|
static bool initiated = false;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ void AudioPlayer::init()
|
|||||||
initiated = true;
|
initiated = true;
|
||||||
extern void mixaudio(void *unused, Uint8 *stream, int len);
|
extern void mixaudio(void *unused, Uint8 *stream, int len);
|
||||||
fmt.freq = 22050;
|
fmt.freq = 22050;
|
||||||
fmt.format = AUDIO_S16;
|
fmt.format = AUDIO_S16LSB;
|
||||||
fmt.channels = 2;
|
fmt.channels = 2;
|
||||||
fmt.samples = 1024; /* A good value for games */
|
fmt.samples = 1024; /* A good value for games */
|
||||||
fmt.callback = mixaudio;
|
fmt.callback = mixaudio;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ DataModelInstance::DataModelInstance(void)
|
|||||||
_modY=0;
|
_modY=0;
|
||||||
workspace->setParent(this);
|
workspace->setParent(this);
|
||||||
level->setParent(this);
|
level->setParent(this);
|
||||||
|
soundService->setParent(this);
|
||||||
|
|
||||||
_loadedFileName="..//skooter.rbxm";
|
_loadedFileName="..//skooter.rbxm";
|
||||||
listicon = 5;
|
listicon = 5;
|
||||||
|
|||||||
@@ -20,11 +20,8 @@ Instance::Instance(const Instance &oinst)
|
|||||||
className = oinst.className;
|
className = oinst.className;
|
||||||
canDelete = oinst.canDelete;
|
canDelete = oinst.canDelete;
|
||||||
listicon = oinst.listicon;
|
listicon = oinst.listicon;
|
||||||
//setParent(oinst.parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Instance::render(RenderDevice* rd)
|
void Instance::render(RenderDevice* rd)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < children.size(); i++)
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
|
|||||||
@@ -476,6 +476,20 @@ static TCHAR* strSoundType(int option)
|
|||||||
return "Victory";
|
return "Victory";
|
||||||
case Enum::Sound::Boing:
|
case Enum::Sound::Boing:
|
||||||
return "Boing";
|
return "Boing";
|
||||||
|
case Enum::Sound::Splat:
|
||||||
|
return "Splat";
|
||||||
|
case Enum::Sound::Snap:
|
||||||
|
return "Snap";
|
||||||
|
case Enum::Sound::Bomb:
|
||||||
|
return "Bomb";
|
||||||
|
case Enum::Sound::Break:
|
||||||
|
return "Break";
|
||||||
|
case Enum::Sound::Ping:
|
||||||
|
return "Ping";
|
||||||
|
case Enum::Sound::Swoosh:
|
||||||
|
return "Swoosh";
|
||||||
|
case Enum::Sound::Page:
|
||||||
|
return "Page";
|
||||||
}
|
}
|
||||||
return "NoSound";
|
return "NoSound";
|
||||||
}
|
}
|
||||||
@@ -488,6 +502,21 @@ static Enum::Sound::Value EnumOnTouchSoundType(TCHAR* option)
|
|||||||
return Enum::Sound::Victory;
|
return Enum::Sound::Victory;
|
||||||
if(strcmp("Boing", option) == 0)
|
if(strcmp("Boing", option) == 0)
|
||||||
return Enum::Sound::Boing;
|
return Enum::Sound::Boing;
|
||||||
|
if(strcmp("Splat", option) == 0)
|
||||||
|
return Enum::Sound::Splat;
|
||||||
|
if(strcmp("Bomb", option) == 0)
|
||||||
|
return Enum::Sound::Bomb;
|
||||||
|
if(strcmp("Break", option) == 0)
|
||||||
|
return Enum::Sound::Break;
|
||||||
|
if(strcmp("Swoosh", option) == 0)
|
||||||
|
return Enum::Sound::Swoosh;
|
||||||
|
if(strcmp("Page", option) == 0)
|
||||||
|
return Enum::Sound::Page;
|
||||||
|
if(strcmp("Ping", option) == 0)
|
||||||
|
return Enum::Sound::Ping;
|
||||||
|
if(strcmp("Snap", option) == 0)
|
||||||
|
return Enum::Sound::Snap;
|
||||||
|
|
||||||
return Enum::Sound::NoSound;
|
return Enum::Sound::NoSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,6 +559,27 @@ void PartInstance::onTouch()
|
|||||||
case Enum::Sound::Boing:
|
case Enum::Sound::Boing:
|
||||||
sndService->playSound(sndService->findFirstChild("Boing"));
|
sndService->playSound(sndService->findFirstChild("Boing"));
|
||||||
break;
|
break;
|
||||||
|
case Enum::Sound::Break:
|
||||||
|
sndService->playSound(sndService->findFirstChild("Break"));
|
||||||
|
break;
|
||||||
|
case Enum::Sound::Snap:
|
||||||
|
sndService->playSound(sndService->findFirstChild("Snap"));
|
||||||
|
break;
|
||||||
|
case Enum::Sound::Bomb:
|
||||||
|
sndService->playSound(sndService->findFirstChild("Bomb"));
|
||||||
|
break;
|
||||||
|
case Enum::Sound::Splat:
|
||||||
|
sndService->playSound(sndService->findFirstChild("Splat"));
|
||||||
|
break;
|
||||||
|
case Enum::Sound::Page:
|
||||||
|
sndService->playSound(sndService->findFirstChild("Page"));
|
||||||
|
break;
|
||||||
|
case Enum::Sound::Ping:
|
||||||
|
sndService->playSound(sndService->findFirstChild("Ping"));
|
||||||
|
break;
|
||||||
|
case Enum::Sound::Swoosh:
|
||||||
|
sndService->playSound(sndService->findFirstChild("Swoosh"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,7 +719,7 @@ std::vector<PROPGRIDITEM> PartInstance::getProperties()
|
|||||||
"What sound plays when touched",
|
"What sound plays when touched",
|
||||||
(LPARAM)strSoundType(OnTouchSound),
|
(LPARAM)strSoundType(OnTouchSound),
|
||||||
PIT_COMBO,
|
PIT_COMBO,
|
||||||
TEXT("NoSound\0Victory\0Boing\0")
|
TEXT("NoSound\0Victory\0Boing\0Break\0Snap\0Bomb\0Splat\0Page\0Ping\0Swoosh\0")
|
||||||
));
|
));
|
||||||
|
|
||||||
sprintf_s(changeScoreTxt, "%d", changeScore);
|
sprintf_s(changeScoreTxt, "%d", changeScore);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ SoundInstance::SoundInstance()
|
|||||||
{
|
{
|
||||||
name = "Sound";
|
name = "Sound";
|
||||||
className = "Sound";
|
className = "Sound";
|
||||||
|
listicon = 8;
|
||||||
|
|
||||||
soundVolume = 0.5;
|
soundVolume = 0.5;
|
||||||
soundId = "";
|
soundId = "";
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ SoundService::SoundService()
|
|||||||
name = "SoundService";
|
name = "SoundService";
|
||||||
className = "SoundService";
|
className = "SoundService";
|
||||||
musicVolume = 0.3f;
|
musicVolume = 0.3f;
|
||||||
|
listicon = 8;
|
||||||
|
canDelete = false;
|
||||||
|
|
||||||
// Create stock sounds
|
// Create stock sounds
|
||||||
SoundInstance* stockSound = new SoundInstance();
|
SoundInstance* stockSound = new SoundInstance();
|
||||||
|
|||||||
@@ -159,8 +159,6 @@ int main(int argc, char** argv) {
|
|||||||
icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES|
|
icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES|
|
||||||
ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/;
|
ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/;
|
||||||
InitCommonControlsEx(&icc);
|
InitCommonControlsEx(&icc);
|
||||||
|
|
||||||
AudioPlayer::init();
|
|
||||||
HMODULE hThisInstance = GetModuleHandle(NULL);
|
HMODULE hThisInstance = GetModuleHandle(NULL);
|
||||||
|
|
||||||
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
|
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
|
||||||
|
|||||||
Reference in New Issue
Block a user