News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ronaldo

#CPCtelera 1.4.2. release

Started by ronaldo, 11:59, 11 May 15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

awergh

Seeing some peoples dislike for cygwin I decided to try building CPCtelera with mingw and msys. I would have preferred not to need msys but the to use the sdcc configure script it really needed msys, alternatively I could have used Visual Studio to build sdcc but I figured that might be a bit much if someone else wanted to build it.

I have as far as I can see successfully built the tools and cpctelera.lib while leaving the makefiles intact so it should still compile with linux although I haven't checked.
I only have the examples left to build which looks time consuming if I don't want to just do a find and replace to fix up all the finds (windows has its own find that doesnt work for this) and fix my include errors (probably missed a step in building sdcc).

Oh and porting the tools\scripts as well hmmmm

I'm just wondering how worthwhile it is to do a complete build on windows without cygwin. I find I do have a bit of a tendency to get bored of various programming projects if they are tedious or I discover something more exciting!

Heh and maybe one day I'll actually play with CPCtelera for real  :) .

ronaldo

Well, @awergh. I think that's a ton of work or more, and you actually do impress me: never thought of anyowe willing to do such amount of non-ceremonious work :).

I have never had the opportunity to run MSYS, but it should come with some version of bash and GNU make. That should be enough for running scripts on tools/scritps and most makefiles. Anyway, have you tried enabling Interix? I assume you are on Windows 7+. (Well, I think GCC compiler comming with Interix is too old, but you may try).

I personally think that this is too much work for a result that won't be completely satisfactory. Moreover, take into accont that any change on CPCtelera will probably require a great amount of work to port it to Windows. The main problem is not developing, but maintaining.

When we started CPCtelera we decided to support Cygwin for productivity reasons. Our limited time should be productive and we have to create useful things, rather than fighting with different systems' idiosyncrasies. Maintaining a Windows build system, tools and setup would have been like doubling the size of the project (like doing almost 2 different projects) due to the differences with *NIX environments (mainly Linux and OSX).

So, I think that Windows users have enough alternatives for using CPCtelera:

       
  • They can use Cygwin. I personally don't think is "so bad", and I don't think there is also so many people against Cygwin with serious reasons. If someone is so worried about Cygwin's security problems, they shouldn't use Windows (BSD would be a good choice).
  • They can also use Virtualbox + Linux. Both are free and can be download in a while. Create a virtual machine, install your favorite Linux distro and donwload CPCtelera inside.
  • Other Virtual Machine Managers are also available (like VMWare or VirtualPC). You can choose your favorite.
  • You always can install a native Linux in a partition or even get rid of Windows :).
Having such a number of alternatives makes me think that investing time in creating a native version of CPCtelera for a non-developer-oriented system like Windows in non-productive work. In a portion of the time required you can install a virtual machine with Linux and have all the functionalities working.
Anyways, this is just my opinion. If you are really interested in porting it to Windows and some people like it, for me is more than okay: it's amazing :D. It'd be even more amazing if there were enough people to maintain it over time :D.

As Gandalf says: "All we have to decide is what to do with the time that is given us". ;)

Arnaud

With the latest version on gitHub i have seen two little problems when building my project :

       
  • When a .h is modified, the make command doesn't detect the modification and don't build
  • Another problem is on the automatic DSK population, when the obj directory doesn't exist all the files in dsk_files are taken into account, but on build update the dsk in created with only the binary

Alcoholics Anonymous

Quote from: awergh on 15:43, 29 August 15
Seeing some peoples dislike for cygwin I decided to try building CPCtelera with mingw and msys. I would have preferred not to need msys but the to use the sdcc configure script it really needed msys, alternatively I could have used Visual Studio to build sdcc but I figured that might be a bit much if someone else wanted to build it.

I'm not clear on why cygwin has to be used but if it's to compile sdcc for windows, you should know you don't have to compile it.  If you go to the sdcc nightly builds and grab the windows version, everything has already been compiled for you and you can run sdcc directly on windows without doing anything except unzipping and setting the path variable.

awergh

@ronaldo
You mean no one likes modifying makefiles shellscripts and a bit of PowerShell just for the fun of it  :P
Nope haven't tried Interix but it is no longer included with Windows so it isn't really a workable solution anyway.

I can understand why you went with Cygwin, in actual fact I don't really mind Cygwin except installing it where it seems to want to download the internet but I was mostly curious to see if it was workable to build under windows easily.

In an ideal world you could use cmake and build everything instead of manual makefiles but I see that as being way too much work to setup for what isn't a huge project.
I think I'll probably clean up what I've done and provide it on github in case anyone is interested in it because you never know ;)


@Alcoholics Anonymous

Cygwin is used for building cpctelera.lib and sdcc and for the scripts that you use for your cpctelera game projects. I don't know if the version of SDCC included with cpctelera is customised at all but I was mostly keeping to the same build process because that seemed the logical choice.

ronaldo

@Alcoholics Anonymous: It's not because of SDCC. CPCtelera is being developed under Linux and support is given for OSX and Cygwin. All tools coming with CPCtelera are ready to build on the 3 systems (Cygwin, Linux and OSX). Everything is based on Makefiles and shell scripts, not only tool builds, but all the build system and the environment. Everything relies on a bash shell and a POSIX system. :)

@awergh: No, I didn't mean that, of course :) . It's just that your sudden interest surprises me, in a way positive sense :D . Although I have a personal opinion, I greatly appreciate your effort. It's amazing for me :) . I thought of using CMake long time ago, but it also had drawbacks, like changing and maintaining the build system of some tools. I use CMake on other projects and it's great, but I didn't consider it necessary for this one. It might be reconsidered in the future, but I don't think of building on Windows as great argument in favor of CMake: I think CMake is good by itself ;) .

ronaldo


@Arnaud Bouche: Thank you for testing and reporting. Regarding your issues...

Header files

H files have been never taken as a dependency in CPCtelera's makefiles. The problem is that SDCC does not have a way to create dependency files like GCC. Therefore, there is no easy way to know which C files depend on which H files. However, you can provide this information manually to the compiler, at the end of the Makefile. For instance, if you wanted src/actions.c to be recompiled whenever an included header file is modified, you could do this:

# actions.rel depends on actions.c and all header files included from actions.c
obj/actions.rel: src/actions.c src/actions.h src/defines.h src/character.h src/drawScene.h src/structures.h


Alternatively you could tell the compiler to recompile all C files when any H file is changed. If you don't mind such recompilation, this is easy to tell to the compiler in the Makefile:

# List all Header files in the source folder and subfolders
HFILES := $(foreach DIR, $(SUBDIRS), $(wildcard $(DIR)/*.h))

# Make each C File depend on all Header files
$(foreach F, $(C_OBJFILES), $(eval $(F):$(HFILES)))


Inclusion of files in the DSK

This is an issue I introduced because I didn't check it properly. I have to do some modifications to solve it. When solved, I will report it here for you to update.

Thank you again for reporting :D

Arnaud

Previously i have installed CPCTelera with Cygwin64 with the instructions and i have no problems.

This morning i have installed CPCTelera with Cygwin32 and i have to add the following packages in order to compile during installation :

       
  • Mingw-gcc-core
  • Mingw-gcc-g++
For information (if someone have the same problem), on my Windows 10 64bits i have to launch Cygwin32 in compatible mode Windows 8, if not the installation compilation fails randomly.




ronaldo

@Arnaud Bouche: That doesn't sound as a CPCtelera problem. Sounds more like a Cygwin32 problem on Windows10. Doesn't seem logical at all to require mingw packages. Are you sure you added standard gcc-core and gcc-g++ cygwin packages (not mingw ones)?

I don't have any Windows10 here to test, but I don't think I can do anything to solve this issue. Anyways, I'd like to report it in the installation instructions.

Arnaud

Quote from: ronaldo on 08:29, 30 August 15
Are you sure you added standard gcc-core and gcc-g++ cygwin packages (not mingw ones)?
Yes, i have compared my two setup list package x86 and x64 side to side and they were identical.

Quote from: ronaldo on 08:29, 30 August 15
I don't have any Windows10 here to test, but I don't think I can do anything to solve this issue. Anyways, I'd like to report it in the installation instructions.
Yes or in a FAQ

ronaldo

@Arnaud Bouche: Last update to CPCtelera master branch should solve your problem with files being removed from DSK on recompiling :D

Arnaud

Quote from: ronaldo on 09:44, 30 August 15
@Arnaud Bouche: Last update to CPCtelera master branch should solve your problem with files being removed from DSK on recompiling :D
Just tried and the problem always here the files are not added on build update.

ronaldo

If you have just updated and typed in 'make', that's normal. You first have to make a complete rebuild. Otherwise, the build system thinks that files are already on the disk and does not add them.

Type in this:

make cleanall && make

make cleanall removes all object files and DSKs generated to let you do a subsequent complete rebuild using make.

After that, your DSK file should be kept up to date on changes.


mr_lou

I've been kept away from my project by work and other non-exciting things.

Had a little time today to start looking into sound-effects, and I just can't get anything playing.

Music plays fine.
I fade it out. Stop it, and then (just to be on the safe side) I set fadevolume to 0 again.

For starters I'm just trying to play the instruments in the same song. So at the beginning I have:


cpct_akp_musicInit((u8*) 0x40);
cpct_akp_SFXInit((u8*) 0x40);


And to play a sound effect I try:


cpct_akp_SFXPlay(3, 15, 80, 0, 0, 0);


But nothing.
Anything comes to mind?

EDIT: Doh... nevermind. I have a feeling I'm being stupid. Obviously the sound-effects has to be played the same way as the music, right? I.e. I have to call the function in the loop repeatedly.

EDIT2: Hm no, that didn't seem to be it.....

ronaldo

@mr_lou: There is a flaw in the documentation. In the article about cpct_akp_SFXPlay, it says this:


void cpct_akp_SFXPlay (u8 sfx_num, u8 volume, u8 note, u8 speed, u16 inverted_pitch, u8 channel_num)

Input Parameters (7 bytes)
....
(1B A ) channel_num    Number of Channel where to reproduce the FX (0, 1, 2)


This is wrong. Latest parameter should be called channel_bitmask, as it is not an index number, but a bitmask. Channels are A = 1 (001), B = 2 (010), C = 4 (100). Confusion comes from channel names, which are also referred as 0, 1 and 2 (A, B and C). Channel bitmasks are defined in audio.h, and included when you include cpctelera.h, also referred in the documentation article about Audio Constants&Variables. They are defined this way:
#define AY_CHANNEL_A    0b00000001
#define AY_CHANNEL_B    0b00000010
#define AY_CHANNEL_C    0b00000100
#define AY_CHANNEL_ALL  0b00000111

Try changing your call to SFXPlay with this:
cpct_akp_SFXPlay(3, 15, 80, 0, 0, AY_CHANNEL_A);

I've already changed this in the documentation files, and will be fixed for next release of CPCtelera. Thank you very much for reporting :) .

mr_lou

Quote from: ronaldo on 17:37, 25 September 15
Try changing your call to SFXPlay with this:
cpct_akp_SFXPlay(3, 15, 80, 0, 0, AY_CHANNEL_A);

Thanks!

Sadly it didn't help me out though. Still nothing is playing.

I should mention I'm still using v1.1.1
Is that a problem?

ronaldo

Is music already playing when you call SFXPlay? You need to call akp_musicPlay at your required Hz rate to hear SFX, as SFX is added to the music. Arkos Player documentation says it this way:
Quote from: http://lronaldo.github.io/cpctelera/files/audio/arkosplayer-txt.html
Obviously, SFXs are "added" to the music.  So you need to play the song to actually hear them ! Also, as they are adding another layer of sound to the player, they are consuming more CPU, especially if you're playing SFXs on the three channels at once.Also, note that triggering a sound over another one will cut this last one.
You may also want to check Arkos Audio example to see differences with your code.

BTW, I recommend you to update to latest version of CPCtelera from github. It's almost to the point of being tagged next release.

mr_lou

Quote from: ronaldo on 17:57, 25 September 15
Is music already playing when you call SFXPlay? You need to call akp_musicPlay at your required Hz rate to hear SFX, as SFX is added to the music.

No. I play the music in my title screen. Then when a game starts I fade out the music. There is no music playing in the game itself. Only sound-effects.

Are you saying that I can't technically achieve this by putting the sound-effects into the same tune if I don't want to play this particular tune in the game?

So calling SFXPlay() adds an instrument to the "stream" to be played, and the sound-effect itself is actually played by the musicPlay() function?

ronaldo

Quote from: mr_lou on 18:10, 25 September 15
So calling SFXPlay() adds an instrument to the "stream" to be played, and the sound-effect itself is actually played by the musicPlay() function?
It works precisely this way. Documentation for Arkos Player explains it and also explains how to have only SFX during the game: having a "dummy" song that only has the instruments and is playing nothing but the mixed SFXs. You may also reuse instruments from another song (as you are trying to do), but cpct_akp_musicPlay must be called, as that's the function that actually plays things.

For more details, you may want to check Arkos Player Manual, which is included in CPCtelera documentation.

Personally, I think that Arkos Player is a great player, but may not be suitable for all uses/needs. I plan to add other players in the future, to let users choose the one they prefer. Sorry for not having time to do it now.

mr_lou

Well damn.... looks like I have to skip sound-effects for completely other reasons....

All of my CPC's have falled sick.
First, I toast my CPC6128 because I'm an idiot. Connects FD-1 using a cable for a PC 3.5" floppy.
Then my CPC464 starts typing fffffffffffffffffffffffffffffffffffffffffff when turning it on, and loading STaRKos results in a freeze/crash.
My CPC+ still works but F3 and F6 keys are dead, and I need those to enter the instrument editor in STaRKos and to switch between instruments.
And no, I don't use Windows so I can't use Arkos Tracker. Wake me up when it's ported to Linux.

Looks like I'll just have the music playing through-out the game instead then.

EgoTrip

Maybe someone can do a Game Maker style front end for retards like me. Cos I really cant get the hang of pure code.

mr_lou

Quote from: EgoTrip on 16:01, 29 September 15
Maybe someone can do a Game Maker style front end for retards like me. Cos I really cant get the hang of pure code.

Isn't there already another framework that offers this?
I forget the name. But as far as I remember it's not that old.

EgoTrip

Theres AGD on the CPC but its extremely limited and has more bugs in it than an NHS hospital.

mr_lou

Quote from: EgoTrip on 16:16, 29 September 15
Theres AGD on the CPC but its extremely limited and has more bugs in it than an NHS hospital.

Well, there'll always be bugs, no matter what platform and framework you go with.
Part of development is to find them and work around them, however annoying it is sometimes.

Powered by SMFPacks Menu Editor Mod