+BitJag Posted February 15, 2016 Share Posted February 15, 2016 Hi, just started working with the lynx and I am going through the tutorials at https://atarilynxdeveloper.wordpress.com/(LX.NET I believe) . Awesome set of tutorials, I already have a spaceship with some stars zooming past on the screen. Plus plenty of head scratching on how I can get my program to work on my flash card, another thread for another day maybe. I am trying to work out various pieces of a small "game" and I am currently stuck at sound. I noticed in the lynx.h header file that there are functions available for sound support, but I haven't been able to find much about them other than they exist. I was wondering if anyone would be willing to point me to an example (did a quick search on the forum and didn't spot anything myself...), or maybe build an example for me. Here is my process so far. I used Chipper 2.0 to make a quick tune and exported it with the /For BLL Driver>Export CC65 "remake"> option (I realize this may be my problem because it is under the "for BLL Driver category" and that the resulting .asm file is not formatted to work with cc65 library out of the box. Would like to verify this.) I then modify the labels int he .asm file for the name of the file, adding underscores to make them accessible to me in my C code. (Another clue that I am doing this completely wrong. You can tell I am new at this right? ). I then assemble the .asm file with ca665 and link it with the rest of my object files. In my C code I initialize the sound with lynx_snd_init(); I attempt to play the sound with lynx_snd_play ( Channel0 , &music); I included some defines at the top of my C file for the channels (Again, this doesn't feel like the appropriate way of doing this). I got these defines from another thread #define Channel0 (char *)0xfd20 #define Channel1 (char *)0xfd28 #define Channel2 (char *)0xfd30 #define Channel3 (char *)0xfd38 I included my source files. I am currently working in Linux environment. Thanks again for any help you can give a fledgling Lynx developer. 2-14-16_AA_sound_help.zip Quote Link to comment Share on other sites More sharing options...
+BitJag Posted February 15, 2016 Author Share Posted February 15, 2016 (edited) Did a bit more digging and found some gems. It seems that modifying the .asm produced from Clipper is appropriate at this point http://atariage.com/forums/topic/207105-pong-with-segments/page-3?do=findComment&comment=2740272 Also, found and example of the C code at work in the same thread. Thanks Karri! Time for some more trial and error to see if I can get this to work. http://atariage.com/forums/topic/207105-pong-with-segments/page-3?do=findComment&comment=3207763 Edit: The C code I uploaded is a mess by the way... sorry. Edited February 15, 2016 by lachoneus Quote Link to comment Share on other sites More sharing options...
+BitJag Posted February 15, 2016 Author Share Posted February 15, 2016 Okay... Pulled those useless defines from the top of my C file, and mimicked the initialization code from the link in the above post. Game starts fine, and then garbage fills the screen, and I can move the sprite around for a moment and then it stops for moment, and then I can move fore a moment etc... Reading into the above thread more leads me to believe that I need to adjust my lynx.cfg file and my directory lists. So this might be a memory issue with my compiled code not knowing where to put the music in memory? I admit, the content in the tutorials about the directory is still sinking in. I have read through it a few times, time to go through it again. Quote Link to comment Share on other sites More sharing options...
+BitJag Posted February 15, 2016 Author Share Posted February 15, 2016 (edited) Yes! Got the first channel of the song working. I wasn't pointing to the music data correctly in the C file. The first channel is working fine, anyone have any ideas on the second channel? I am sure I missing something incredibly simple. Right now I am assuming that I just tell it to play the second channel by changing the first function parameter to 1. No matter what I change the channel parameter to (0,1,2,3), it seems that it is just playing the first channel. Edited February 15, 2016 by lachoneus Quote Link to comment Share on other sites More sharing options...
+BitJag Posted February 23, 2016 Author Share Posted February 23, 2016 And it was incredibly simple... Took a look at the "Shaken Not Stirred" source code as suggested the aforementioned posts and I had it figured in a matter of minutes. Thanks again Karri for putting these examples together, I am definately going to do some more digging. For those who maybe running into a similar problem here is the path to the exact file that shows a struct for all four channels. "Shaken / resident / aaresident.c" lines 38-60 will get you on the right path. Just duplicate and you will have some awesome tunes running with your awesome games in no time. Quote Link to comment Share on other sites More sharing options...
8bit-Dude Posted September 29, 2019 Share Posted September 29, 2019 (edited) Hey Lachoneus! I am stuck with a similar problem to yours, and unfortunately the repo containing "Shaken / resident / aaresident.c" lines 38-60 is not online anymore. Basically, I tried to use your music.asm and soundbs.mac files, which I can compile and link. I then declared: extern unsigned char *music; void PlayMusic() { lynx_snd_pause(); lynx_snd_play(0, music); lynx_snd_continue(); } void StopMusic() { lynx_snd_stop(); } But the game just freezes when lynx_snd_play is called. I tried declaring music as other types, but I cannot get this to work... Would it be possible at all to upload an update of your demo in a working state? Thanks in advance, Tony Edited September 29, 2019 by 8bit-Dude Quote Link to comment Share on other sites More sharing options...
+BitJag Posted September 30, 2019 Author Share Posted September 30, 2019 @8bit-Dude It has been a few years since I have touched this stuff, but I did assemble a project to help me get back into it when the time was right. I can't walk you through the project at this point, since it has been a while since I have done anything with it. But I am going to trust my past self to have set this project up in such a way that the code works out of the box once you have a proper build environment set up. I do remember composing the song that plays in this program in Chipper, and that I put this together not too long after my posts in this thread. I hope this helps. blank_project.zip Quote Link to comment Share on other sites More sharing options...
8bit-Dude Posted September 30, 2019 Share Posted September 30, 2019 I got your example working with my code, that's awesome help buddy!! I am currently porting my 8bit-Unity SDK to the Lynx, and am 90% of the way there now. Quote Link to comment Share on other sites More sharing options...
8bit-Dude Posted September 30, 2019 Share Posted September 30, 2019 (edited) By the way, do you have some tips regarding implementation of sound effects on the Lynx? I found this information regarding direct programming of MIKEY, but I wonder if some API already exists that is easier to use: https://jum.pdroms.de/lynx/lynxaudio.html Edited September 30, 2019 by 8bit-Dude Quote Link to comment Share on other sites More sharing options...
+karri Posted September 30, 2019 Share Posted September 30, 2019 I already sent my comments in another thread where you asked the same question. Using HandyMusic is currently not included in the template. You can have a look at how I did it on another competition game "Find a way to my heart". It use HandyMusic for everything. PCM, SFX and bg music. https://bitbucket.org/karri/findaway Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.