Jump to content
IGNORED

broken pipe using sound


Serguei2

Recommended Posts

I get 'sdcpp.exe: fatal error: when writing output to : Broken pipe
C:\robin\ColecoVision\robin>sdcc -mz80 -c --std-c99 --oldralloc sound.c
sound.c:4: syntax error: token -> 'byte' ; column 11' and it won't compile.

#include <coleco.h>
#include <getput1.h>

constr byte test_sound1[]= {
 0, 0x63,0xf,1,
 0x81,0xa0,0x90,1, 0x81,0x1c,0x97,1, 0x81,0x2c,0x9d,2, 0x81,0x32,0x9e,1,
 0,0,0
};

constr byte test_sound2[]= {
 0xf8,0xe4, 1,0xf2, 1,0xe4, 1,0x63,0x02,0x01,0xe5,
 1,0xe4, 1,0xe5, 1,0xe4, 1,0xe5, 1,0xe4, 1,0xe5, 1,0xe4, 5,
 0,0,0
};

const byte gtsNAME[] = {
  0xFE, 0x20, 0xFE, 0x20, 0xFE, 0x20, 0xFE, 0x20, 0xFE, 0x20, 0xFE, 0x20, 0x85, 0x20, 0xFF};

const byte gtsPATTERN[] = {
  0xFE, 0x00, 0xFE, 0x00, 0x89, 0x00, 0x01, 0x1C, 0x38, 0x82, 0x18, 0x02, 0x00, 0x18, 0x18,
  0x82, 0x66, 0x85, 0x00, 0x21, 0x44, 0xFE, 0x44, 0x44, 0xFE, 0x44, 0x00, 0x18, 0x3E, 0x60, 0x3C,
  0x06, 0x7C, 0x18, 0x00, 0xFF, 0x81, 0xB9, 0xA5, 0xB9, 0xA5, 0x81, 0xFF, 0x3C, 0x66, 0x3C, 0x38,
  0x67, 0x66, 0x3F, 0x00, 0x06, 0x0C, 0x18, 0x84, 0x00, 0x01, 0x0C, 0x18, 0x82, 0x30, 0x04, 0x18,
  0x0C, 0x00, 0x30, 0x18, 0x82, 0x0C, 0x08, 0x18, 0x30, 0x00, 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66,
  0x82, 0x00, 0x81, 0x18, 0x02, 0x7E, 0x18, 0x18, 0x86, 0x00, 0x81, 0x18, 0x00, 0x30, 0x82, 0x00,
  0x00, 0x7E, 0x88, 0x00, 0x81, 0x18, 0x81, 0x00, 0x10, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00,
  0x3C, 0x66, 0xCE, 0xD6, 0xE6, 0xCC, 0x78, 0x00, 0x18, 0x38, 0x83, 0x18, 0x2C, 0x1C, 0x30, 0x0E,
  0x1E, 0x36, 0x06, 0xFC, 0xC0, 0xFE, 0x00, 0x0E, 0x1E, 0x36, 0x06, 0x3C, 0x86, 0xFE, 0x00, 0x0E,
  0x1E, 0x36, 0x66, 0xFE, 0x06, 0x06, 0x00, 0x1E, 0x3E, 0x70, 0xE0, 0xFC, 0x0E, 0xFE, 0x00, 0x0E,
  0x1E, 0x30, 0x60, 0xDE, 0xF2, 0xFE, 0x00, 0x7E, 0xC6, 0x0C, 0x82, 0x18, 0x18, 0x1C, 0x30, 0x1E,
  0x3E, 0x66, 0x66, 0xFC, 0xC6, 0xFE, 0x00, 0x3C, 0x66, 0xCE, 0xFE, 0x06, 0x0C, 0x38, 0x00, 0x00,
  0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x82, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, 0x0E,
  0x18, 0x30, 0x60, 0x30, 0x18, 0x0E, 0x82, 0x00, 0x02, 0x7E, 0x00, 0x7E, 0x82, 0x00, 0x0F, 0x70,
  0x18, 0x0C, 0x06, 0x0C, 0x18, 0x70, 0x00, 0x1E, 0x3E, 0x66, 0x06, 0x18, 0x18, 0x00, 0x18, 0x87,
  0x00, 0x38, 0x0E, 0x1E, 0x36, 0x66, 0xFE, 0xC6, 0xC6, 0x00, 0x0E, 0x1E, 0x26, 0x66, 0xFC, 0xC6,
  0xFE, 0x00, 0x0E, 0x1E, 0x32, 0x60, 0xC0, 0xC2, 0xFE, 0x00, 0xE0, 0xF0, 0xD8, 0xCC, 0xC6, 0xCE,
  0xFC, 0x00, 0x0E, 0x1E, 0x30, 0x60, 0xFC, 0xC0, 0xFE, 0x00, 0x0E, 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, 0xB2, 0x00, 0xFF};

const byte gtsCOLOR[] = {
  0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE,
  0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE, 0x41, 0xFE,
  0x41, 0x8F, 0x41, 0xFF};

void main(void)
{
 screen_mode_2_text();
 paper(0xc);
 rle2vram (gtsPATTERN,0x0000);
 rle2vram (gtsCOLOR,0x2000);
 rle2vram (gtsNAME,0x1800);
 duplicate_pattern();
 cls();
 screen_on();
 print_at(1,1,"APPUYER BOUTON");
 enable_nmi();
 loop:
  if(joypad_1&FIRE1){
   disable_nmi();
   print_at(1,2,"BOUTON 1");
   start_sound(test_sound1);
   enable_nmi();
  }
  if(joypad_1&FIRE2){
   disable_nmi();
   print_at(1,2,"BOUTON 2");
   start_sound(test_sound2);
   enable_nmi();
  }
 goto loop;
}
void nmi(void) {}

