yah
This commit is contained in:
parent
dfe5190d72
commit
6d4cdb2ba6
Binary file not shown.
|
@ -0,0 +1,17 @@
|
||||||
|
#include <proto/intuition.h>
|
||||||
|
#include <proto/dos.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
struct Window *window;
|
||||||
|
|
||||||
|
window = OpenWindowTags(NULL,
|
||||||
|
WA_Title, "Wow",
|
||||||
|
TAG_END
|
||||||
|
);
|
||||||
|
|
||||||
|
Delay(200);
|
||||||
|
|
||||||
|
CloseWindow(window);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
FROM LIB:c.o "justwindow.o"
|
||||||
|
TO "justwindow"
|
||||||
|
LIB LIB:sc.lib LIB:amiga.lib
|
||||||
|
|
38
main.c
38
main.c
|
@ -17,8 +17,9 @@
|
||||||
#include <proto/diskfont.h>
|
#include <proto/diskfont.h>
|
||||||
|
|
||||||
// handle images and sound
|
// handle images and sound
|
||||||
#include <proto/datatypes.h>
|
#include <clib/datatypes_protos.h>
|
||||||
#include <datatypes/datatypesclass.h>
|
#include <datatypes/datatypesclass.h>
|
||||||
|
#include <datatypes/soundclass.h>
|
||||||
|
|
||||||
// timer stuff. using proto/timer.h did not work well, likely
|
// timer stuff. using proto/timer.h did not work well, likely
|
||||||
// because of how you have to open the device.
|
// because of how you have to open the device.
|
||||||
|
@ -107,6 +108,7 @@ struct MsgPort *timerPort;
|
||||||
#define BELL_FILENAME "bell.8svx"
|
#define BELL_FILENAME "bell.8svx"
|
||||||
|
|
||||||
APTR bellSound = NULL;
|
APTR bellSound = NULL;
|
||||||
|
struct Library *DataTypesBase;
|
||||||
|
|
||||||
// our business logic
|
// our business logic
|
||||||
// for how long should I cook this pizza?
|
// for how long should I cook this pizza?
|
||||||
|
@ -177,6 +179,11 @@ int setup(void) {
|
||||||
// to get the current time.
|
// to get the current time.
|
||||||
TimerBase = TimerIO->tr_node.io_Device;
|
TimerBase = TimerIO->tr_node.io_Device;
|
||||||
|
|
||||||
|
if (NULL == (DataTypesBase = OpenLibrary("datatypes.library", 40))) {
|
||||||
|
// this is ok, we just won't play sound
|
||||||
|
printf("no sound!");
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +192,9 @@ int setup(void) {
|
||||||
*/
|
*/
|
||||||
void teardown(void) {
|
void teardown(void) {
|
||||||
// http://amigadev.elowar.com/read/ADCD_2.1/Devices_Manual_guide/node0196.html
|
// http://amigadev.elowar.com/read/ADCD_2.1/Devices_Manual_guide/node0196.html
|
||||||
|
if (DataTypesBase) {
|
||||||
|
CloseLibrary(DataTypesBase);
|
||||||
|
}
|
||||||
if (TimerIO) {
|
if (TimerIO) {
|
||||||
CloseDevice((struct IORequest *)TimerIO);
|
CloseDevice((struct IORequest *)TimerIO);
|
||||||
DeleteExtIO((struct IORequest *)TimerIO);
|
DeleteExtIO((struct IORequest *)TimerIO);
|
||||||
|
@ -508,7 +518,7 @@ int openAboutWindow(void) {
|
||||||
WA_DepthGadget, TRUE,
|
WA_DepthGadget, TRUE,
|
||||||
WA_CloseGadget, TRUE,
|
WA_CloseGadget, TRUE,
|
||||||
WA_Activate, TRUE,
|
WA_Activate, TRUE,
|
||||||
WA_Title, "Acout Pizza Timer",
|
WA_Title, "About Pizza Timer",
|
||||||
TAG_END
|
TAG_END
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -698,17 +708,29 @@ void handleIntuitionMessage(struct IntuiMessage *iMessage) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BYTE waitForSoundSignalNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start playing a bell sound, and start a timer to tear down
|
* Start playing a bell sound, then wait for it to finish.
|
||||||
* the bell data once it's done.
|
|
||||||
*/
|
*/
|
||||||
void startBellSound(void) {
|
void startBellSound(void) {
|
||||||
struct dtTrigger myTrigger;
|
struct dtTrigger myTrigger;
|
||||||
struct MsgPort *TimerPort;
|
struct MsgPort *TimerPort;
|
||||||
ULONG soundPlayResult;
|
ULONG soundPlayResult;
|
||||||
|
|
||||||
if (bellSound = NewDTObject(BELL_FILENAME, DTA_GroupID, GID_SOUND, TAG_END)) {
|
// https://amigaworld.net/modules/newbb/viewtopic.php?forum=15&topic_id=39094&post_id=735120&viewmode=thread&order=0#735120
|
||||||
|
waitForSoundSignalNumber = AllocSignal(-1);
|
||||||
|
|
||||||
|
if (bellSound = NewDTObject(
|
||||||
|
BELL_FILENAME,
|
||||||
|
DTA_GroupID, GID_SOUND,
|
||||||
|
// ourselves
|
||||||
|
SDTA_SignalTask, (ULONG)FindTask(NULL),
|
||||||
|
// ideally we should use this, but my headers aren't new enough?
|
||||||
|
// SDTA_SignalBitNumber, waitForSoundSignalNumber,
|
||||||
|
// so we'll do it this way
|
||||||
|
SDTA_SignalBit, 1 << waitForSoundSignalNumber,
|
||||||
|
TAG_END)) {
|
||||||
myTrigger.MethodID = DTM_TRIGGER;
|
myTrigger.MethodID = DTM_TRIGGER;
|
||||||
myTrigger.dtt_GInfo = NULL;
|
myTrigger.dtt_GInfo = NULL;
|
||||||
myTrigger.dtt_Function = STM_PLAY;
|
myTrigger.dtt_Function = STM_PLAY;
|
||||||
|
@ -717,6 +739,7 @@ void startBellSound(void) {
|
||||||
// https://github.com/khval/AmosKittens/blob/79f00ba3b81805b54fd4e437f667ea2eecab740d/OS/AmigaOS/animation.cpp#L128
|
// https://github.com/khval/AmosKittens/blob/79f00ba3b81805b54fd4e437f667ea2eecab740d/OS/AmigaOS/animation.cpp#L128
|
||||||
soundPlayResult = DoDTMethodA(bellSound, NULL, NULL, (Msg) &myTrigger);
|
soundPlayResult = DoDTMethodA(bellSound, NULL, NULL, (Msg) &myTrigger);
|
||||||
|
|
||||||
|
/**
|
||||||
TimerPort = TimerIO->tr_node.io_Message.mn_ReplyPort;
|
TimerPort = TimerIO->tr_node.io_Message.mn_ReplyPort;
|
||||||
|
|
||||||
// eventually wait for the sound to stop playing
|
// eventually wait for the sound to stop playing
|
||||||
|
@ -724,6 +747,7 @@ void startBellSound(void) {
|
||||||
TimerIO->tr_time.tv_secs = 2;
|
TimerIO->tr_time.tv_secs = 2;
|
||||||
TimerIO->tr_time.tv_micro = 0;
|
TimerIO->tr_time.tv_micro = 0;
|
||||||
SendIO((struct IORequest *)TimerIO);
|
SendIO((struct IORequest *)TimerIO);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,6 +759,7 @@ void waitForBellToFinish(void) {
|
||||||
ULONG timerSignal;
|
ULONG timerSignal;
|
||||||
|
|
||||||
if (bellSound) {
|
if (bellSound) {
|
||||||
|
/**
|
||||||
TimerPort = TimerIO->tr_node.io_Message.mn_ReplyPort;
|
TimerPort = TimerIO->tr_node.io_Message.mn_ReplyPort;
|
||||||
|
|
||||||
// TODO: move this into the main event loop, so that
|
// TODO: move this into the main event loop, so that
|
||||||
|
@ -743,7 +768,8 @@ void waitForBellToFinish(void) {
|
||||||
// or do we need two timer.devices with two separate IOs?
|
// or do we need two timer.devices with two separate IOs?
|
||||||
// https://amigadev.elowar.com/read/ADCD_2.1/Devices_Manual_guide/node00C4.html
|
// https://amigadev.elowar.com/read/ADCD_2.1/Devices_Manual_guide/node00C4.html
|
||||||
timerSignal = 1L << TimerPort->mp_SigBit;
|
timerSignal = 1L << TimerPort->mp_SigBit;
|
||||||
Wait(timerSignal);
|
*/
|
||||||
|
Wait(1 << waitForSoundSignalNumber);
|
||||||
|
|
||||||
DisposeDTObject(bellSound);
|
DisposeDTObject(bellSound);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue