Exemplo n.º 1
0
/*
	Callbacks standard
*/
void oslAudioCallback_PlaySound_MOD(OSL_SOUND *s)		{
    //Stereo only, mono doesn't work yet (and the speedup wouldn't be worth it)
    //md_mode = DMODE_16BITS|DMODE_STEREO|DMODE_SOFT_MUSIC;
    s->mono = 0;

    /*	int oldmode = md_mode;
    	if (osl_modStereo)		{
    		md_mode = DMODE_16BITS|DMODE_STEREO|DMODE_SOFT_MUSIC;
    		s->mono = 0;
    	}
    	else		{
    		md_mode = DMODE_16BITS|DMODE_SOFT_MUSIC;
    		s->mono = 0x10;
    	}

    	if (md_mode != oldmode)			{
    		int voice = oslGetSoundChannel(s);
    		MikMod_Reset();
    		if (voice >= 0)
    			oslAudioRecreateChannel(voice, s->mono);
    	}*/

    Player_Stop();
    Player_Start((UNIMOD*)s->data);
    Player_SetPosition(0);
}
void
MusicManager::play_music(const MusicRef& musicref, int loops)
{
// printf("loop: %d, musicref: %d\n",loops,musicref.music);
  
  if(!audio_device)
    return;

  if(musicref.music == 0 || current_music == musicref.music)
    return;

  if(current_music)
    current_music->refcount--;
  
  current_music = musicref.music;
  current_music->refcount++;
  
  if(music_enabled)
#ifndef GP2X
    Mix_PlayMusic(current_music->music, loops);
#else
  {
    if ( loops == -1 ) current_music->music->wrap=1;
    Player_Stop();
    Player_Start(current_music->music);
    Player_SetPosition(0);
  }
#endif
}
Exemplo n.º 3
0
static int l_MusicPlay(lua_State * lState)
{
	Music ** music = toMusic(lState, 1);
	if(*music)
	{
		Player_Start(*music);
		Player_SetPosition(0);
		modUpdate = true;
	}

	return 0;
}
Exemplo n.º 4
0
static uint32
moda_Seek (THIS_PTR, uint32 pcm_pos)
{
    TFB_ModSoundDecoder* moda = (TFB_ModSoundDecoder*) This;

    Player_Start (moda->module);
    if (pcm_pos)
        log_add (log_Debug, "moda_Seek(): "
                 "non-zero seek positions not supported for mod");
    Player_SetPosition (0);

    return 0;
}
Exemplo n.º 5
0
static BOOL NDS_SW_PlayStart(void)
{
	if(VC_PlayStart())
		return 1;
	
	Player_SetPosition(0);
	
	ipc->prevTimer = 0;
	ipc->writeCursor = 0;
	ipc->readCursor = 0;

	int written = VC_WriteBytes(ipc->buffer, ipc->bufferSize);
	unsignedtosigned(ipc->buffer, written);

	DC_FlushRange(ipc, sizeof(*ipc));
	MikMod9_SendCommand(NDS_SW_CMD_START << 28);
	
	return 0;
}
Exemplo n.º 6
0
static GstStateChangeReturn
gst_mikmod_change_state (GstElement * element, GstStateChange transition)
{
  GstMikMod *mikmod;

  g_return_val_if_fail (GST_IS_MIKMOD (element), GST_STATE_CHANGE_FAILURE);

  mikmod = GST_MIKMOD (element);

  GST_DEBUG ("state pending %d", GST_STATE_PENDING (element));

  if (GST_STATE_PENDING (element) == GST_STATE_READY) {
    gst_mikmod_setup (mikmod);

    if (Player_Active ()) {
      Player_TogglePause ();
      Player_SetPosition (0);
    }
    mikmod->initialized = FALSE;
  }

  if (GST_STATE_PENDING (element) == GST_STATE_PLAYING) {
    if (Player_Active () && Player_Paused ())
      Player_TogglePause ();
    else if (!Player_Active ())
      Player_Start (module);

  }

  if (GST_STATE_PENDING (element) == GST_STATE_PAUSED)
    if (Player_Active () && !Player_Paused ())
      Player_TogglePause ();

  if (GST_STATE_PENDING (element) == GST_STATE_NULL)
    MikMod_Exit ();


  if (GST_ELEMENT_CLASS (parent_class)->change_state)
    return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);

  return GST_STATE_CHANGE_SUCCESS;
}
Exemplo n.º 7
0
static void mm_set_order(struct audio_stream *a_src, Uint32 order)
{
  Player_SetPosition(order);
}
Exemplo n.º 8
0
int Mix_SetMusicPosition(double position)
{
	Player_SetPosition(position);
	return 0;
}
Exemplo n.º 9
0
static BOOL NDS_HW_PlayStart()
{
	Player_SetPosition(0);
	MikMod9_SendCommand(NDS_HW_CMD_PLAY_START << 28);	
	return 0;
}
Exemplo n.º 10
0
static int S_MIKMOD_CodecRewindStream (snd_stream_t *stream)
{
	Player_SetPosition (0);
	return 0;
}