It seems I need to build a sound list if I want to use play_sound instead.

Edited by Serguei2
Link to comment
Share on other sites

Thanks. Now I get this:

sound.c:72: warning 112: function 'start_sound' implicit declaration
C:\robin\ColecoVision\robin>sdcc -mz80 -c --std-c99 --oldralloc  sound.c 
sound.c:78: warning 112: function 'start_sound' implicit declaration
sound.c:72: error 101: too many parameters 
sound.c:78: error 101: too many parameters 

Link to comment
Share on other sites

Start sound is disabled. You'll have to use play sound.

Very start of the program you'll need to set the sound table,

void main(void){
set_snd_table(snd_table);
resetgame:
screen_mode_2_bitmap();
fill_vram(0x1A00,32,256);
disable_nmi();
show_picture(TitleCol);
rle2vram(grailPATTERN,0x1000);
rle2vram(grailCOLOR,0x3000);
..

The sound list looks like,

const sound_t snd_table[] = {
	{snd_beat,SOUNDAREA1},//
	{snd_playeratk,SOUNDAREA5},
	{snd_playeratkn,SOUNDAREA6},
	{snd_monsteratk,SOUNDAREA5},
	{snd_monsteratkn,SOUNDAREA6},//5
	{snd_monsterdefeat,SOUNDAREA4},
	{snd_skeleton,SOUNDAREA4},
	{snd_tick,SOUNDAREA4},
	{snd_gold,SOUNDAREA4},
	{snd_gold2,SOUNDAREA5},//10
	{snd_potion,SOUNDAREA5},
	{snd_stairs,SOUNDAREA5},
	{snd_stairsn,SOUNDAREA6},//13
	{snd_levelup,SOUNDAREA4},//14
	};

For some reason the very first entry MUST be SOUNDAREA1. SOUNDAREA1 is the lowest priority sound effect. I recommend using SOUNDAREA1-SOUNDAREA3 to be music track. SOUNDAREA4-6 to be sound effects. There's no SOUNDAREA7 and up. When a sound effect on SOUNDAREA5 is using the same sound channel as SOUNDAREA1, it will take over the sound channel and then return the sound channel back to SOUNDAREA1. It's like how NES does it.

I use this tool to make my sound effect. cvnotes.zip

Make sure your sound effect have a terminator specifically for the sound channel.

For example:

const byte snd_potion[] = {
0x40,0x1D,0x41,0x02,
0x40,0x01,0xf0,1, //BLANK Note
0x40,0xFE,0x40,0x02,
0x40,0x01,0xf0,1, //BLANK Note
0x40,0xE2,0x40,0x02,
0x40,0x01,0xf0,1, //BLANK Note
0x40,0xD6,0x40,0x03,
0x40,0x01,0xf0,1, //BLANK Note
0x40,0xAA,0x40,0x03,
0x40,0x01,0xf0,1, //BLANK Note
0x40,0x8F,0x40,0x03,
0x50	
};

0x50 will stop the sound effect specific to that channel. 0x58 will repeat the sound effect until another sound effect enters the SOUNDAREA. or stop_sound(1);, stopping the sound. There are 3 tone,0x50,0x90,0xd0 channel and 1 noise 0x10 channel. Not having the terminator will wreak havoc to your game. To play the sound, play_sound(1); 1 is the entry number. So if I want to play snd_potion, I do play_sound(11);

So that how sound works.

  • Like 1
Link to comment
Share on other sites

I get this: 'A Java Exception has occured'

 

Even Minecraft won't start.

 

 

Edited: I installed java 64bit of the same version.

 

- Minecraft runs fine

 

- CVnotes: no error. No message. Nothing.

 

Either CVnotes only works on java 32bit or windows 10 refuses to run it because it wants to protect my computer.

 

 

I noted CVnotes was created in 2013. It maybe has issues with newest versions.

Edited by Serguei2
Link to comment
Share on other sites

You only need whichever Java JVM works. So if 64-bit works, then you're good as far as that goes. And if Minecraft gives you the graphics and soundfx, then Java itself must run okay.

 

One possibility is that CVnotes requires Java to be in the path so that it doesn't have to specify the path itself. If you start a CMD shell and type "java", does it run, or just say "command not found" or whatever Windoze says these days?

Link to comment
Share on other sites

I typed java on cmd shell I get this message.

 

Syntaxe : java [-options] class [args…]

 

 

I typed CVnotes as well. I get 'command not found'.

 

 

Minecraft Java uses paths to run.

 

post-1196-0-86975100-1551918144.png

 

Or else, it won't run.

Edited by Serguei2
Link to comment
Share on other sites

That's good. There's a .jar form of CVNotes available for download. Try running that in a cmd shell:

 

java -jar cvnotes.jar (obviously from the directory where you stored your downloaded cvnotes.jar file)

 

Maybe that will either run something, or at least give you an error message to help figure out what happened.

Link to comment
Share on other sites

That's good. There's a .jar form of CVNotes available for download. Try running that in a cmd shell:

 

java -jar cvnotes.jar (obviously from the directory where you stored your downloaded cvnotes.jar file)

 

Maybe that will either run something, or at least give you an error message to help figure out what happened.

 

Not even need to run in a cmd shell.

 

Just click on it and voila. It runs.

 

Thanks for the help.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...