Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]   Go Down

Author Topic: call playsid.library  (Read 11534 times)

0 Members and 1 Guest are viewing this topic.

zerina

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
  • Generic Amiga User
Re: call playsid.library
« Reply #15 on: May 25, 2013, 06:30:58 PM »

Again thanks for your help,
i followed your advice and added your example Statement but it still crashes when calling the play.
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: call playsid.library
« Reply #16 on: May 25, 2013, 06:41:54 PM »

LVO Setmodule is looking for the locaiton of the file, not the filename.  Your original code just pointed to the filename when calling it.  Set the second parameter of LVO Setmodule to be Start(15).
Logged

zerina

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
  • Generic Amiga User
Re: call playsid.library
« Reply #17 on: May 25, 2013, 07:52:11 PM »

Again you are right, but i allready played with start(15), still no joy......

While i was writing these lines i found the solution, the set module has to be called like this.
Code: [Select]
STATUS=Lvo Setmodule)Start(15),Start(15),M0DULE_LENGTH
The Documentation says
Quote
In one part files the file location and header could be the same, becuase the function skips the headers.
And now it works, thank you very much for your help

But SID file plays a bit to fast, faster than playing it from Workbench by using the sidplayer.

Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: call playsid.library
« Reply #18 on: May 25, 2013, 08:32:14 PM »

And now it works, thank you very much for your help

But SID file plays a bit to fast, faster than playing it from Workbench by using the sidplayer.

Are there any functions in the library that allow you to adjust the speed?
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: call playsid.library
« Reply #19 on: May 25, 2013, 08:55:00 PM »

Try "LVO Setvertfreq(50)" before you play it.
Logged

zerina

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
  • Generic Amiga User
Re: call playsid.library
« Reply #20 on: May 25, 2013, 09:16:52 PM »

Guys finaly everything works  :D

"LVO Setvertfreq(50)" brought the right speed

i played with icon settings as mentioned in the readme, anyway  the LVO Setvertfreq(50) made it.

Funtastic help here !!!
regards


Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: call playsid.library
« Reply #21 on: May 25, 2013, 10:32:33 PM »

You're welcome!
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: call playsid.library
« Reply #22 on: May 26, 2013, 12:43:03 AM »

Any chance you cod post your working code, so that others might
A- have working SID files on Amos
B- maybe learn something about library calls in Amos!!!

Thanks!!
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

zerina

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
  • Generic Amiga User
Re: call playsid.library
« Reply #23 on: May 26, 2013, 01:08:12 PM »

Off course, i will post the code and some explanation
Logged

zerina

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
  • Generic Amiga User
Re: call playsid.library
« Reply #24 on: May 26, 2013, 04:58:23 PM »

Final Solution:
(only a small Example without any special error handling)

1) First off all you need the playsid.library and the fd file for the playsid.library
2) By using the FD Builder (can be found here in the Download Section) go an create an Amos-Extension fot the use of the playsid.library
3) Add this new Extension to your Amos enviroment

now add some code to your project.
4.) Open the Library
Code: [Select]
   Erase All
A=_playsid Base()
If A=0
 Print "error"
End If
5.) Init
Code: [Select]
A=Lvo Allocemulresource()6)Load a SID File
Code: [Select]
M0DULE$=Fsel$("*.sid","","Load a ","SID Module")
M0DULE$=M0DULE$+Chr$(0)
Open Random 1,M0DULE$
M0DULE_LENGTH=Lof(1)
Close 1

7) Reserve memory for the  header
Code: [Select]
Reserve As Work 14,124
SIDHEAD=Start(14)

8) Call Readicon
Code: [Select]
STATUS=Lvo Readicon(Varptr(M0DULE$),SIDHEAD)
9) Call Checkmodule
Code: [Select]
STATUS=Lvo Checkmodule(SIDHEAD)
10) Reserve a Bank and load the sid module
Code: [Select]
Reserve As Work 15,M0DULE_LENGTH : Bload M0DULE$,15
M0DULE_POINTER=Varptr(M0DULE$)

11) Call Setmodule
Code: [Select]
STATUS=Lvo Setmodule(Start(15),Start(15),M0DULE_LENGTH)
12) Call Setvertfreq (50=PAL)
Code: [Select]
STATUS=Lvo Setvertfreq(50)
13) Call Startsong(Play tune X)
Code: [Select]
STATUS=Lvo Startsong(1)
Off Course we need error handling and more functions linke Stopsong, and off course we need to close the lib etc.

BTW can we Build an Small extension wit functions included ?

Again thanks for all the help / support without this would never been possible.
Logged

james666

  • AMOS Dev
  • A600
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 32
Re: call playsid.library
« Reply #25 on: May 31, 2013, 11:05:46 PM »

I've been going a little crazy thinking about AmosPro redevelopment so I thought I'd refresh my brain by creating something a bit more self-contained.  The attachment contains a simple extension that serves as a user-friendly AmosPro wrapper for the PlaySid.library.  playsid.lib needs to be copied to the APSystem directory and installed as extension number 20 in the interpreter.  (You can change the extension number if necessary by re-assembling the source.)  The new commands are as follows:

Psload filename, bank number  This loads the module, checks it and copies it to the specified memory bank.  Both header and data are copied to the same bank.  It should work whether the header is in a separate filename.icon file or contained in the main file.  After the bank is created, it can be saved and reloaded as a .abk file using the normal Save and Load commands.

=Psbanklength(bank number) returns the number of songs in the specified bank. 

Psplay bank number, song number plays the specified song.

Psstop stops the music.

Pspause pauses the music. 

Pscontinue resumes music after a Pspause.

Pssetvertfreq frequency can be used to adjust the frequency between PAL (50) and NTSC (60).

Pscloselib stops the music, closes playsid.library and frees its resources.  (The library is automatically opened when the first Ps command is used.)

Known issues: Amos will crash if you attempt to use the normal sound commands and playsid.library at the same time.  Normal sound commands should be OK if playsid is loaded but not actually playing.

A simple example program:
Quote
Psload "andi-music",10
For I=1 to Psbanklength(10)
Psplay 10,I
Wait 400
Next I
Psstop

EDIT - There was a stupid bug in my original attachment that prevented single file SID modules from loading.  Should have tested this first.  A fixed version is attached.
« Last Edit: June 01, 2013, 02:56:33 PM by james666 »
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: call playsid.library
« Reply #26 on: May 31, 2013, 11:11:48 PM »

Wow! James666 you are bringing a lot of cool new stuff to AMOS!

I had been working on a Horace Goes Skiing remake before, so I can now add the C64 music as an added bonus :)

Looking forward to trying this out :)

Oh... And thanks!
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

james666

  • AMOS Dev
  • A600
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 32
Re: call playsid.library
« Reply #27 on: June 01, 2013, 12:10:19 AM »

I had been working on a Horace Goes Skiing remake before, so I can now add the C64 music as an added bonus :)

The only snag is that playsid.library is rather CPU-heavy.  I believe it's converting 6502 code on the fly as well as emulating the brilliant SID chip.
Logged
Pages: 1 [2]   Go Up
 

TinyPortal 2.2.2 © 2005-2022