MOD and MIDI interfaces added.
This commit is contained in:
parent
f96acfe020
commit
9be4485177
4 changed files with 135 additions and 56 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include <misctool.h>
|
#include <misctool.h>
|
||||||
#include <sound.h>
|
#include <sound.h>
|
||||||
#include <MIDISynth.h>
|
#include <MIDISynth.h>
|
||||||
|
#include <Orca.h>
|
||||||
#undef false
|
#undef false
|
||||||
#undef true
|
#undef true
|
||||||
|
|
||||||
|
@ -86,10 +87,6 @@ static byte *BORDER = (byte *)0xE0C034L;
|
||||||
|
|
||||||
|
|
||||||
static byte _jlBorderSaved;
|
static byte _jlBorderSaved;
|
||||||
static jint16 _jlMyID;
|
|
||||||
static jint16 _jlMemID;
|
|
||||||
static jint16 _jlMusicMemID;
|
|
||||||
static Handle _jlSHRShadowHandle;
|
|
||||||
static jint16 _jlHertz;
|
static jint16 _jlHertz;
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +94,7 @@ static jint16 _jlHertz;
|
||||||
#define JOEY_CHECK_TOOL_ERROR(w) if (_toolErr) _jlDieWithToolError(w, _toolErr);
|
#define JOEY_CHECK_TOOL_ERROR(w) if (_toolErr) _jlDieWithToolError(w, _toolErr);
|
||||||
void _jlDieWithToolError(const char *what, int err) {
|
void _jlDieWithToolError(const char *what, int err) {
|
||||||
char message[256];
|
char message[256];
|
||||||
sprintf(message, "Tool Error %04X %s", err, what);
|
sprintf(message, "Tool Error $%04X %s", err, what);
|
||||||
jlUtilDie(message);
|
jlUtilDie(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,29 +262,54 @@ bool _jlSoundLoad(jlSoundT **sound, char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicContinue(void) {
|
void jlSoundMidiContinue(void) {
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool jlSoundMidiIsPlaying(void) {
|
||||||
|
//***TODO***
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundMidiPause(void) {
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundMidiPlay(char *name) {
|
||||||
|
(void)name;
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundMidiStop(void) {
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundModContinue(void) {
|
||||||
NTPContinueMusic();
|
NTPContinueMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool jlSoundMusicIsPlaying(void) {
|
bool jlSoundModIsPlaying(void) {
|
||||||
return (NTPGetPlayingMusic() != 0xFFFF);
|
return (NTPGetPlayingMusic() != 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicPause(void) {
|
void jlSoundModPause(void) {
|
||||||
NTPPauseMusic();
|
NTPPauseMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicPlay(char *name) {
|
void jlSoundModPlay(char *name) {
|
||||||
char *temp = jlUtilMakePathname(name, "ntp");
|
char *temp = jlUtilMakePathname(name, "ntp");
|
||||||
_jlPascalStringT file;
|
_jlPascalStringT file;
|
||||||
|
|
||||||
_jlSetPascalString(file, temp);
|
_jlSetPascalString(file, temp);
|
||||||
//strcpy(file.text, temp);
|
NTPStartUp(userid());
|
||||||
//file.length = strlen(temp);
|
|
||||||
NTPStartUp(_jlMusicMemID);
|
|
||||||
JOEY_CHECK_TOOL_ERROR("NTPStartup")
|
JOEY_CHECK_TOOL_ERROR("NTPStartup")
|
||||||
NTPLoadOneMusic((Pointer)&file);
|
NTPLoadOneMusic((Pointer)&file);
|
||||||
JOEY_CHECK_TOOL_ERROR("NTPLoadOneMusic")
|
JOEY_CHECK_TOOL_ERROR("NTPLoadOneMusic")
|
||||||
|
@ -296,7 +318,7 @@ void jlSoundMusicPlay(char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicStop(void) {
|
void jlSoundModStop(void) {
|
||||||
NTPShutDown();
|
NTPShutDown();
|
||||||
JOEY_CHECK_TOOL_ERROR("NTPShutDown")
|
JOEY_CHECK_TOOL_ERROR("NTPShutDown")
|
||||||
}
|
}
|
||||||
|
@ -332,15 +354,15 @@ void jlUtilShutdown(void) {
|
||||||
asmStop();
|
asmStop();
|
||||||
|
|
||||||
// Shutdown tools
|
// Shutdown tools
|
||||||
/*
|
NTPShutDown(); // NinjaTracker
|
||||||
MSShutDown(); // MIDI Synth
|
UnloadOneTool(222);
|
||||||
SoundShutDown(); // Sound Tool Set
|
MSShutDown(); // MIDI Synth
|
||||||
*/
|
UnloadOneTool(35);
|
||||||
UnloadOneTool(0xDD); // NinjaTracker
|
SoundShutDown(); // Sound Tool Set
|
||||||
MTShutDown(); // Misc Tools
|
MTShutDown(); // Misc Tools
|
||||||
DisposeAll(_jlMemID);
|
DisposeAll(userid());
|
||||||
MMShutDown(_jlMyID); // Memory Manager
|
MMShutDown(userid()); // Memory Manager
|
||||||
TLShutDown(); // Tool Locator
|
TLShutDown(); // Tool Locator
|
||||||
|
|
||||||
jlUtilDie("Clean Exit.");
|
jlUtilDie("Clean Exit.");
|
||||||
}
|
}
|
||||||
|
@ -348,7 +370,7 @@ void jlUtilShutdown(void) {
|
||||||
|
|
||||||
void jlUtilStartup(char *appTitle) {
|
void jlUtilStartup(char *appTitle) {
|
||||||
|
|
||||||
handle ZeroPageHandle;
|
handle tempHandle;
|
||||||
ptr ZeroPagePtr;
|
ptr ZeroPagePtr;
|
||||||
InitialLoadOutputRec initialLoad;
|
InitialLoadOutputRec initialLoad;
|
||||||
char *temp;
|
char *temp;
|
||||||
|
@ -356,44 +378,59 @@ void jlUtilStartup(char *appTitle) {
|
||||||
|
|
||||||
(void)appTitle; // Unused on IIgs
|
(void)appTitle; // Unused on IIgs
|
||||||
|
|
||||||
// Start up neded tools
|
|
||||||
TLStartUp(); // Tool Locator
|
TLStartUp(); // Tool Locator
|
||||||
_jlMyID = MMStartUp(); // Memory Manager
|
JOEY_CHECK_TOOL_ERROR("TLStartUp")
|
||||||
_jlMemID = _jlMyID | 0x0100; // Set aux ID to 1.
|
MMStartUp(); // Memory Manager
|
||||||
_jlMusicMemID = _jlMyID | 0x0200; // Set music ID.
|
JOEY_CHECK_TOOL_ERROR("MMStartUp")
|
||||||
MTStartUp(); // Misc Tools
|
MTStartUp(); // Misc Tools
|
||||||
|
JOEY_CHECK_TOOL_ERROR("MTStartUp")
|
||||||
|
|
||||||
/*
|
// Reserve shadow area for SHR
|
||||||
ZeroPageHandle = NewHandle((Long)DPTotal, (Word)_jlMyMemID, (Word)attrBank | attrPage | attrFixed | attrLocked, (Long)0);
|
tempHandle = NewHandle((LongWord)0x8000, userid(), (Word)(attrLocked | attrFixed | attrAddr | attrBank), (Pointer)0x012000);
|
||||||
ZeroPagePtr = *ZeroPageHandle;
|
JOEY_CHECK_TOOL_ERROR("NewHandle SHR")
|
||||||
SoundStartUp((word)ZeroPagePtr + DPForSound); // Sound Tool Set
|
|
||||||
|
// Sound Tool Set
|
||||||
|
tempHandle = NewHandle((Long)DPTotal, userid(), (Word)(attrLocked | attrFixed | attrPage | attrBank), (Long)0);
|
||||||
|
JOEY_CHECK_TOOL_ERROR("NewHandle Sound")
|
||||||
|
ZeroPagePtr = *tempHandle;
|
||||||
|
SoundStartUp((word)ZeroPagePtr + DPForSound);
|
||||||
|
|
||||||
|
// Try to load MidiSynth from SYSTEM:TOOLS
|
||||||
|
LoadOneTool(35, 0);
|
||||||
|
if (_toolErr) {
|
||||||
|
// Not there. Try to manually load it from our disk.
|
||||||
|
temp = jlUtilMakePathname("Tool035", NULL);
|
||||||
|
_jlSetPascalString(toolFile, temp);
|
||||||
|
initialLoad = InitialLoad(userid(), (Pointer)&toolFile, 0);
|
||||||
|
JOEY_CHECK_TOOL_ERROR("Tool035")
|
||||||
|
SetTSPtr(0, 35, initialLoad.startAddr);
|
||||||
|
MSBootInit();
|
||||||
|
JOEY_CHECK_TOOL_ERROR("MSBootInit")
|
||||||
|
}
|
||||||
MSStartUp(); // MIDI Synth
|
MSStartUp(); // MIDI Synth
|
||||||
*/
|
JOEY_CHECK_TOOL_ERROR("MSStartUp")
|
||||||
|
|
||||||
// Try to load NinjaTrackerPlus from SYSTEM:TOOLS
|
// Try to load NinjaTrackerPlus from SYSTEM:TOOLS
|
||||||
LoadOneTool(0xDE, 0);
|
LoadOneTool(222, 0);
|
||||||
if (_toolErr) {
|
if (_toolErr) {
|
||||||
// Not there. Try to manually load it from our disk.
|
// Not there. Try to manually load it from our disk.
|
||||||
temp = jlUtilMakePathname("Tool222", NULL);
|
temp = jlUtilMakePathname("Tool222", NULL);
|
||||||
_jlSetPascalString(toolFile, temp);
|
_jlSetPascalString(toolFile, temp);
|
||||||
initialLoad = InitialLoad(_jlMyID, (Pointer)&toolFile, 0);
|
initialLoad = InitialLoad(userid(), (Pointer)&toolFile, 0);
|
||||||
JOEY_CHECK_TOOL_ERROR("Tool222")
|
JOEY_CHECK_TOOL_ERROR("Tool222")
|
||||||
SetTSPtr(0, 222, initialLoad.startAddr);
|
SetTSPtr(0, 222, initialLoad.startAddr);
|
||||||
NTPBootInit();
|
NTPBootInit();
|
||||||
|
JOEY_CHECK_TOOL_ERROR("NTPBootInit")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reserve shadow area for SHR
|
|
||||||
_jlSHRShadowHandle = NewHandle((LongWord)0x8000, (Word)_jlMemID, (Word)(attrLocked + attrFixed + attrBank + attrAddr), (Pointer)0x012000);
|
|
||||||
JOEY_CHECK_TOOL_ERROR("NewHandle")
|
|
||||||
|
|
||||||
// Start assembly module
|
// Start assembly module
|
||||||
_jlHertz = (int)ReadBParam((Word)0x1D) == 0 ? 60 : 50; // Is this a PAL or NTSC machine?
|
_jlHertz = (int)ReadBParam((Word)0x1D) == 0 ? 60 : 50; // Is this a PAL or NTSC machine?
|
||||||
asmStart(_jlMyID, _jlHertz / 10);
|
asmStart(userid(), _jlHertz / 10);
|
||||||
|
|
||||||
// SHR on
|
// SHR on
|
||||||
asmGrOn();
|
asmGrOn();
|
||||||
|
|
||||||
// If you work out the Screen Conrol Bytes, everything we want is zero.
|
// If you work out the Screen Conrol Bytes, everything we want is zero.
|
||||||
// So we just memset all 200 of them.
|
// So we just memset all 200 of them.
|
||||||
memset(SHRSCB, 0, 200);
|
memset(SHRSCB, 0, 200);
|
||||||
|
|
||||||
|
|
|
@ -501,25 +501,53 @@ bool _jlSoundLoad(jlSoundT **sound, char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicContinue(void) {
|
void jlSoundMidiContinue(void) {
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool jlSoundMidiIsPlaying(void) {
|
||||||
|
//***TODO***
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundMidiPause(void) {
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundMidiPlay(char *name) {
|
||||||
|
(void)name;
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundMidiStop(void) {
|
||||||
|
//***TODO***
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jlSoundModContinue(void) {
|
||||||
Mix_ResumeMusic();
|
Mix_ResumeMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool jlSoundMusicIsPlaying(void) {
|
bool jlSoundModIsPlaying(void) {
|
||||||
return (bool)Mix_PlayingMusic();
|
return (bool)Mix_PlayingMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicPause(void) {
|
void jlSoundModPause(void) {
|
||||||
Mix_PauseMusic();
|
Mix_PauseMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicPlay(char *name) {
|
void jlSoundModPlay(char *name) {
|
||||||
if (_jlMusicHandle != NULL) {
|
if (_jlMusicHandle != NULL) {
|
||||||
jlSoundMusicStop();
|
jlSoundModStop();
|
||||||
}
|
}
|
||||||
_jlMusicHandle = Mix_LoadMUS(jlUtilMakePathname(name, "mod"));
|
_jlMusicHandle = Mix_LoadMUS(jlUtilMakePathname(name, "mod"));
|
||||||
if (_jlMusicHandle != NULL) {
|
if (_jlMusicHandle != NULL) {
|
||||||
|
@ -530,8 +558,8 @@ void jlSoundMusicPlay(char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlSoundMusicStop(void) {
|
void jlSoundModStop(void) {
|
||||||
if (jlSoundMusicIsPlaying()) {
|
if (jlSoundModIsPlaying()) {
|
||||||
Mix_HaltMusic();
|
Mix_HaltMusic();
|
||||||
}
|
}
|
||||||
if (_jlMusicHandle != NULL) {
|
if (_jlMusicHandle != NULL) {
|
||||||
|
|
|
@ -275,7 +275,7 @@ char jlKeyRead(void);
|
||||||
void jlKeyWaitForAny(void);
|
void jlKeyWaitForAny(void);
|
||||||
|
|
||||||
void jlPaletteDefault(void); //***TODO*** Treat palettes like we do "surfaces" - allow changing STAs or display
|
void jlPaletteDefault(void); //***TODO*** Treat palettes like we do "surfaces" - allow changing STAs or display
|
||||||
void jlPaletteSet(byte index, byte r, byte g, byte b);
|
void jlPaletteSet(byte index, byte r, byte g, byte b); //***TODO*** Really need a matching "get"
|
||||||
void jlPaletteSetFromImg(jlImgT *img);
|
void jlPaletteSetFromImg(jlImgT *img);
|
||||||
|
|
||||||
void jlSoundFree(jlSoundT *sound);
|
void jlSoundFree(jlSoundT *sound);
|
||||||
|
@ -283,11 +283,16 @@ bool jlSoundIsPlaying(jlSoundT *sound);
|
||||||
#define jlSoundLoad(sound, filename) _jlSoundLoad((jlSoundT **)&(sound), filename) // Syntatic Sugar
|
#define jlSoundLoad(sound, filename) _jlSoundLoad((jlSoundT **)&(sound), filename) // Syntatic Sugar
|
||||||
bool _jlSoundLoad(jlSoundT **sound, char *filename);
|
bool _jlSoundLoad(jlSoundT **sound, char *filename);
|
||||||
|
|
||||||
void jlSoundMusicContinue(void);
|
void jlSoundMidiContinue(void);
|
||||||
bool jlSoundMusicIsPlaying(void);
|
bool jlSoundMidiIsPlaying(void);
|
||||||
void jlSoundMusicPause(void);
|
void jlSoundMidiPause(void);
|
||||||
void jlSoundMusicPlay(char *name);
|
void jlSoundMidiPlay(char *name);
|
||||||
void jlSoundMusicStop(void);
|
void jlSoundMidiStop(void);
|
||||||
|
void jlSoundModContinue(void);
|
||||||
|
bool jlSoundModIsPlaying(void);
|
||||||
|
void jlSoundModPause(void);
|
||||||
|
void jlSoundModPlay(char *name);
|
||||||
|
void jlSoundModStop(void);
|
||||||
void jlSoundPlay(jlSoundT *sound);
|
void jlSoundPlay(jlSoundT *sound);
|
||||||
|
|
||||||
void jlStnFree(jlStnT *stn);
|
void jlStnFree(jlStnT *stn);
|
||||||
|
|
|
@ -282,17 +282,26 @@ void lineTest(void) {
|
||||||
|
|
||||||
void musicTest(void) {
|
void musicTest(void) {
|
||||||
jlImgT *kanga = NULL;
|
jlImgT *kanga = NULL;
|
||||||
|
jlImgT *font = NULL;
|
||||||
|
|
||||||
if (!jlImgLoad(kanga, "kanga")) jlUtilDie("Unable to load kanga.img!");
|
if (!jlImgLoad(kanga, "kanga")) jlUtilDie("Unable to load kanga.img!");
|
||||||
|
if (!jlImgLoad(font, "font")) jlUtilDie("Unable to load font.img!");
|
||||||
|
|
||||||
jlImgDisplay(kanga);
|
jlImgDisplay(kanga);
|
||||||
jlDisplayPresent();
|
jlDisplayPresent();
|
||||||
|
|
||||||
jlSoundMusicPlay("music");
|
jlSoundModPlay("music");
|
||||||
|
|
||||||
jlKeyWaitForAny();
|
while (!jlKeyPressed()) {
|
||||||
|
printAt(font, NULL, 1, 1, "%dx%d %d %d ", jlGameGetAxis(0), jlGameGetAxis(1), jlGameGetButton(0), jlGameGetButton(1));
|
||||||
|
jlDisplayPresent();
|
||||||
|
}
|
||||||
|
jlKeyRead();
|
||||||
|
|
||||||
jlSoundMusicStop();
|
jlSoundModStop();
|
||||||
|
|
||||||
|
jlImgFree(font);
|
||||||
|
jlImgFree(kanga);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue