08 January 2017, 02:22 | #1 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Looking inside a directory: The final frontier
I'm making a little tool to search through my Protracker sample files and I'm a little confused about dos.library. I want to create a list of the files in a directory. I'm passing in an Exec list and a path ("ST-XX:ST-01") to this function:
Code:
void DoSearch(struct List *resultsList, UBYTE *dirName){ BPTR dirLock = Lock((STRPTR)dirName, ACCESS_READ); if(BADDR(dirLock) == NULL){ printf("Couldn't obtain lock on %s!\n", dirName); return; } struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, TAG_DONE); if(Examine(dirLock, fib)){ /* make a Node and add it to resultsList, then ExNext(dirLock, fib) and do the same until out of locks */ } } |
08 January 2017, 03:39 | #2 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Nevermind, I had a typo that was making ExNext not work properly... you can lock/delete this thread.
|
08 January 2017, 04:50 | #3 |
Banned
Join Date: Dec 2016
Location: Nottingham, UK
Posts: 481
|
I guess it's a pretty big collection.
I usually just search by hand with wildcards at the Shell, but I understand that's a pretty basic way of trying to organize big complex things. Like mod collections. |
08 January 2017, 06:00 | #4 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Yeah, I've got the whole set from ST-01 to ST-4F or whatever it was. It's a lot of files. It's basically just a way for me to learn Gadtools.
|
08 January 2017, 20:17 | #5 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Playing the 8SVX samples is easy enough with datatypes.library but I'm having some trouble with audio.device trying to play the raw 8-bit PCM samples. I'm following the example in the Devices manual but can't seem to get my sample to play. All this code does is freeze the application at WaitPort. The sample I have is 9900 bytes long, is that too long for audio.device to play in one shot?
Code:
void PB_PlayPCM(char *fileName){ //Open the file and load it into chipmem. BPTR audioFile = Open(fileName, MODE_OLDFILE); BYTE *pcmData = (BYTE*)AllocMem(16384, MEMF_CHIP|MEMF_CLEAR); //TODO: get actual size. one i'm testing is 9900 bytes LONG sampleCount = Read(audioFile, pcmData, 16384); printf("Loaded %s as %d samples at %p. Playing as raw 8-bit PCM.\n", fileName, sampleCount, pcmData); UBYTE channelPriority[] = { 1, 2, 4, 8 }; //request any available channel struct IOAudio *AudioIO; //I/O block for I/O commands struct MsgPort *AudioMP; //Message port for replies struct Message *AudioMSG;//Reply message ptr ULONG device; LONG clock = 3579545; //NTSC LONG frequency = 440; //reference frequency LONG duration; LONG sampleCycles = 1; //cycle count //Set up AudioIO to access the audio device. AudioIO = (struct IOAudio *)AllocMem(sizeof(struct IOAudio), MEMF_PUBLIC|MEMF_CLEAR); if(AudioIO == NULL){ printf("Error initializing AudioIO\n"); return; } //Create the reply port AudioMP = CreatePort(0, 0); if(AudioMP == NULL){ printf("Error creating AudioMP\n"); return; } //Set up the I/O block AudioIO->ioa_Request.io_Message.mn_ReplyPort = AudioMP; AudioIO->ioa_Request.io_Message.mn_Node.ln_Pri = 0; AudioIO->ioa_Request.io_Command = ADCMD_ALLOCATE; AudioIO->ioa_Request.io_Flags = ADIOF_NOWAIT; AudioIO->ioa_AllocKey = 0; AudioIO->ioa_Data = channelPriority; AudioIO->ioa_Length = sizeof(channelPriority); printf("I/O block initialized. Trying to open the audio device.\n"); device = OpenDevice(AUDIONAME, 0L, (struct IORequest *)AudioIO, 0L); if(device != 0){ printf("Error opening audio device.\n"); return; } printf("Device %s opened. Allocated a channel.\n", AUDIONAME); //Set up the Audio I/O block to play our sound AudioIO->ioa_Request.io_Message.mn_ReplyPort = AudioMP; AudioIO->ioa_Request.io_Command = CMD_WRITE; AudioIO->ioa_Request.io_Flags = ADIOF_PERVOL; AudioIO->ioa_Data = pcmData; AudioIO->ioa_Length = sampleCount; AudioIO->ioa_Period = clock*sampleCycles/(sampleCount*frequency); AudioIO->ioa_Volume = 64; AudioIO->ioa_Cycles = 1; printf("Playing PCM sound %s\n", fileName); BeginIO((struct IORequest *)AudioIO); WaitPort(AudioMP); AudioMSG = GetMsg(AudioMP); printf("Sound finished playing\n"); if(pcmData != 0) FreeMem(pcmData, sampleCount); if(device == 0) CloseDevice((struct IORequest *)AudioIO); if(AudioMP != 0) DeletePort(AudioMP); if(AudioIO != 0) FreeMem(AudioIO, sizeof(struct IOAudio)); } |
09 January 2017, 09:55 | #6 | |
Amiga Nuts!
Join Date: Sep 2006
Location: Le Mayet d'Ecole, 03800, FRANCE
Posts: 176
|
st-xx disks :)
Quote:
I never had the opportunity to collect all the st-xxx disks (i'm sure I'm not the sole in this case) so it would be very cool if you could send it all to "the zone" or an ftp so we can get it ^^) Thanks a lot by advance 61 |
|
10 January 2017, 10:55 | #8 |
Amiga Nuts!
Join Date: Sep 2006
Location: Le Mayet d'Ecole, 03800, FRANCE
Posts: 176
|
thanks for the tip (had forgotten about it) ^^)
btw, there is st-01 to st-b6 (116 disks) only there. do yours really go upto st-4F ??? |
10 January 2017, 15:02 | #9 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
I've got the Aminet package of disks. I also got PCM audio playback working in my program!
|
11 January 2017, 11:08 | #10 |
Amiga Nuts!
Join Date: Sep 2006
Location: Le Mayet d'Ecole, 03800, FRANCE
Posts: 176
|
cool ! I'll be happy to betatest your soft (have all amigas there, classic and NG) ^^)
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Star Trek V: The Final Frontier | derSammler | project.aGTW | 13 | 09 June 2023 10:00 |
FinalWriter 97; FinalCalc 1.04; Final Data 2.00 & Final Copy | aebrown-u | request.Apps | 20 | 12 July 2009 11:19 |
Directory Opus 4.12 Final | Blip | request.Apps | 13 | 16 November 2008 18:38 |
carvup final frontier ???? | turrican3 | request.Old Rare Games | 37 | 09 February 2008 14:57 |
CarVup: The Final Frontier | jrom | request.Old Rare Games | 3 | 18 June 2006 11:57 |
|
|