|
Page 1 of 1
|
[ 9 posts ] |
|
RSO sound cannot be found (or wrong file played)
| Author |
Message |
|
Philipp
Rookie
Joined: Tue Nov 22, 2011 10:45 am Posts: 12
|
 RSO sound cannot be found (or wrong file played)
I have a program with 12 sound files. However, half of them can't be played. All these files are in my project (as per my computer), and RobotC also doesn't complain about not finding them. It just doesn't play them during execution. I tried renaming the files in various ways, or not using folders etc., to no avail. Can anybody help? Thanks in advance!
|
| Fri Nov 25, 2011 1:59 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: RSO sound cannot be found (or wrong file played)
Could you post the entire program?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Fri Nov 25, 2011 4:07 pm |
|
 |
|
Philipp
Rookie
Joined: Tue Nov 22, 2011 10:45 am Posts: 12
|
 Re: RSO sound cannot be found (or wrong file played)
Something like this:  |  |  |  | Code: #pragma config(Sensor, S3, touchSensor, sensorTouch) #pragma config(Sensor, S4, colorPort, sensorCOLORFULL)
void colorToSound(); void resetDidPlayNote(); void soundDummy(); task ButtonTask();
int scale = 1; const int maxNotes = 6; bool didPlayNote[maxNotes];
task main() { soundDummy(); resetDidPlayNote(); nNxtButtonTask = ButtonTask;
while (true) { if ( SensorValue(touchSensor) == 1 ) { colorToSound(); } else { resetDidPlayNote(); } wait1Msec(50); } }
void resetDidPlayNote() { int i; for (i = 0; i < maxNotes; i++) { didPlayNote[i] = false; } }
void colorToSound() { string note = "0"; switch (SensorValue[colorPort]) { case BLACKCOLOR: note = "1"; break; case REDCOLOR: note = "2"; break; case GREENCOLOR: note = "3"; break; case YELLOWCOLOR: note = "4"; break; case BLUECOLOR: note = "5"; break; case WHITECOLOR: note = "6"; break; } int iNote = atoi(note); string scaleName = "c"; switch (scale) { case 1: scaleName = "c"; break; case 2: scaleName = "f"; break; }
if (iNote != 0 && !didPlayNote[iNote - 1]) { // PlayTone(500 + note * 100, 1);
resetDidPlayNote(); didPlayNote[iNote - 1] = true;
string soundFile = "sound/"; strcat(soundFile, scaleName); strcat(soundFile, "/"); strcat(soundFile, note); strcat(soundFile, ".rso");
nxtDisplayTextLine(2, "Scale %s", scaleName); nxtDisplayTextLine(3, "Note %s", note); nxtDisplayTextLine(4, "%s", soundFile); ClearSounds();
// passing soundFile as variable didn't work so far (see other thread question), hence this workaround if (soundFile == "sound/c/1.rso") { PlaySoundFile("sound/c/1.rso"); } else if (soundFile == "sound/c/2.rso") { PlaySoundFile("sound/c/2.rso"); } else if (soundFile == "sound/c/3.rso") { PlaySoundFile("sound/c/3.rso"); } else if (soundFile == "sound/c/4.rso") { PlaySoundFile("sound/c/4.rso"); } else if (soundFile == "sound/c/5.rso") { PlaySoundFile("sound/c/5.rso"); } else if (soundFile == "sound/c/6.rso") { PlaySoundFile("sound/c/6.rso"); }
else if (soundFile == "sound/f/1.rso") { PlaySoundFile("sound/f/1.rso"); } else if (soundFile == "sound/f/2.rso") { PlaySoundFile("sound/f/2.rso"); } else if (soundFile == "sound/f/3.rso") { PlaySoundFile("sound/f/3.rso"); } else if (soundFile == "sound/f/4.rso") { PlaySoundFile("sound/f/4.rso"); } else if (soundFile == "sound/f/5.rso") { PlaySoundFile("sound/f/5.rso"); } else if (soundFile == "sound/f/6.rso") { PlaySoundFile("sound/f/6.rso"); } } }
task ButtonTask() { switch (nNxtButtonPressed) { // case kLeftButton: ; break; // case kRightButton: ; break; case kEnterButton: const int maxScales = 2; scale++; if (scale > maxScales) { scale = 1; } break; } return; }
void soundDummy() { // PlaySoundFile("sound/c/1.rso"); }
|  |  |  |  |
|
| Fri Nov 25, 2011 4:28 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: RSO sound cannot be found (or wrong file played)
Your code looks fine, but I can't really test it without the sound files. Can you attach them to a post?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Fri Nov 25, 2011 4:42 pm |
|
 |
|
Philipp
Rookie
Joined: Tue Nov 22, 2011 10:45 am Posts: 12
|
 Re: RSO sound cannot be found (or wrong file played)
|
| Fri Nov 25, 2011 5:02 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: RSO sound cannot be found (or wrong file played)
I just tested it, and it's working perfectly. I didn't modify anything. Is there actually a difference in the scales yet? They sound the same to me.
Are you using the latest version of RobotC? The latest firmware? Cause' I'm not seeing anything wrong.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Fri Nov 25, 2011 6:07 pm |
|
 |
|
Philipp
Rookie
Joined: Tue Nov 22, 2011 10:45 am Posts: 12
|
 Re: RSO sound cannot be found (or wrong file played)
Well, that's the problem -- they sound the same to me too. However, the original WAV files are different, and for what it's worth the RSO files also have different file sizes. Hmm.
|
| Fri Nov 25, 2011 6:37 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: RSO sound cannot be found (or wrong file played)
Well, I've only used a couple of converted sound files before(and that was with NXT-G), so I'm not sure what else I can do. I've heard before that there have been problems with sounds in RobotC. Try contacting support and see what they say.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Fri Nov 25, 2011 7:20 pm |
|
 |
|
Philipp
Rookie
Joined: Tue Nov 22, 2011 10:45 am Posts: 12
|
 Re: RSO sound cannot be found (or wrong file played)
Thanks! I've been sort of switching to the PlaySound/ Frequency approach now as alternative.
|
| Fri Nov 25, 2011 7:40 pm |
|
|
|
Page 1 of 1
|
[ 9 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 3 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|