Jump to content

Photo

broken pipe using sound


14 replies to this topic

#1 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • 785 posts
  • Location:Canada

Posted Mon Mar 4, 2019 2:37 PM

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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0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE,
  0x00, 0xFE, 0x00, 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, Mon Mar 4, 2019 2:37 PM.


#2 ChildOfCv ONLINE  

ChildOfCv

    Moonsweeper

  • 335 posts

Posted Mon Mar 4, 2019 3:15 PM

It seems to be choking on "constr".  Try removing the r on the end.



#3 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • Topic Starter
  • 785 posts
  • Location:Canada

Posted Mon Mar 4, 2019 3:20 PM

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 



#4 Kiwi ONLINE  

Kiwi

    Stargunner

  • 1,685 posts

Posted Mon Mar 4, 2019 4:08 PM

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. Attached File  cvnotes.zip   518.39KB   11 downloads

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. 
 


  • alekmaul likes this

#5 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • Topic Starter
  • 785 posts
  • Location:Canada

Posted Tue Mar 5, 2019 9:18 AM

Finally I can add sounds in my games.

 

I have issues with cvnotes: nothing happens when clicking on it.

 

It loads for a while then, nothing.  I use windows 10 64bit.



#6 Kiwi ONLINE  

Kiwi

    Stargunner

  • 1,685 posts

Posted Tue Mar 5, 2019 12:02 PM

It uses Java.



#7 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • Topic Starter
  • 785 posts
  • Location:Canada

Posted Tue Mar 5, 2019 2:38 PM

Java?? Minecraft uses Java and I play it often.

 

I wonder why CVnotes won't reconize java.

 

Any suggestions?



#8 Kiwi ONLINE  

Kiwi

    Stargunner

  • 1,685 posts

Posted Wed Mar 6, 2019 12:46 PM

You would have to install Java for the desktop, https://www.java.com/en/download/

I'm not sure if this would work with Window 10.  That's one of my main concern when upgrading to Window 10 because I rely on cvnotes, and cvgraphic toolkit to produce Colecovision asset and both uses desktop version of Java. 



#9 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • Topic Starter
  • 785 posts
  • Location:Canada

Posted Wed Mar 6, 2019 4:29 PM

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, Wed Mar 6, 2019 4:53 PM.


#10 ChildOfCv ONLINE  

ChildOfCv

    Moonsweeper

  • 335 posts

Posted Wed Mar 6, 2019 5:00 PM

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?



#11 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • Topic Starter
  • 785 posts
  • Location:Canada

Posted Wed Mar 6, 2019 6:23 PM

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.

 

path.png

 

Or else, it won't run.


Edited by Serguei2, Wed Mar 6, 2019 6:23 PM.


#12 ChildOfCv ONLINE  

ChildOfCv

    Moonsweeper

  • 335 posts

Posted Wed Mar 6, 2019 9:21 PM

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.



#13 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • Topic Starter
  • 785 posts
  • Location:Canada

Posted Thu Mar 7, 2019 8:28 AM

Where can I download it?



#14 ChildOfCv ONLINE  

ChildOfCv

    Moonsweeper

  • 335 posts

Posted Thu Mar 7, 2019 12:15 PM

From DanB's original post


  • Kiwi likes this

#15 Serguei2 ONLINE  

Serguei2

    Dragonstomper

  • Topic Starter
  • 785 posts
  • Location:Canada

Posted Thu Mar 7, 2019 6:10 PM

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.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users