PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

playing loaded sample files

I know there is an answer to this question already but I can't seem to find it:

Ok here's the deal, I load a sample file using LoadSample from API interface. It loaded the sound successfully. I then call the PlaySample and I didn't hear anything. I check the source code and the volumes are default to 255. I don't have any apps opened that are playing sounds.

I assume the sound interfaces already has been initialized.

The file format is WAV 8-bit mono.
same thing for me :/

Code:

SAMPLE *m_mywave;
m_mywave = g_Api->LoadSample ( "Sounds\\myfile.wav" );
g_Api->PlaySample( m_mywave );

//...
g_Api->Update( true, true );
//...



gives no result
* is the PlaySample thread updated the same way as music does by g_Api->Update( true true ); ?
Are you playing a mod file simultaneously?
nope
Ow.
So are you saying that we should have a mod playing simultaneously?

I still haven't bothered looking for solutions...

For now I wait for v0.99
I'm sorry I didn't get back on this to you.

I asked about the mod file because we found that under XP ('emulation'), MikMod will gladly play simultaneously with other apps (you can hear sounds while playing WinAmp too, so that's only logical). Under WinCE, this is not the case. Playing a sound blocks the audio system for other sounds.

We used to play samples using the WinCE API, not MikMod. I'm not sure how the current situation is, I'll look into this. But if that's still the case, you wouldn't be able to play sounds AND play music. That would be easy to fix though.

Then again, it looks like that is NOT the problem, since you are playing without music. :) Could you tell me what the frequency is of the sample you're trying to play? I noticed that odd frequencies don't work well...

- Jacco.
I believe it's 8 kHz. Yes, I've seen in other posts that there are problems in certain frequency. But the only problem I heard of is that it plays the sound wierd, not silence. :(

Maybe it's the file format? It just so happens that mikmod was able to load the file successfully...
Sample_Play returns 0 for result (from Sample_Play_internal). Is that good?
also tried with a 22.5 k / 8 bits / mono

can someone post just a working sample code for a sound play ie just add a sound in caverunner so we can try being sure we have the same basis
Hi guys,

I had this very same problem this morning and it turns out theres a bug. Currently you HAVE to play a music file if you want to hear your samples thanks to a problem within the UpdateMusic() function and the way it currently checks to see if theres anything that needs to be played.

Ive just informed Jacco about it and hes gunna get it fixed in the next release.

Dan
Nice !!!!! thanks :)
I knew it. Thanks man!
Has this problem been resolved yet? Just making sure...You guys might've forgotten.
It is fixed in the new non-beta version we will be uploading later today. But if you really want the fix right now, go to ApiImpl.cpp and then to the funtion ApiImpl::UpdateMusic. Change it to the following:

Code:

void ApiImpl::UpdateMusic()
{
MikMod_Update();

if ( ! Player_Active())
{
// Reset and restart;
Player_SetPosition( 0 );
Player_Start( m_Module );
}
}


That should fix it. Sorry for the trouble.

Cheers,

Jape
Jape,

it happens to be several frames between when we use PlaySample() and when we start to hear the sound, i made a small wav with just a "tic" with no blank at the start. it seems we lose about 1/4 or 1/3 second before the sound begins really.

is it for everybody (it happens also for w32) ?
is that a period of loading or some other stuff in mikmod ?

Lewil
I'm sorry, that is beyond me. I have no experience with MikMod and it's sound-effect capabilities. Probably Phantom will answer this one.

Cheers,

Jape